Skip to content

Production Use

Tom Martensen edited this page Jun 19, 2017 · 4 revisions

Deploying with Docker

Docker Compose

To deploy with the system with Docker, you need to have a directory with the docker-compose.yml file from the repository and a subdirectory named utils with the host.env and nginx.conf file.

You have to set the external URL (including the http(s) protocol) that you intend to reach the system under in the host.env file. If you intend to use another port than the default 8080 you have to change the port mapping in the docker-compose.yml to [your port]:80. If you want to use a specific version of either backend or frontend, the docker-compose.yml is the place to go.

If a new release of either frontend or backend was published, you have to pull the new image: docker pull tommartensen/arion-[backend|frontend]:[tag] and execute docker-compose up -d --no-deps --build [frontend|backend]. This will update the image and restart the service with the new image.

After configuring the files, simply run docker-compose up in the directory with the files. The containers will start running and are already linked. If you want to start in the detached mode, use the -d flag.

Deploying with Docker, but without Docker Compose

  • To start the backend container, run: docker run --name arion-backend -d -p [host-port]:8000 -e HOST=[frontend-url] tommartensen/arion-backend:[tag]
    For example: docker run --name arion-backend -d -p 8000:8000 -e HOST=localhost:5000 tommartensen/arion-backend:latest

  • To start the frontend container, run: docker run --name arion-frontend -d -p [host-port]:5000 -e HOST=[backend-url] tommartensen/arion-frontend:latest
    For example: docker run --name arion-frontend -d -p 5000:5000 -e HOST=http://localhost:8000 tommartensen/arion-frontend:latest

Database

A relational database server (e.g. MySQL, Postgres) is recommended for production though no further documentation than this is provided. To run a Postgres server and create a database for the project in a Docker environment, execute this command:

docker run --name arion-database -d -e POSTGRES_USER=root -e POSTGRES_PASSWORD=toor -p 5432:5432 -e POSTGRES_DB=arionbackend postgres:latest

This will give you a running Postgres server on [DOCKER IP]:5432 with user: root and password: toor. You might want to change that.

Then, in your local_settings.py add something like these lines or pipe these lines into the local_settings.py file in the docker-start.sh routine:

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': 'arionbackend',
        'USER': 'root',
        'PASSWORD': 'toor',
        'HOST': '[DOCKER IP]',
        'PORT': '5432',
    }
}
Clone this wiki locally