Skip to content

Instantly share code, notes, and snippets.

@khuppenbauer
Created March 15, 2025 17:02
Show Gist options
  • Select an option

  • Save khuppenbauer/3002c75b54782538fb20183667adead4 to your computer and use it in GitHub Desktop.

Select an option

Save khuppenbauer/3002c75b54782538fb20183667adead4 to your computer and use it in GitHub Desktop.
caprover directus template
captainVersion: 4
services:
# Postgres
$$cap_appname-postgres:
image: $$cap_postgis_tag
volumes:
- $$cap_appname-data:/var/lib/postgresql/data
environment:
POSTGRES_DB: $$cap_postgres_database_name
POSTGRES_USER: $$cap_postgres_user
POSTGRES_PASSWORD: $$cap_postgres_passwd
DB_POOL__MIN: 0
DB_POOL__IDLE_TIMEOUT_MILLIS: 3000
caproverExtra:
notExposeAsWebApp: 'true'
# Cache
$$cap_appname-redis:
image: redis:7
volumes:
- $$cap_appname-redis:/data
caproverExtra:
notExposeAsWebApp: 'true'
# Directus
$$cap_appname:
depends_on:
- $$cap_appname-postgres
- $$cap_appname-redis
image: directus/directus:$$cap_directus_tag
volumes:
- $$cap_appname-uploads:/directus/uploads
- $$cap_appname-extensions:/directus/extensions
restart: always
environment:
KEY: $$cap_directus_auth_public_key
SECRET: $$cap_directus_auth_secret_key
DB_CLIENT: 'pg'
DB_HOST: srv-captain--$$cap_appname-postgres
DB_PORT: '5432'
DB_DATABASE: $$cap_postgres_database_name
DB_USER: $$cap_postgres_user
DB_PASSWORD: $$cap_postgres_passwd
CACHE_ENABLED: 'true'
CACHE_STORE: 'redis'
REDIS_HOST: srv-captain--$$cap_appname-redis
REDIS_PORT: '6379'
ADMIN_EMAIL: $$cap_admin_email
ADMIN_PASSWORD: $$cap_admin_password
WEBSOCKETS_ENABLED: "true"
caproverExtra:
containerHttpPort: '8055'
caproverOneClickApp:
variables:
- description: Tag of Directus image on https://hub.docker.com/r/directus/directus/tags
defaultValue: latest
id: $$cap_directus_tag
label: Directus image tag
validRegex: /.{1,}/
- description: Tag of PostGIS image on https://registry.hub.docker.com/r/postgis/postgis/tags
defaultValue: postgis/postgis:latest
id: $$cap_postgis_tag
label: PostGIS image tag
validRegex: /.{1,}/
- description: Name of the Directus database instance.
defaultValue: directus
id: $$cap_postgres_database_name
label: Postgres database name
validRegex: /.{1,}/
- description: User for the Directus database instance.
defaultValue: directus
id: $$cap_postgres_user
label: Postgres user
validRegex: /.{1,}/
- description: User password for the Directus database instance.
defaultValue: $$cap_gen_random_hex(16)
id: $$cap_postgres_passwd
label: Postgres user password
validRegex: /^(?=.*\d).{10,}$/
- description: Directus Auth Secret Key (must not be the same as Directus Auth Public Key)
defaultValue: $$cap_gen_random_hex(16)
id: $$cap_directus_auth_secret_key
label: Directus Auth Secret Key
validRegex: /^(?=.*\d).{10,}$/
- description: Directus Auth Public Key (must not be the same as Directus Auth Secret Key)
defaultValue: $$cap_gen_random_hex(16)
id: $$cap_directus_auth_public_key
label: Directus Auth Public Key
validRegex: /^(?=.*\d).{10,}$/
- description: Directus admin user email
defaultValue: admin@example.com
id: $$cap_admin_email
label: Directus admin user email
validRegex: /.{1,}/
- description: Directus admin user password
defaultValue: $$cap_gen_random_hex(8)
id: $$cap_admin_password
label: Directus admin user password
validRegex: /^(?=.*\d).{8,}$/
instructions:
end: >
Aaaand you're done! 😄
Your service is available at http://$$cap_appname.$$cap_root_domain
start: >-
Directus is an open-source suite of software that wraps custom SQL databases with a dynamic API and intuitive Admin App.
For more information and available options, see https://github.com/directus/docker or the official documentation at https://docs.directus.io
displayName: 'Directus'
isOfficial: true
description: Directus is an open-source tool for managing content across all your omni-channel digital experiences
documentation: Taken from https://docs.directus.io/guides/installation/docker/.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment