Skip to content

Instantly share code, notes, and snippets.

@spawnrider
Created April 20, 2022 10:32
Show Gist options
  • Save spawnrider/8cdb290d75f522dc26529b3c19570ddb to your computer and use it in GitHub Desktop.
Save spawnrider/8cdb290d75f522dc26529b3c19570ddb to your computer and use it in GitHub Desktop.
Docker Compose for Postgis, Redis and Directus 9 stack
version: '3.9'
services:
database:
container_name: database
image: postgis/postgis:13-master
volumes:
- ./data/database:/var/lib/postgresql/data
networks:
- directus
environment:
POSTGRES_USER: 'directus'
POSTGRES_PASSWORD: 'directus'
POSTGRES_DB: 'directus'
healthcheck:
test: ["CMD-SHELL", "pg_isready -U directus"]
interval: 10s
timeout: 5s
retries: 5
cache:
container_name: cache
image: redis:6
networks:
- directus
healthcheck:
test: [ "CMD", "redis-cli", "--raw", "incr", "ping" ]
directus:
container_name: directus
image: directus/directus:latest
restart: always
ports:
- 8055:8055
volumes:
# By default, uploads are stored in /directus/uploads
# Always make sure your volumes matches the storage root when using
# local driver
- ./uploads:/directus/uploads
# Make sure to also mount the volume when using SQLite
# - ./database:/directus/database
# If you want to load extensions from the host
# - ./extensions:/directus/extensions
networks:
- directus
depends_on:
cache:
condition: service_healthy
database:
condition: service_healthy
environment:
KEY: '255d861b-5ea1-5996-9aa3-922530ec40b1'
SECRET: '6116487b-cda1-52c2-b5b5-c8022c45e263'
DB_CLIENT: 'pg'
DB_HOST: 'database'
DB_PORT: '5432'
DB_DATABASE: 'directus'
DB_USER: 'directus'
DB_PASSWORD: 'directus'
CACHE_ENABLED: 'true'
CACHE_STORE: 'redis'
CACHE_REDIS: 'redis://cache:6379'
ADMIN_EMAIL: '[email protected]'
ADMIN_PASSWORD: 'd1r3ctu5'
# Make sure to set this in production
# (see https://docs.directus.io/reference/environment-variables/#general)
# PUBLIC_URL: 'https://directus.example.com'
networks:
directus:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment