Project Import YAML Configuration
This section provides a comprehensive example of an import YAML configuration file, allowing you to define and import a project and its services.
This is a general guideline; not all keys are valid for every service type. For technology-specific details, refer to the Create service page in the How To section of the Zerops documentation.
REQUIRED.
If a parent object is defined, the key-value pair is required to be filled. All other key-value pairs are optional.
# ==== Define a project to import ====
project:
# REQUIRED. Name of your project
name: project0
# Project description
description: "This project is an example only"
# List of project tags for filtering
tags:
- test
- dev
# ==== Define a list of services to import into the project ====
services:
# REQUIRED. Name of your service
- hostname: service1
# REQUIRED. Choose from list of supported technologies and their versions
type: nodejs@latest
# HA or NON_HA mode
mode: HA
# Map of secret environment variables
envSecrets:
DATABASE_HOST: ${db_hostname}
DATABASE_NAME: ${db_hostname}
# Object storage size in GB
objectStorageSize: 2
# Choose object storage policy from a predefined list
objectStoragePolicy: public-read-write
# Define additional policy
objectStorageRawPolicy:
# One time build git repository
buildFromGit: https://github.com/zeropsio/recipe-nodejs-hello-world@main
# true or false
enableSubdomainAccess: true
# The higher the sooner the service is created
priority: 1
# Vertical autoscaling configuration object
verticalAutoscaling:
minVCpu: 1
maxVCpu: 5
# Choose SHARED or DEDICATED
cpuMode: DEDICATED
minRam: 1
maxRam: 32
minDisk: 1
maxDisk: 100
startCpuCoreCount:
minFreeCpuCores:
minFreeCpuPercent:
minFreeRamGB:
minFreeRamPercent:
# Minimum number of containers
minContainers: 2
# Maximum number of containers
maxContainers: 3
# List of shared storage services to connect to
mount:
- teststorage1
# Full nginx config
nginxConfig: |-
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
root /var/www;
location / {
try_files $uri $uri/ /index.html;
}
access_log syslog:server=unix:/dev/log,facility=local1 default_short;
error_log syslog:server=unix:/dev/log,facility=local1;
}
# Zerops.yml service name or full config file
zeropsSetup:
build:
base: nodejs@latest
buildCommands:
- echo zerops.yml from import
- yarn
- yarn run build
deployFiles: ./
cache: node_modules
run:
initCommands:
- |
if ! zcli bucket s3 create $STORAGE_HOSTNAME $STORAGE_BUCKET_NAME --x-amz-acl=private; then
echo "The bucket was not created, you have to do it manually!"
fi
start: yarn start
# REQUIRED. Name of your other service
- hostname: teststorage1
type: shared-storage
...
project​
REQUIRED, if a whole project is imported
Only one project can be defined.
name​
string, REQUIRED
The name of the new project. Duplicates are allowed.
description​
string
Description of the new project.
tags​
list of strings
One or more string tags. Tags do not have a functional meaning, they only provide better orientation in projects.
services​
REQUIRED section
At least one service is required.
hostname​
string, REQUIRED
The unique service identifier. Limitations:
- duplicates in the same project forbidden
- maximum 25 characters, lowercase ASCII letters (a-z) or numbers (0-9) only
type​
choose a value, REQUIRED
Specifies the service type and version.
mode​
choose a value
- HA / NON_HA (default NON_HA)
Defines the operation mode of the service.
envSecrets​
list of key-value pairs
Environment variables that are blurred by default in Zerops GUI. Can be edited or deleted in Zerops GUI.
objectStorageSize​
int
Object storage size in GB.
objectStoragePolicy​
choose a value
- private / public-read / public-objects-read / public-write / public-read-write / custom
Select a predefined AWS S3 bucket access policy.
objectStorageRawPolicy​
json
Define your own AWS S3 bucket access policy. See AWS docs for details.
Use {{ .BucketName }}
placeholder if you need to use bucket name in your custom policy rules.
buildFromGit​
url string
A URL of a Github or Gitlab repository used for a one-time build of your service.
enableSubdomainAccess​
boolean (default false)
Set true
, if you want to enable a public access to your service via a Zerops subdomain. Not suitable for production.
priority​
int
Services are sorted before creation by priority in descending order, i.e. the higher the priority the sooner the service is created.
verticalAutoscaling​
nested object
minVCpu​
maxVCpu​
cpuMode​
choose a value
- SHARED / DEDICATED
minRam​
float
Minimum RAM in GB that each container of the service can scale down to.
maxRam​
float
Minimum RAM in GB that each container of the service can scale up to.
minDisk​
float
Minimum disk space in GB that each container of the service can scale down to.
maxDisk​
float
Minimum disk space in GB that each container of the service can scale up to.
startCpuCoreCount​
int
Number of CPU cores with which each container starts.
minFreeCpuCores​
float
Minimum number of unused CPU cores before a container starts scaling.
minFreeCpuPercent​
float
Minimum percentage of unused CPU cores before a container starts scaling.
minFreeRamGB​
float
Minimum unused memory in GB before a container starts scaling.
minFreeRamPercent​
float
Minimum percentage of unused memory before a container starts scaling.
minContainers​
int (default 1, maximum value 6)
Minimum number of containers of the service.
maxContainers​
int (maximum value 6)
Maximum number of containers of the service.
mount​
list of shared storage service hostnames
Mount shared storage to the service. buildFromGit
must be filled.
nginxConfig​
nginx config
Insert full nginx config.
zeropsSetup​
string / yaml format
Provide the name of the service from your zerops.yml (find it under -setup: {name}
) or insert full zerops.yml configuration file.