Search
⌃K

The .velocity.yaml config

Use a configuration file to simplify using the veloctl CLI
​To simplify working with the veloctl ​command, you can define command shortcuts and keep them in .velocity.yaml configuration file.
This file can be saved in your git repository and shared among all team members.
In this file, you can keep a list of Velocity Services and specify default parameters for running veloctl env develop, veloctl env sync, or veloctl env exec commands. These parameters will be detected and used when a command is triggered from the command line.

In this article

Location

By default, veloctl will look for the .velocity.yaml file in veloctl's current working directory.
Setting the environment variable VELOCITY_CONFIG_PATH will override the default location.
Every veloctl command that uses .velocity.yaml will have a --file/-f flag that will override default and environment variable settings

Structure

This is the basic structure of .velocity.yaml configuration file:
---
version: '1'
services:
backend:
develop:
// ... Specify the default values when running develop for service 'backend'
sync:
// ... Specify the default values when running sync for service 'backend'
exec:
// ... Specify the default values when running exec for service 'backend'
website:
develop:
// ... Specify the default values when running develop for service 'website'
sync:
// ... Specify the default values when running sync for service 'website'
exec:
// ... Specify the default values when running exec for service 'website'
The file can be used in two ways:
  1. 1.
    Implicitly: When running env develop or env sync without the command parameter from a location that contains the configuration file, the file will automatically be detected and used. For example:
    veloctl env develop --service website
  2. 2.
    Explicitly: By passing the file path as an argument. For example:
    veloctl env develop --service website --file my.velocity.yaml

Env develop

The parameters you can specify for veloctl env develop are:
  • command: The local command you need to run when developing a Velocity Service
  • environment: The environment variables you want to set locally when developing a Velocity Service
---
version: '1'
services:
backend:
develop:
command: |
docker run \
-e RAILS_ENV=development \
--rm \
-v `pwd`:/usr/src/app \
-t backend_web \
sh -c "rm -f tmp/pids/server.pid && bundle exec rails s -p \$PORT -b '0.0.0.0'"
environment:
DEBUG: 1
VAR2: hello
lowercase: value
website:
develop:
command: yarn start
environment:
PORT: 3003

Env sync

For veloctl env sync you can specify all the available command parameters using the following file syntax.
For more information about env sync parameters, you can follow the CLI Reference.

Configuration for compiled languages - Image-Rebuild method

version: 1
services:
analytics:
sync:
command: ./app # Override the container command with './app'
skip-first-build: true # Skip building a new docker image on start and use the existing running image instead
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 # The secret should exist in the 'velocity' namespace
exclude_patterns: # Paths to exclude from change detection
- '**/testing/**'
- '*.md'
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: # 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: # Run port-forward to specific services
- 8080:3000 # Run port-forward from localhost:8080 to analytics:3000
- 8082:website:3000 # Run port-forward from 'localhost:8082' to 'website:3000'

Configuration for interpreted languages - Live-Sync method

version: 1
services:
analytics:
sync:
command: sh # Override the container command with 'sh -c yarn start'
args:
- -c
- yarn start
skip-first-build: true # Skip building a new docker image on start
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 # The secret should exist in the 'velocity' namespace
live_updates: # Paths to watch for file sync
- ./src:/app/src
exclude_patterns: # Paths to exclude from change detection
- '**/node_modules/**'
- '*.md'
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-scriptyaml
forward: # Run port-forward to specific services
- 8080:3000 # Run port-forward from localhost:8080 to analytics:3000
- 8082:website:3000 # Run port-forward from 'localhost:8082' to 'website:3000'

Env exec-script

For veloctl env exec-script you can specify all the available command parameters using the following file syntax:
version: 1
services:
analytics:
exec:
scripts:
get-mongodb-url:
description: prints mongodb url
command: sh
args:
- -c
- env | grep MONGODB_URL
my-test:
description: run sanity test
command: ./test.sh
Example usage:
veloctl env exec-script -s analytics my-test