Dockerized Trellis

Aaron Coburn edited this page Nov 27, 2018 · 10 revisions

Docker containers for Trellis are published on Docker Hub. Beginning with the 0.8.0-SNAPSHOT version, containers for the Triplestore and RDBMS Trellis servers are published with every commit to master. Docker containers will also be available for stable releases starting with Trellis 0.8.

Docker Compose and Swarm Mode

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-ext-db:latest
    environment:
      TRELLIS_DB_USERNAME: changeme
      TRELLIS_DB_PASSWORD: changeme
      TRELLIS_DB_URL: jdbc:postgresql://db/db-name
    ports:
      - 80:8080
    depends_on:
      - db
    volumes:
      - /local/trellis/data:/opt/trellis/data
      - /local/trellis/log:/opt/trellis/log
      - /local/trellis/etc:/opt/trellis/etc
  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), application logs and configuration files.

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.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.