refactor(service): improve CodiMD

- fix CSS styles not loading on http
- make all ENVs configurable
- remove comments
- formatting and naming
This commit is contained in:
peaklabs-dev
2025-05-15 19:22:30 +02:00
parent ba51f7eb6f
commit 4a2159cdaa

View File

@@ -6,40 +6,18 @@
services:
codimd:
image: "nabo.codimd.dev/hackmdio/hackmd:latest"
image: nabo.codimd.dev/hackmdio/hackmd:latest
environment:
# Port setup for Coolify/Traefik
- SERVICE_FQDN_CODIMD_3000
- CMD_DOMAIN=$SERVICE_URL_CODIMD
- CMD_PROTOCOL_USESSL=true
# This forces the use of https in return urls (for oauth2 ? if used)
# Session secret, autogenerated by coolify
- CMD_SESSION_SECRET=$SERVICE_PASSWORD_SESSIONSECRET
# Force resources to be loaded without any external CDN (privacy, security, and isolation)
- CMD_USECDN=false
# DB url
- "CMD_DB_URL=postgres://$SERVICE_USER_POSTGRES:$SERVICE_PASSWORD_POSTGRES@postgresql:5432/${POSTGRES_DB:-codimd}"
# GitHub Configuration
# - CMD_GITHUB_CLIENTID=$GITHUB_CLIENTID
# - CMD_GITHUB_CLIENTSECRET=$GITHUB_CLIENTSECRET
# If you're planning to use it, uncomment and provide GITHUB_CLIENTID and GITHUB_CLIENTSECRET environment variables
# I ran into some issues where nothing would happen after login, so you should test it first
# Email Configuration
# https://hackmd.io/c/codimd-documentation/%2Fs%2Fcodimd-configuration#Authentication
# Warning: CodiMD does *not* verify emails
- CMD_EMAIL=true
- CMD_ALLOW_EMAIL_REGISTER=true
# You're forced to have CMD_ALLOW_EMAIL_REGISTER=true at least once for the first time you create an account
# However, can be safely disabled afterwards
# You can also use the manage_users script to create users: https://github.com/hackmdio/codimd/blob/master/bin/manage_users
# Example: docker exec -t codimd-fgcgkg8gsc8ocww004o0k8g8 node bin/manage_users --add user@example.com
- CMD_DOMAIN=${SERVICE_URL_CODIMD}
- CMD_PROTOCOL_USESSL=${CMD_PROTOCOL_USESSL:-false}
- CMD_SESSION_SECRET=${SERVICE_PASSWORD_SESSIONSECRET}
- CMD_USECDN=${CMD_USECDN:-false}
- CMD_DB_URL=postgres://${SERVICE_USER_POSTGRES}:${SERVICE_PASSWORD_POSTGRES}@postgres:5432/${POSTGRES_DB:-codimd-db}
- CMD_EMAIL=${CMD_EMAIL:-true}
- CMD_ALLOW_EMAIL_REGISTER=${CMD_ALLOW_EMAIL_REGISTER:-true}
depends_on:
postgresql:
postgres:
condition: service_healthy
healthcheck:
test:
@@ -49,16 +27,16 @@ services:
timeout: 20s
retries: 5
volumes:
- "upload-data:/home/hackmd/app/public/uploads"
restart: always
postgresql:
image: "postgres:16-alpine"
- uploads_data:/home/hackmd/app/public/uploads
postgres:
image: postgres:16-alpine
volumes:
- "postgresql-data:/var/lib/postgresql/data"
- codimd_postgres_data:/var/lib/postgresql/data
environment:
- POSTGRES_USER=$SERVICE_USER_POSTGRES
- POSTGRES_PASSWORD=$SERVICE_PASSWORD_POSTGRES
- "POSTGRES_DB=${POSTGRES_DB:-codimd}"
- POSTGRES_USER=${SERVICE_USER_POSTGRES}
- POSTGRES_PASSWORD=${SERVICE_PASSWORD_POSTGRES}
- POSTGRES_DB=${POSTGRES_DB:-codimd-db}
healthcheck:
test:
- CMD-SHELL