Search…
⌃K

Code sync & Hot reload

Sync local code changes with a running remote container
Velocity supports this workflow using the env sync command, which monitors a local folder on your computer, identifies when files get changed, and automatically synchronizes them with your running remote container.
This approach is useful for the following reasons:
  • Lower Latency - If your application communicates with external services, developing and debugging locally introduces latency between your computer and the external service endpoint.
  • Reduced resource consumption - If your application consumes a lot of resources or if your local machine is low on resources, the development and debugging experience can degrade.
  • Reduced drift - Developing and debugging your application on the remote container bears a lower level of drift than offloading it locally. The container configuration stays the same as in the cloud, and you do not need to install specific environment tools in a specific version.
Velocity's Env Sync functionality makes this possible by continuously synchronizing local code changes with the associated service's container image that is running in the remote environment.
The env sync command works by monitoring a local folder on your computer. It identifies when files are updated locally and automatically synchronizes your code changes with your remotely running container.

Velocity supports two types of Code Synchronization

Synchronizing changes using Image rebuild

For use with compiled languages (such as .Net, Golang or Rust). Velocity will detect the code changes, trigger an image rebuild, and update and restart the remote running service, making your application reflect the changes.
  1. 1.
    Trigger an image rebuild
  2. 3.
    Pull the image and restart the container
  3. 4.
    Sync the logs back to the command line output, to allow you to identify problems that might have occurred when building and deploying the new image.
In this mode, once the env sync command starts, Velocity monitors your local folder and detects file changes. With every detected file change, Velocity will run the following actions:
  1. 1.
    Trigger an image rebuild
  2. 2.
    Publish the image to a container registry hosted in your Velocity cluster
  3. 3.
    Pull the image and restart the container
  4. 4.
    Sync the logs back to the command line output, to allow you to identify problems that might have occurred when building and deploying the new image.

Synchronizing changes using Live update (Hot Reload)

For use with scripted languages (such as Python). Velocity will push updated files to the remote service, making your application refresh and reflect the changes instantly.
In this mode, once the env sync command starts, Velocity monitors you local folder and detects file changes. Your local folder will be mapped with a single folder in the running container, and with every detected file change, Velocity uses rsync to copy the changed files from your local folder into the target folder in the container.