Configure the Pipeline
Start by adding azerops.yaml file to the root of your repository and modify it to fit your application.
Here is a basic example for a Node.js application:
api, Zerops will:
- Create a build environment with Node.js v.20 preinstalled
- Run build commands:
npm i,npm run build - Create a runtime environment with Node.js v.20 preinstalled
- Deploy the built artifact from the
./distfolder to runtime containers - Cache the
./node_modulesfolder for faster subsequent builds - Start your application using
npm start
zerops.yaml parameters in the zerops.yaml specification.
Trigger the Pipeline
Continuous Deployment
Set up automatic builds triggered by Git events. You can establish continuous deployment in two ways:- New Service: Create a new runtime service and connect it to your GitHub or GitLab repository during the service creation process.
- Existing Services: Go to the service detail and choose Pipelines & CI/CD settings from the left menu. Click Connect with a GitHub repository or Connect with a GitLab repository to link your repository.
On-Demand Deployment
Trigger builds and deployments manually when needed using either the CLI or GUI.Using Zerops CLI
- Build and deploy:
zcli service push- Uploads code and triggers the full pipeline - Deploy only:
zcli service deploy- Skips build, deploys pre-built artifacts
Using Zerops GUI
In Pipelines & CI/CD settings section of your service detail:- Re-deploy last pipeline - With optional secret env variable updates
- Trigger new pipeline - From git repo or with custom configuration
Using Import YAML
AddbuildFromGit: <repo-url> to your service configuration for one-time build during import. See import documentation.
Build Phase
Zerops starts a temporary build container and executes these steps:
Zerops automatically deletes the build container after the build finishes or fails.
Build Hardware Resources
All runtime services use the same hardware resources for build containers:| HW Resource | Minimum | Maximum |
|---|---|---|
| CPU cores | 1 | 5 |
| RAM | 8 GB | 8 GB |
| Disk | 1 GB | 100 GB |
Build container resources are not charged. Build costs are covered by the standard Zerops project fee.
Build Time Limit
The entire build pipeline has a 1 hour time limit. After 1 hour, Zerops terminates the build pipeline and deletes the build container.Customize the Build Environment
All runtime services start with a default build environment based on thebuild.base attribute in zerops.yaml. Install additional packages or tools by adding build.prepareCommands to your configuration.
Runtime Prepare Phase (Optional)
When your application requires additional system packages, libraries, or tools in the runtime environment, Zerops allows you to build a custom runtime image. This optional phase occurs after the build phase and before deployment.When to Use Custom Runtime Images
Build custom runtime images when you need:- System packages or libraries for runtime operations (e.g.,
sudo apk add imagemagickfor image processing) - Library dependencies for interpreted languages or dynamically linked binaries
- System-level tools or utilities your application requires
- Customized base operating system or additional software layers
Configuration
Configure custom runtime images in yourzerops.yml file using these fields:
run.os + run.base
Specify the operating system and base packages for your custom runtime image:
run.prepareCommands
Define commands that customize your runtime image:
build.addToRunPrepare
Copy specific files from the build phase to the runtime prepare phase:
Custom Runtime Image Caching
Zerops caches custom runtime images to optimize deployment times. The runtime prepare phase is skipped and cached images are reused when:- It is not the first deployment of your service
- None of these
zerops.yamlfields changed since the last deployment:run.osorrun.baserun.prepareCommandsbuild.addToRunPrepare
- File contents specified in
build.addToRunPrepareremain unchanged - The custom runtime image cache hasn’t been manually invalidated
Deploy Phase
Application Artifacts
After the build phase completes, Zerops stores the application artifact in internal storage and deletes the build container. Zerops uses the stored artifact to deploy identical versions of your application whenever a new container starts:- During new application version deployments
- When applications scale horizontally
- When runtime containers fail and new containers start automatically
First Deploy
For initial deployments, Zerops starts one or more runtime containers based on your service auto scaling settings. Zerops executes these steps for each new container:
Services with multiple containers deploy in parallel.
Subsequent Deploys
For applications with existing running versions, Zerops starts new containers matching the count of existing containers. Zerops executes the same steps as the first deployment for each new container. Your service briefly contains both new and old versions during this process. Old containers are then removed from the project balancer to stop receiving new requests. The processes inside old containers terminate and Zerops gradually deletes all old containers.Readiness Checks
If your application is not ready to handle requests immediately after starting, configure a readiness check in yourzerops.yaml.
When readiness checks are defined, Zerops:
- Starts your application
- Performs readiness check
- Waits and retries - If check fails, waits 5 seconds and repeats step 2
- Activates container - If check succeeds, marks container as active
httpGet- Succeeds when URL returns HTTP2xxstatus (5-second timeout, follows3xxredirects)exec.command- Succeeds when command returns status code 0 (5-second timeout)
Manual Deploy Using Zerops CLI
Start deploy-only pipelines using the Zerops CLI. Thezcli service deploy command uploads and deploys your application in Zerops. Use this when you have your own build process.
Manage Builds and Deployments
Cancel Running Build
When you need to cancel an incorrect running build, use the Zerops GUI. Go to the service detail, open the running processes list, and click Open pipeline detail. Then click Cancel build.Build cancellation is only available before the build pipeline finishes. Once the build completes, deployment cannot be cancelled.