This quick start guide shows how to run Hoop in a local docker-compose environment.
Requirements
- Hoop Command Line installed locally
- Free account at hoop.dev
- Signup at hoop.dev for a new organization
- Open a terminal and login using the Hoop command line
shellhoop login
Export the key in your local machine
shellexport HOOP_KEY=$(hoop admin get orgkeys)
Clone the getting started guide and start
shellgit clone git@github.com:hoophq/hoop-getting-started.git cd hoop-getting-started/ruby docker compose -f docker-compose.yml up
It will start a ruby on rails application at http://127.0.0.1:3000 and create a connection resource on Hoop with the name
railsc-demo
Rails Console Access
Start the
rails console
connected to the main applicationshellhoop connect railsc-demo
markdownconnection: railsc-demo | session: b78183a8-9b25-4d58-ac52-777691d36bb6 Running via Spring preloader in process 66 Loading development environment (Rails 5.2.8.1) irb(main):001:0>
Type
ENV["CONTENT"]
and then hit enter, it will show the content redactedplain textirb(main):001:0> ENV["CONTENT"] => "the sensitive content (*****mail@domain.tld) will be redacted"
Ad Hoc Executions
The example below demonstrates how to establish a connection for performing ad-hoc executions. First, stop the Docker Compose command, then execute the given example.
This example will create a connection with the name
rails-adhoc-demo
shelldocker compose -f docker-compose-adhoc.yml up
Perform ad-hoc executions
shellhoop exec rails-adhoc-demo -i 'puts "Hello World"'
The web app provides an improved experience for these executions. Visit the webapp and select this connection to interact with it.
Embedded Process
The later examples run the agent (
hoop run
) as a standalone process. This one demonstrates how it can be run embedded within your application.The command below illustrates how this can be accomplished. Everything after the
--
delimiter represents the main application command, which will run in the foreground, while the agent runs in the background.shellhoop run --name railsc-embedded-demo \ --data-masking EMAIL_ADDRESS,URL \ --command 'rails console' \ -- bundle exec rails s -p 3000 -b '0.0.0.0'
docker-compose-embedded.yml
The streams stdout and stderr are linked to your main application, as well as the agent.
This example will create a connection with the name
railsc-embedded-demo
shelldocker compose -f docker-compose-embedded.yml up
Connect via rails console
shellhoop connect railsc-embedded-demo