Environment definition file (bunnyshell.yaml)
What is bunnyshell.yaml
bunnyshell.yaml
In order to describe how an Environment looks like, Bunnyshell uses a single editable record, which contains its entire definition. It is called bunnyshell.yaml
.
Currently, bunnyshell.yaml
is stored solely in Bunnyshell.
Schema
All possible top-level properties are listed below, and briefly explained. Each non-trivial property has its own dedicated sub-section in the documentation, further explaining its purpose.
kind:
type: string
required: true
description: Type of entity being described, "Environment".
name:
type: string
required: true
description: Name of the Environment.
type:
type: string
required: true
description: Specifies whether an Environment is permanent or ephemeral.
deployment:
type: hash
required: false
description: Configures the deployment strategy.
environmentVariables:
type: hash
required: false
description: Environment-level variables. The bns_secret method can be used to mark a secret value (e.g. "- VAR_NAME:'bns_secret(secret value)'")
components:
type: array
required: true
description: Contains the definitions of the Applications / Services / Databases composing the Environment.
dev:
type: hash
required: false
description: Settings related to remote development
security:
type: hash
required: false
description: Settings related to the security of the environment.
volumes:
type: array
required: false
description: Contains the definitions of volumes used in Applications / Services / Databases components
Complete bunnyshell.yaml
example
bunnyshell.yaml
examplekind: Environment
name: my-env
type: primary | ephemeral
deployment:
strategy:
type: RollingUpdate
maxUnavailable: 2 # optional, the default value is 25%
maxSurge: 50% # optional, the default value is 25%
components:
- kind: Service
name: nginx
gitRepo: git@...
gitBranch: master
gitApplicationPath: / # optional; for monorepo apps
dockerCompose:
build:
context: .docker/nginx
dockerfile: Dockerfile
args:
buildno: 1
pod:
init_containers:
-
from: frontend
name: # the name of the container
shared_paths:
-
path: /var/www/public # path on this service container (e.g. frontend)
target:
container: '@parent'
path: /var/www/html/public # path on the pod-colocated service container (e.g. nginx)
initial_contents: '@self'
sidecar_containers:
-
from: php
name: # the name of the container
hosts: # you can add more
- hostname: 'app-{{ env.base_domain }}'
path: / # optional
servicePort: 8080
public: true # will be publicly available, even if the user IP does not exist in security.allowedIps
cronJobs:
- name: nginx-test
schedule: '* */1 * * *'
command:
- /bin/sh
- '-c'
- 'nginx -t'
- kind: Database
name: mysql
gitRepo: git@...
gitBranch: master
gitApplicationPath: / # optional; for monorepo apps
gitDockerComposePath: / # the path of the docker-compose.yaml inside the git_repo
dockerCompose:
build:
context: .docker/mysql
dockerfile: Dockerfile
args:
buildno: 1
volumes:
-
name: db-data
mount: /var/lib/mysql
subPath: ''
hosts: ~
- kind: SidecarContainer
version: v1
name: php
gitRepo: git@...
gitBranch: master
gitApplicationPath: / # optional; for monorepo apps
gitDockerComposePath: / # the path of the docker-compose.yaml inside the git_repo
dockerCompose:
# image: ... # if present, `image` will be removed, we will build the image and after that we will add the image: with the value from our Amazon ECR
build:
context: .docker/php
dockerfile: Dockerfile
args:
buildno: 1
dependsOn:
- mysql
- kind: InitContainer
version: v1
name: frontend
gitRepo: git@...
gitBranch: master
gitApplicationPath: / # optional; for monorepo apps
dockerCompose:
build:
context: frontend
volumes:
- name: db-data
size: 1Gi
type: disk
security:
access:
allowedIps: # only IPs in these ranges will be able to access the non-public hosts
- '192.168.0.1/24'
- '192.12.45.123/32'
dev:
nginx:
- containers:
nginx:
command: ['nginx']
syncPaths:
- remotePath: /var/www/
localPath: ~/project
portForwards:
- "8080<8080"
environment:
WHEN_IN_DEV: '{{ env.vars.OTHER_VAR }}'
resources:
limits:
memory: 750M
requests:
cpu: '0.15'
memory: 500M
Updated about 1 year ago