Search…
Develop locally

Running a service locally

Velocity creates your environment in the cloud while enabling you to "replace" parts of it during development.
Just as you run your service locally, wrap your command with veloctl env develop:
1
veloctl env develop --service serviceName -- <command>
Copied!
1
# Running a node.js application:
2
$ veloctl env develop --service website -- yarn start
3
[VELOCTL] Developing service 'website' in environment 'almighty-wednesday-51'...
4
[VELOCTL] Executing command: yarn start
5
[VELOCTL] Service 'website' is also accessible via https://website-almighty-wednesday-51.awesomedev.com
Copied!
The double dash (--) is important to separate any arguments you pass to your command from the commands passed to veloctl. But don't worry, we'll let you know if you forget it!
Velocity automatically adds the relevant environment variables to your environment and routes any dependency from your local computer to the remote environment, so you won't have to worry about your dependencies and how to connect to them! To see what we are doing, check the Verbosity section.

Running via docker

If your service runs inside a docker container (via docker run), that's fine, we support that too! Just pass the same command to veloctl env develop:
1
veloctl env develop --service serviceName -- docker run [...]
Copied!

Verbosity

If you're into the details, you can also pass the -v/--verbose flag to see exactly what environment variables are injected and which ports are forwarded into your environment.
1
veloctl env develop -v --service worker -- go run ./
Copied!
1
[VELOCTL] Developing service 'worker' in environment 'glorious-saturday-15'...
2
[VELOCTL] Forwarding: localhost:54416 => rabbitmq:5672
3
[VELOCTL] Forwarding: localhost:52950 => analytics:3000
4
[VELOCTL] Injecting environment variables:
5
[VELOCTL] ANALYTICS_URL=http://127.0.0.1:52950
6
[VELOCTL] RABBITMQ_URL=amqp://PtYS0Qfl:[email protected]:54416/queue1
7
[VELOCTL] Executing command: go run ./
Copied!
veloctl merges your current environment variables with the injected ones from the execution. In this case, if RABBITMQ_URL was defined in the shell before launching veloctl, it will be overwritten with the value coming from your environment.

Dry Run

In some cases, you might want to test how your command would execute if you run it through velocity. To do so, use the --dry-run flag (which also imply --verbose)
1
veloctl env develop --dry-run --service website -- yarn start
Copied!
1
[VELOCTL] Will develop service 'website' in environment 'almighty-wednesday-51'...
2
[VELOCTL] Will forward: localhost:3002 => backend:3002
3
[VELOCTL] Will inject the environment variables:
4
[VELOCTL] REACT_APP_SERVICE_URL=http://127.0.0.1:3002
5
[VELOCTL] Will execute command: yarn start
6
[VELOCTL] Service 'website' will also be accessible via https://website-almighty-wednesday-51.awesomedev.com
Copied!
Last modified 1mo ago