Install

Docker Compose

The recommended way to install AirTrail.

Docker Compose runs AirTrail and its PostgreSQL database from two files. You need Docker with Compose v2; see the requirements.

Download the files

Create a directory for AirTrail and download the Compose file and the example environment file into it:

mkdir airtrail
cd airtrail
wget -O docker-compose.yml https://raw.githubusercontent.com/JohanOhly/AirTrail/main/docker/production/compose.yml
wget -O .env https://raw.githubusercontent.com/JohanOhly/AirTrail/main/.env.example

If you download compose.yml and .env.example by hand, save them as docker-compose.yml and .env.

Edit .env

  • Set ORIGIN to the exact URL you will open AirTrail at, for example https://airtrail.example.com or http://192.168.1.20:3000. Sign-in fails if the browser's address does not match it.
  • Change DB_PASSWORD to a random value using only the characters A-Za-z0-9, and put the same value in DB_URL in place of password. The two must always match.
  • If AirTrail will run behind a reverse proxy, also set ADDRESS_HEADER=X-Forwarded-For. See Reverse proxy.

Every other setting is optional. See Environment variables for the full list.

Leave optional variables commented out rather than empty. Postgres keeps its password after the first start, so changing DB_PASSWORD later also requires changing it inside the database.

Start AirTrail

From the directory with both files, run:

docker compose up -d

The first start downloads airport and airline data, which takes a minute. Follow the progress with docker compose logs -f airtrail.

unknown shorthand flag: 'd' in -d

You are running an old Docker, such as the docker.io package on some Ubuntu releases. Remove it and install Docker from Docker's official repository. The command is docker compose, not docker-compose.

Finish setup

Open the URL from ORIGIN and follow the post-installation steps.

What the Compose file sets up

ServiceContainerPurpose
airtrailairtrailThe web app, published on port 3000
dbairtrail_dbPostgreSQL 16, reachable only from the airtrail container

Two named volumes hold your data: db_data (the database) and uploads (airline icons you upload). Both are included in backups.

Database migrations run automatically every time the airtrail container starts.

Uploads and file permissions

The app runs as user and group 1000:1000. Each time the container starts, it gives the uploads directory (UPLOAD_LOCATION, /app/uploads by default) to that user and then drops its root privileges, so the named volume in the Compose file needs no setup.

If you prefer a folder on the host, replace the volume with a bind mount:

    volumes:
      - ./data/uploads:/app/uploads

To have the files owned by your own host user instead, set PUID and PGID in .env to that user's IDs, which id -u and id -g print:

.env
PUID=1026
PGID=100

If you run the container as a fixed user with user: in the Compose file, it skips this step and runs as that user, so the uploads directory must already be writable by it.

Exposing the port

The Compose file publishes port 3000 on every interface. When a reverse proxy on the same host is the only thing that should reach AirTrail, bind it to localhost instead:

    ports:
      - 127.0.0.1:3000:3000

Next steps

Last updated on

On this page