Search…
Prepare to Use Release

Prepare to use Release

In order to use Release, you must meet the prerequisites mentioned in the Welcome to Release overview.
Release supports building and running complex applications. Release requires a docker-compose.yml , package.json , or a .release.yaml file to be in the root of your application's git repository. Release uses these files to to generate the Application Template that is used as a blueprint to build your environments.
If your application has nested directories where your docker-compose.yaml or package.json files reside, you can add a .release.yaml file to the root of your repository to tell Release where these files are located. See the .release.yaml Reference Guide for more information.
We recommend using a monorepo and a directory-per-service at the project root when your application requires two or more services. Here is an example repository / filesystem layout for three service which require docker builds:
1
├── README.md
2
├── docker-compose.yml
3
├── result
4
│ └── Dockerfile
5
├── vote
6
│ └── Dockerfile
7
└── worker
8
└── Dockerfile
Copied!
If you're not using a monorepo, you can create an application for each repository and connect them together using environment variables in each of those applications. See Microservices architectures for more information.

Testing docker-compose for Release

The best way to test if your application will run in Release is to start by getting docker-compose to run your application locally. (See docker-compose overview for more details).
Release allows you to quickly spin up containerized services without the traditional wait times involved with cloud native services.
When running an application locally or in a Release Ephemeral Environment, it is recommended that you isolate your application's external dependencies. Consider using off-the-shelf Docker images to represent the cloud native services that your application depends on. (i.e. postgres, redis, etc...), Visit Docker Hub to find many off-the-shelf Docker images.
You can use environment variables to connect Ephemeral Environments to AWS native services such as RDS, however, we recommend using these off-the-shelf Docker images. These will speed up deployment and simplify setup.
This is an example of a docker-compose.yml file that builds three (3) Docker images and leverages two (2) off-the-shelf containers for redis and postgres:
1
version: "3"
2
services:
3
vote:
4
build: ./vote
5
command: python app.py
6
volumes:
7
- ./vote:/app
8
ports:
9
- "5000:80"
10
depends_on:
11
- "worker"
12
13
result:
14
build: ./result
15
command: nodemon server.js
16
volumes:
17
- ./result:/app
18
ports:
19
- "5001:80"
20
depends_on:
21
- "worker"
22
23
worker:
24
build:
25
context: ./worker
26
depends_on:
27
- "redis"
28
- "db"
29
30
redis:
31
image: redis:alpine
32
container_name: redis
33
34
db:
35
image: postgres:9.4
36
container_name: db
37
volumes:
38
- "db-data:/var/lib/postgresql/data"
39
40
volumes:
41
db-data:
Copied!
Release detects many popular services such as redis, mysql, postgres, rabbitmq, plus many more and will handle opening standard ports for these services.
1
version: "3"
2
services:
3
redis:
4
image: "redis:5-alpine"
5
6
rabbitmq:
7
image: "rabbitmq:3.7-alpine"
8
9
memcached:
10
image: "memcached:1.5-alpine"
Copied!
Adding redis, rabbitmq and memcached with minimal configuration in docker-compose

Building your application

Release supports most options from docker-compose build. Release looks for all services with a build stanza and executes a docker build for each service found.
1
version: "3"
2
services:
3
app:
4
build: .
Copied!
Specify the current working directory
1
version: "3"
2
services:
3
vote:
4
build: ./vote
Copied!
Specify a different directory to build
1
version: "3"
2
services:
3
mysql:
4
build:
5
context: .
6
dockerfile: Dockerfile-mysql
7
args:
8
S3_BUCKET: "data.example.com"
9
MYSQL_VERSION: "5.7"
Copied!
Specify the dockerfile and pass in build arguments__

Release Ports and DNS Hostnames

Release uses the docker-compose ports (HOST:CONTAINER) definition to determine when a service should be exposed to the Internet. When Release encounters a service with a (HOST:CONTAINER) definition, it creates a node port, load balancer rule and DNS hostname entry for the service.
1
version: "3"
2
services:
3
frontend:
4
build:
5
context: .
6
dockerfile: Dockerfile-frontend
7
ports:
8
- "8080:8080"
9
command: ["npm", "run", "dev-server-docker"]
Copied!
In this example Release will create a hostname for the frontend service that exposes port 8080.
Internal services like your datastores, caches and background workers should not be exposed to the Internet and available only internally to other services defined in your docker-compose.
1
version: "3"
2
services:
3
db:
4
image: postgres:9.4
5
ports:
6
- "5432"
Copied!
This example shows postgres opening a container port on 5432 that another service can consume.

Environment Variables

Most applications use environment variables to define how services talk to each other and/or change the behavior of an application in a given environment. Release uses the environment variables provided in your docker-compose as a starting point. All of the environment variables for each service defined in your docker-compose are loaded into Release when you initially create an application. Release supports all of the standard docker-compose mechanisms for defining environment variables:
1
version: "3"
2
services:
3
api:
4
build:
5
context: ./api
6
dockerfile: Dockerfile.django
7
ports:
8
- "8000:8000"
9
env_file: .env
Copied!
You can use env_file to specify an external env file.
1
version: "3"
2
services:
3
nginx:
4
build: .
5
ports:
6
- "5000:5000"
7
environment:
8
- AWS_REGION=us-west-2
9
- AWS_SECRET_ACCESS_KEY=XXX
10
- RESOLVER=8.8.8.8
Copied!
Set environment variables directly in your docker-compose file
If you have dynamic or secret environment variables, read more here.
Last modified 5mo ago