Skip to content
PortoPorto

Docker and Docker Compose

Requirements: a Linux server with Docker and Docker Compose and, for online booking, a domain pointing to it.

The compose.yaml file at the repository root builds the image from source and starts an instance in development mode with Mailpit to read outgoing mail. Do not use it in production.

Finestra del terminale
git clone https://github.com/coste360/porto.git && cd porto
PORTO_BOOTSTRAP_OWNER_EMAIL=owner@porto.test PORTO_BOOTSTRAP_OWNER_NAME="Mario Rossi" \
PORTO_BOOTSTRAP_OWNER_ORG="Test Marina Ltd" PORTO_ADMIN_PASSWORD=test-password-123 \
docker compose up --build # or: make up

Open http://localhost:8080/admin/ and sign in with those credentials (password of at least 12 characters); mail is at http://localhost:8025. To load the demo marina: docker compose exec porto /porto seed demo (Demo data).

The production files are in deploy/: docker-compose.yml (SQLite in the porto-data volume) and docker-compose.postgres.yml (PostgreSQL 17). The container runs as a non-root user with a read-only file system and no capabilities.

  1. Configuration. Start from .env.example and create deploy/.env:

    Finestra del terminale
    git clone https://github.com/coste360/porto.git && cd porto
    cat > deploy/.env <<END
    PORTO_BASE_URL=https://porto.my-marina.example
    PORTO_SECRET_KEY=$(openssl rand -base64 32)
    PORTO_SMTP_URL=
    PORTO_BOOTSTRAP_OWNER_EMAIL=owner@my-marina.example
    PORTO_BOOTSTRAP_OWNER_NAME=Mario Rossi
    PORTO_BOOTSTRAP_OWNER_ORG=Example Marina Ltd
    PORTO_ADMIN_PASSWORD=choose-a-long-password
    END

    The variables are described in Configuration.

  2. Image. Once the image is published the compose file pulls it (PORTO_VERSION, default latest). Until then, build it on the server and set the tag:

    Finestra del terminale
    docker build -f deploy/Dockerfile -t ghcr.io/coste360/porto:dev . # or: make docker
    echo "PORTO_VERSION=dev" >> deploy/.env
  3. Start.

    Finestra del terminale
    docker compose -f deploy/docker-compose.yml up -d
  4. First sign-in at https://porto.my-marina.example/admin/: see First start.

Add POSTGRES_PASSWORD to deploy/.env and use the other file:

Finestra del terminale
echo "POSTGRES_PASSWORD=$(openssl rand -hex 24)" >> deploy/.env
docker compose -f deploy/docker-compose.postgres.yml up -d

The compose file puts the password into DATABASE_URL without encoding it: use URL-safe characters only, like those of openssl rand -hex. See Database.

The image is distroless and has no shell, but exec runs the binary directly:

Finestra del terminale
docker compose -f deploy/docker-compose.yml exec porto /porto version
docker compose -f deploy/docker-compose.yml exec porto /porto migrate status
docker compose -f deploy/docker-compose.yml exec porto /porto backup --out /data/backup.porto-backup

Put Porto behind a reverse proxy or let it obtain Let’s Encrypt certificates itself: see HTTPS and reverse proxy. Health checks are done from outside with GET /healthz and GET /readyz (Monitoring and logs).

byCoste360.itCoste360.it

Porto is developed by Coste360 SRL. Source available under the BSL 1.1; the Porto trademark is not covered by the licence.