coolify/templates/compose/directus-with-postgresql.yaml
Toby Brancher 097ca209bc
Support map fields in Directus
To support the map fields in Directus with Postgres you need the Postgis extension installed, with docker we can just change the image to use the equivalent alpine postgis image, source latest stable alpine from here (perhaps there is a better ref to use than one with a specific version number?): https://registry.hub.docker.com/r/postgis/postgis/

If you are already running Directus without postgis, and would like to make use of the mapping fields after updating the docker compose file you will need to go to `execute command`, select the postgres container and run the following command filling in the appropriate env vars;

`psql -U ${SERVICE_USER_POSTGRESQL} -d ${POSTGRESQL_DATABASE} -c "CREATE EXTENSION postgis;"`
2024-07-21 23:39:22 +01:00

61 lines
1.8 KiB
YAML

# documentation: https://directus.io
# slogan: Directus wraps databases with a dynamic API, and provides an intuitive app for managing its content.
# tags: directus, cms, database, sql
# logo: svgs/directus.svg
# port: 8055
services:
directus:
image: directus/directus:10
volumes:
- directus-uploads:/directus/uploads
- directus-extensions:/directus/extensions
environment:
- SERVICE_FQDN_DIRECTUS_8055
- KEY=$SERVICE_BASE64_64_KEY
- SECRET=$SERVICE_BASE64_64_SECRET
- ADMIN_EMAIL=${ADMIN_EMAIL:-admin@example.com}
- ADMIN_PASSWORD=$SERVICE_PASSWORD_ADMIN
- DB_CLIENT=postgres
- DB_HOST=postgresql
- DB_PORT=5432
- DB_DATABASE=${POSTGRESQL_DATABASE:-directus}
- DB_USER=$SERVICE_USER_POSTGRESQL
- DB_PASSWORD=$SERVICE_PASSWORD_POSTGRESQL
- REDIS_HOST=redis
- REDIS_PORT=6379
- WEBSOCKETS_ENABLED=true
healthcheck:
test: ["CMD", "wget", "-q", "--spider", "http://127.0.0.1:8055/admin/login"]
interval: 5s
timeout: 20s
retries: 10
depends_on:
postgresql:
condition: service_healthy
redis:
condition: service_healthy
postgresql:
image: postgis/postgis:16-3.4-alpine
volumes:
- directus-postgresql-data:/var/lib/postgresql/data
environment:
- POSTGRES_USER=${SERVICE_USER_POSTGRESQL}
- POSTGRES_PASSWORD=${SERVICE_PASSWORD_POSTGRESQL}
- POSTGRES_DB=${POSTGRESQL_DATABASE:-directus}
healthcheck:
test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"]
interval: 5s
timeout: 20s
retries: 10
redis:
image: redis:7-alpine
command: redis-server --appendonly yes
volumes:
- directus-redis-data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 20s
retries: 10