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 services and specify default parameters for running
env develop
, env sync
, or env exec
commands. These parameters will be detected and used when a command is triggered from the command line.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.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.Explicitly: By passing the file path as an argument. For example:veloctl env develop --service website --file my.velocity.yaml
The parameters you can specify for env develop are:
- command: The local command you need to run when developing the service
- environment: The environment variables you want to set locally when developing the 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
For env sync you can specify all the available command parameters using the following file syntax.
version: 1
services:
analytics:
sync:
source: /dev/vironcorp/gcp-service. # Source code directory
build_and_push:
velocity_builder: # Configuration for the remote build
args:
- '-f ./Dockerfile .'
env:
key: Value
env_from_secrets:
- name: my-secret
exclude_patterns: # Paths to exclude
- \/*.go
- \/*.md
- ./configStuff
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
version: 1
services:
analytics:
sync:
source: /dev/vironcorp/gcp-service
build_and_push:
velocity_builder: # Configuration for the remote build
args:
- '-f ./Dockerfile .'
env:
key: Value
env_from_secrets:
- name: my-secret
live_updates: # Paths to watch
- './src:/app/src'
exclude_patterns: # Paths to exclude
- \/*.go
- \/*.md
- ./configStuff
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
For env exec 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
Last modified 5d ago