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.A command to run in place of the default container
CMD
at container restart.sync:
command: ./app # Override the container command with './app'
Build and use a new docker image on start (default: 'false').
sync:
update_image: true # Build and use a new docker image on start and use the existing running image instead
Skips building a new image on start (default: 'true').
sync:
skip_first_build: true # Keep the existing image on start
Configure the remote rebuilding of your container image.
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
Files and directories in which code changes should not trigger an image rebuild.
sync:
exclude_patterns: # Paths to exclude from change detection
- '**/testing/**'
- '*.md'
The debug command to run in place of the default container
CMD
at container restart and the ports to expose. 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
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
Configure port-forwards that will be established when
env sync
starts for accessing remote services.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'
Define a mapping of the local development directory to the source code directory in the remote container.
sync:
live_updates: # Paths to watch for file sync
- ./src:/app/src
Define action hooks that are triggered on specific files changes.
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
Last modified 2mo ago