Search
⌃K

Env Sync Configuration

You can define the behavior of Env Sync for individual Velocity Services by setting values in the services.<service_name>.sync section of your .velocity.yaml file.
---
version: '1'
services:
backend:
sync:
command: sh # Override the container command with 'sh -c yarn start'
args:
- -c
- yarn start
rerun_on_failure
website:
sync:
update_image: false # Build and use a new docker image on start
For example, in the above .velocity.yaml file the Velocity Service backend has been configured to, upon container restart, replace the default container CMD with a new command -- sh -c yarn start.
Similarly, the Velocity Service website has been configured to not rebuild the related Docker image when a user first starts Env Sync by running veloctl env sync --service website, and instead only rebuild it when a code change is detected.

command

A command to run in place of the default container CMD at container restart.

Example of command

sync:
command: ./app # Override the container command with './app'

update_image

Build and use a new docker image on start (default: 'false').

Example of update_image

sync:
update_image: true # Build and use a new docker image on start and use the existing running image instead

skip_first_build

Skips building a new image on start (default: 'true').

Example of skip_first_build

sync:
skip_first_build: true # Keep the existing image on start

build_and_push

Configure the remote rebuilding of your container image.

Example of build_and_push

sync:
build_and_push:
velocity_builder: # Configuration for the remote build
args: # Docker build command arguments
- -f ./Dockerfile .
env: # Environment variables to inject into the builder
key: Value
env_from_secrets: # Secrets to load as environment variables into the builder
- name: my-secret

exclude_patterns

Files and directories in which code changes should not trigger an image rebuild.

Example of exclude_patterns

sync:
exclude_patterns: # Paths to exclude from change detection
- '**/testing/**'
- '*.md'

debug

The debug command to run in place of the default container CMD at container restart and the ports to expose.

Example of debug

sync:
debug: # Remote debugging configuration
command: COMMAND # The command to run the remote debugger
debugger_port: 9229 # The port the debugger listens to
local_port: 9229 # The port to expose locally on the developer's machine

ssh

Configure SSH for remote debugging in RubyMine and PyCharm.

Example of ssh

sync:
ssh: # SSH exposure configuration (related to remote debugging)
expose: false # Should we expose SSH locally from the container (disabled by default, needed only in some cases)
local_port: 6060 # The port to expose the SSH locally on the developer's machine

forward

Configure port-forwards that will be established when env sync starts for accessing remote services.

Example of forward

sync:
interface: 0.0.0.0 # The bind address used when running port-forward. Defaults to 'localhost'
forward: # Run port-forward to specific services
- 3000 # Run port-forward from '0.0.0.0:3000' to '<current-service>:3000'
- 8080:3000 # Run port-forward from '0.0.0.0:8080' to '<current-serivce>:3000'
- 8082:website:3000 # Run port-forward from '0.0.0.0:8082' to 'website:3000'

live_updates

Define a mapping of the local development directory to the source code directory in the remote container.

Example of live_updates

sync:
live_updates: # Paths to watch for file sync
- ./src:/app/src

action_hooks

Define action hooks that are triggered on specific files changes.

Example of action_hooks

sync:
action_hooks: # Actions to run after syncing specific files/paths
- path: ./Dockerfile
action: rebuild
- path: ./my/path
action: execute
command: /bin/sh
args:
- -c
- ./my-script.sh