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.

Creating a Development environment

  1. 1.
    Open the Terminal and navigate to the project folder where you keep your docker-compose definition file.
  2. 2.
    Run veloctl env up and specify the names of the services you'd like to offload. You may also execute a --pre-run command 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"
To make sure your docker-compose file is supported, please check the docker-compose compatibility matrix, and contact us at [email protected] if you'd like more information about upcoming features.

Understanding your developer environment

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 ps connect your local environment to the remote cluster.

Handling errors and troubleshooting

In cases where your environment fails to deploy, you may run veloctl env logs to fetch the log files from the remote cluster.

Applying code changes to your environment

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

Destroying a development environment

To destroy a running development environment, run:
veloctl env down
This will terminate all remote and local running services.
NOTE: unlike running 'env down', destroying a running environment from the web interface will keep the local services running. To remove them, use docker-compose down separately.