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.
metadata:
type: hash
required: false
description: Key-value pairs; currently used to keep links with Bunnyshell entities.
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.
security:
type: hash
required: false
description: Settings related to the security of the environment.
version:
type: string
required: false
description: Bunnyshell parser version used for the current Environment definition. Default is "v1".
Complete bunnyshell.yaml
example
bunnyshell.yaml
exampleversion: v1
kind: Environment
metadata:
com.bunnyshell.k8s.id: 123
com.bunnyshell.k8s.unique: {alphanumeric}
com.bunnyshell.k8s.docker-compose-version: 3.4
arbitrary: value
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
version: v1
metadata:
com.bunnyshell.k8s.id: 123 # Bunnyshell ID, optional
com.bunnyshell.k8s.display-name: Web Server
com.bunnyshell.k8s.source-file: git.repo.com/.docker/docker-compose.yaml
com.bunnyshell.k8s.source-file-hash: {alphanumeric}
com.bunnyshell.k8s.source-block-hash: {alphanumeric}
com.bunnyshell.k8s.source-name: nginx
name: nginx
gitRepo: [email protected]
gitBranch: master
gitApplicationPath: / # optional; for monorepo apps
gitDockerComposePath: / # the path of the docker-compose.yaml inside the git_repo
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 # will be suffixed with -${env_unique}.bunnyenv.com
path: / # optional
servicePort: 8080
public: true # will be publicly available, even if the user IP does not exist in security.allowedIps
- kind: Database
metadata:
com.bunnyshell.k8s.id: 456 # Bunnyshell ID, optional
com.bunnyshell.k8s.display-name: Database
com.bunnyshell.k8s.source-file: git.repo.com/.docker/docker-compose.yaml
com.bunnyshell.k8s.source-file-hash: {alphanumeric}
com.bunnyshell.k8s.source-block-hash: {alphanumeric}
com.bunnyshell.k8s.source-name: mysql
name: mysql
gitRepo: [email protected]
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
k8s:
resources: # k8s resources for this service; k8s syntax
requests:
cpu: "0.5"
memory: "100Mi"
limits:
cpu: "900m"
memory: "0.5Gi"
podSharing:
hosts:
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'
- kind: SidecarContainer
version: v1
metadata:
com.bunnyshell.k8s.display-name: PHP App
com.bunnyshell.k8s.source-file: git.repo.com/.docker/docker-compose.yaml
com.bunnyshell.k8s.source-file-hash: {alphanumeric}
com.bunnyshell.k8s.source-block-hash: {alphanumeric}
com.bunnyshell.k8s.source-name: php
name: php
gitRepo: [email protected]
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
k8s:
resources: # k8s resources for this service; k8s syntax
requests:
cpu: "0.5"
memory: "100Mi"
limits:
cpu: "900m"
memory: "0.5Gi"
hosts: # you can add more
- hostname: app # will be suffixed with -${env_unique}.bunnyenv.com
path: / # optional
servicePort: 8080
- kind: InitContainer
version: v1
name: frontend
gitRepo: [email protected]
gitBranch: master
gitApplicationPath: / # optional; for monorepo apps
dockerCompose:
build:
context: frontend
Updated 23 days ago