Zerops YAML Configuration
The zerops.yml
file is crucial for defining how Zerops should build and deploy your application.
Add the zerops.yml
file to the root of your repository and customize it to suit your application's needs.
Quick Links to Runtime-Specific Guides​
Basic Structure​
- The top-level element is always
zerops
. setup
contains the hostname of your service (must exist in Zerops).- Multiple services can be defined in a single
zerops.yml
(useful for monorepos):
Each service configuration requires build
and run
sections. An optional deploy
section can be added for readiness checks.
Build Configuration​
base (Required)​
Sets the base technology for the build environment. See available options.
You can specify multiple technologies:
os (Optional)​
Sets the operating system for the build environment. Options:
alpine
(default)ubuntu
Current versions:
- Alpine 3.19
- Ubuntu 22.04
prepareCommands (Optional)​
Customizes the build environment by installing additional dependencies or tools.
buildCommands (Required)​
Defines the commands to build your application.
Running commands in a single shell instance:​
deployFiles (Required)​
Specifies which files or folders to deploy after a successful build.
Using wildcards:​
.deployignore​
Use a .deployignore
file to exclude specific files or folders from deployment.
cache (Optional)​
Defines which files or folders to cache for subsequent builds.
envVariables (Optional)​
Sets environment variables for the build environment.
Runtime Configuration​
base (Optional)​
Sets the base technology for the runtime environment. If not specified, the current version is maintained.
os (Optional)​
Sets the operating system for the runtime environment. Options and versions are the same as for the build environment.
ports (Optional)​
Specifies the internal ports on which your application will listen.
prepareCommands (Optional)​
Customizes the runtime environment by installing additional dependencies or tools.
addToRunPrepare (Optional)​
Defines files or folders to be copied from the build container to the prepare runtime container.
initCommands (Optional)​
Defines commands to run each time a new runtime container starts or restarts.
start (Required for some runtimes)​
Defines the start command for your application.
startCommands (Optional)​
Defines start commands
Unlike start
, you can define multiple commands that starts their own processes.
run:
startCommands:
# start the application
- command: npm run start:prod
name: server
# start the replication
- command: litestream replicate -config=litestream.yml
name: replication
# restore the database on container init
initCommands:
- litestream restore -if-replica-exists -if-db-not-exists -config=litestream.yml $DB_NAME
documentRoot (Optional)​
Customizes the root folder for publicly accessible web server content (available only for webserver runtimes).
siteConfigPath (Optional)​
Sets the custom webserver configuration (available only for webserver runtimes).
envVariables (Optional)​
Defines environment variables for the runtime environment.
healthCheck (Optional)​
Defines a health check for your application.
Deploy Configuration​
readinessCheck (Optional)​
Defines a readiness check for your application. (See readiness checks)
For more detailed information on specific configurations, refer to the runtime-specific guides linked at the beginning of this document.