-
Notifications
You must be signed in to change notification settings - Fork 21
Dockerized Trellis
Docker containers for Trellis are published on Docker Hub. Stable containers are published with each release while development versions are published with each commit to main
.
Docker provides the docker-compose command for quickly starting a number of related services on a single Docker host. These services are defined in a YAML Compose configuration file. Docker can also deploy such a Compose service stack to a cluster that is running in "swarm mode". Swarm mode distributes your application on a swarm-enabled Docker cluster and handles concerns like overlay networking between services and setting up an ingress network to direct public traffic to front-end services.
Here is a compose stack that configures the Trellis service with PostgreSQL database storage:
version: "3"
services:
trellis:
image: trellisldp/trellis-postgresql:latest
environment:
MP_JWT_VERIFY_PUBLICKEY_LOCATION: "https://idp.example.com/jwks"
QUARKUS_DATASOURCE_USERNAME: changeme
QUARKUS_DATASOURCE_PASSWORD: changeme
QUARKUS_DATASOURCE_JDBC_URL: jdbc:postgresql://db/db-name
TRELLIS_FILE_BINARY_PATH: /opt/trellis/data/binary
TRELLIS_FILE_MEMENTO_PATH: /opt/trellis/data/memento
ports:
- 80:8080
depends_on:
- db
volumes:
- /local/trellis/data:/opt/trellis/data
db:
image: postgres
environment:
POSTGRES_DB: db-name
POSTGRES_PASSWORD: changeme
POSTGRES_USER: changeme
PGDATA: /var/lib/postgresql/data/pgdata/mydata
volumes:
- /local/postgresql/data/folder:/var/lib/postgresql/data/pgdata/mydata
The first half of the YAML document is a minimal configuration for the Trellis LDP service, exposing that service on the Docker host's port 80. The "db" service specifies a PostgreSQL Docker image, which is pulled from Docker Hub and run with the listed environment variables pass into it. These reflect the defaults configured in the Trellis Docker image. It also specifies a data directory for database persistence and maps that path to a folder on the Docker host. The trellis data volumes contain file-based resources (e.g. binaries and mementos).
To launch this Trellis stack on a single machine, save it as "docker-compose.yml". Then run docker-compose up
in the same directory. (Installation of the Docker engine and Docker Compose are required.)
To launch this Trellis stack on a swarm, save it as "docker-compose.yml". Then run docker stack deploy --compose-file docker-compose.yml trellis
. You must do this from the management node within a Docker Swarm enabled cluster. In addition, if you map local folders to PostgreSQL storage, then you must ensure that the folder exists and that the PostgreSQL node is consistently deployed to the same host. This is currently beyond the scope of this guide. Please see Docker documentation regarding placement constraints.