Docker Compose environments
You can work on your code locally while the rest of the stack runs remotely. Since the environment runs in the cloud, you can share it with team members and keep it running as long needed.
- 1.Open the Terminal and navigate to the project folder where you keep your docker-compose definition file.
- 2.Run veloctl env up and specify the names of the services you'd like to offload. You may also execute a
--pre-runcommand to initialize data before a service starts.
veloctl env up -f docker-compose.yml --offload=mongodb,rabbitmq --pre-run "backend|rails db:create db:migrate"
Once you've created a hybrid development environment, you will receive a link to the environment dashboard.
The dashboard will present a visual diagram of your services, including their service dependencies.
The proxy services you see when you run
docker psconnect your local environment to the remote cluster.
In cases where your environment fails to deploy, you may run veloctl env logs to fetch the log files from the remote cluster.
Hybrid development environments are easy to work with since they behave like local environments. The developed service runs on your local machine, and changing its code is the same regardless of where its dependencies are running.
Usually, there are two alternatives to update a running service, depending on the type of coding language:
- Hot reload - For use with scripted languages (such as Python). Your service should use a shared volume that is mapped to your local machine, and with every file change, the files get synced with the running container, making your application refresh and reflect the changes.
- Container restart - For use with compiled languages (such as .Net, Golang or Rust). Whenever you want to recreate the container with the latest code changes, you should run:docker-compose up -d --force-recreate --no-deps --build my-service
To destroy a running development environment, run:
veloctl env down
This will terminate all remote and local running services.