Deploy
docker-compose
Repositories created with create-aeria-app comes with a ready-to-use docker-compose.yml file, alongside with dockerfiles to build the api, the web, and to bring up a nginx reverse proxy to serve both. This is the bare minimal required to deploy a full Aeria app exposing a single port. You may change or augment this file as needed.
Below is the file just like in the Quickstart repository.
services:
mongo:
image: mongo
restart: always
volumes:
- /data/db:/data/db
logging:
options:
max-size: '10m'
max-file: '2'
api:
build:
dockerfile: Dockerfile.api
restart: always
env_file: api/production.env
depends_on:
- mongo
volumes:
- api-build:/opt/application/api-build
- /data/storage:/data/storage
healthcheck:
test: curl -s -w '%{http_code}' http://localhost:3000/api/describe
timeout: 5s
interval: 10s
web:
build:
dockerfile: Dockerfile.web
depends_on:
api:
condition: service_healthy
volumes:
- api-build:/opt/application/api
- web-build:/var/www/html
nginx:
build:
context: nginx
restart: always
depends_on:
- api
- web
ports:
- 80:80
volumes:
- web-build:/var/www/html
logging:
options:
max-size: '2G'
max-file: '4'
volumes:
api-build:
web-build:Installing dependencies
You will by default need docker and docker-compose installed in order to deploy. On Debian-based distros, you can install both dependencies with sudo apt install docker docker-compose. Follow this link to get guidance on how to install the Docker Engine on each Linux distro and operating system.
Deploying locally
To deploy directly on your host machine, the following commands will suffice. Browse to http://localhost:8080 after they are finished to see it has worked.
# docker-compose build
# docker-compose up -dDeploying remotely
To deploy on remote machines over SSH, Docker contexts are strongly recommended.
- Make sure you have public and private SSH keys set up.
- Create a Docker context if you hasn't already.
WARNING
If you aren't logged in as root on your host machine, don't escalate privileges before running docker context commands, otherwise your SSH keys won't read.
$ docker context create remote --docker host=ssh://root@remotehost- Switch over to the context you just created.
$ docker context use remote- Run the commands to build and bring up the container orchestration as you would do locally.
$ docker-compose build
$ docker-compose up -d