Merge branch 'sqlite' of ssh://git.coopcloud.tech:2222/fauno/hedgedoc
This commit is contained in:
commit
aa70a53ef1
@ -8,11 +8,15 @@ DOMAIN=hedgedoc.example.com
|
|||||||
#EXTRA_DOMAINS=', `www.hedgedoc.example.com`'
|
#EXTRA_DOMAINS=', `www.hedgedoc.example.com`'
|
||||||
LETS_ENCRYPT_ENV=production
|
LETS_ENCRYPT_ENV=production
|
||||||
|
|
||||||
SECRET_DB_PASSWORD_VERSION=v1
|
|
||||||
SECRET_SESSION_SECRET_VERSION=v1
|
SECRET_SESSION_SECRET_VERSION=v1
|
||||||
|
|
||||||
COMPOSE_FILE="compose.yml"
|
COMPOSE_FILE="compose.yml"
|
||||||
|
|
||||||
|
# PostgreSQL
|
||||||
|
|
||||||
|
#COMPOSE_FILE="$COMPOSE_FILE:compose.postgresql.yml"
|
||||||
|
#SECRET_DB_PASSWORD_VERSION=v1
|
||||||
|
|
||||||
# OAuth, see https://docs.hedgedoc.org/guides/auth/keycloak/
|
# OAuth, see https://docs.hedgedoc.org/guides/auth/keycloak/
|
||||||
|
|
||||||
#COMPOSE_FILE="$COMPOSE_FILE:compose.oauth.yml"
|
#COMPOSE_FILE="$COMPOSE_FILE:compose.oauth.yml"
|
||||||
|
2
abra.sh
2
abra.sh
@ -1,2 +1,2 @@
|
|||||||
export ENTRYPOINT_CONF_VERSION=v9
|
export ENTRYPOINT_CONF_VERSION=v10
|
||||||
export PG_BACKUP_VERSION=v1
|
export PG_BACKUP_VERSION=v1
|
||||||
|
55
compose.postgresql.yml
Normal file
55
compose.postgresql.yml
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
version: "3.8"
|
||||||
|
services:
|
||||||
|
app:
|
||||||
|
environment:
|
||||||
|
- CMD_DB_URL=
|
||||||
|
- CMD_DB_NAME=codimd
|
||||||
|
- CMD_DB_USER=codimd
|
||||||
|
- CMD_DB_HOST=db
|
||||||
|
- CMD_DB_PASSWORD_FILE=/run/secrets/db_password
|
||||||
|
depends_on:
|
||||||
|
- db
|
||||||
|
networks:
|
||||||
|
- internal
|
||||||
|
secrets:
|
||||||
|
- db_password
|
||||||
|
db:
|
||||||
|
image: postgres:16.4-alpine
|
||||||
|
environment:
|
||||||
|
- POSTGRES_USER=codimd
|
||||||
|
- POSTGRES_PASSWORD_FILE=/run/secrets/db_password
|
||||||
|
- POSTGRES_DB=codimd
|
||||||
|
volumes:
|
||||||
|
- "postgres:/var/lib/postgresql/data"
|
||||||
|
secrets:
|
||||||
|
- db_password
|
||||||
|
networks:
|
||||||
|
- internal
|
||||||
|
deploy:
|
||||||
|
labels:
|
||||||
|
backupbot.backup: "${ENABLE_BACKUPS:-true}"
|
||||||
|
backupbot.backup.pre-hook: "/pg_backup.sh backup"
|
||||||
|
backupbot.backup.volumes.postgres.path: "backup.sql"
|
||||||
|
backupbot.restore.post-hook: '/pg_backup.sh restore'
|
||||||
|
healthcheck:
|
||||||
|
test: "pg_isready"
|
||||||
|
interval: 30s
|
||||||
|
timeout: 10s
|
||||||
|
retries: 5
|
||||||
|
start_period: 1m
|
||||||
|
configs:
|
||||||
|
- source: pg_backup
|
||||||
|
target: /pg_backup.sh
|
||||||
|
mode: 0555
|
||||||
|
volumes:
|
||||||
|
postgres:
|
||||||
|
secrets:
|
||||||
|
db_password:
|
||||||
|
external: true
|
||||||
|
name: ${STACK_NAME}_db_password_${SECRET_DB_PASSWORD_VERSION}
|
||||||
|
networks:
|
||||||
|
internal:
|
||||||
|
configs:
|
||||||
|
pg_backup:
|
||||||
|
name: ${STACK_NAME}_pg_backup_${PG_BACKUP_VERSION}
|
||||||
|
file: pg_backup.sh
|
49
compose.yml
49
compose.yml
@ -8,10 +8,7 @@ services:
|
|||||||
- CMD_DOMAIN=$DOMAIN
|
- CMD_DOMAIN=$DOMAIN
|
||||||
- CMD_PROTOCOL_USESSL=true
|
- CMD_PROTOCOL_USESSL=true
|
||||||
- CMD_HSTS_ENABLE=false
|
- CMD_HSTS_ENABLE=false
|
||||||
- CMD_DB_NAME=codimd
|
- CMD_DB_URL=sqlite:/database/db.sqlite3
|
||||||
- CMD_DB_USER=codimd
|
|
||||||
- CMD_DB_HOST=db
|
|
||||||
- CMD_DB_PASSWORD_FILE=/run/secrets/db_password
|
|
||||||
- CMD_ALLOW_ANONYMOUS
|
- CMD_ALLOW_ANONYMOUS
|
||||||
- CMD_ALLOW_ANONYMOUS_EDITS
|
- CMD_ALLOW_ANONYMOUS_EDITS
|
||||||
- CMD_ALLOW_EMAIL_REGISTER
|
- CMD_ALLOW_EMAIL_REGISTER
|
||||||
@ -29,15 +26,12 @@ services:
|
|||||||
- CMD_SESSION_LIFE
|
- CMD_SESSION_LIFE
|
||||||
- CMD_SESSION_SECRET_FILE=/run/secrets/session_secret
|
- CMD_SESSION_SECRET_FILE=/run/secrets/session_secret
|
||||||
- DOCUMENT_MAX_LENGTH
|
- DOCUMENT_MAX_LENGTH
|
||||||
depends_on:
|
|
||||||
- db
|
|
||||||
networks:
|
networks:
|
||||||
- proxy
|
- proxy
|
||||||
- internal
|
|
||||||
volumes:
|
volumes:
|
||||||
- codimd_uploads:/hedgedoc/public/uploads
|
- codimd_uploads:/hedgedoc/public/uploads
|
||||||
|
- codimd_database:/database
|
||||||
secrets:
|
secrets:
|
||||||
- db_password
|
|
||||||
- session_secret
|
- session_secret
|
||||||
entrypoint: /docker-entrypoint.sh
|
entrypoint: /docker-entrypoint.sh
|
||||||
configs:
|
configs:
|
||||||
@ -61,55 +55,23 @@ services:
|
|||||||
- "traefik.http.middlewares.${STACK_NAME}-redirect.headers.SSLHost=${DOMAIN}"
|
- "traefik.http.middlewares.${STACK_NAME}-redirect.headers.SSLHost=${DOMAIN}"
|
||||||
- "coop-cloud.${STACK_NAME}.timeout=${TIMEOUT:-120}"
|
- "coop-cloud.${STACK_NAME}.timeout=${TIMEOUT:-120}"
|
||||||
- "coop-cloud.${STACK_NAME}.version=1.2.2+1.10.1"
|
- "coop-cloud.${STACK_NAME}.version=1.2.2+1.10.1"
|
||||||
|
- "backupbot.backup=${ENABLE_BACKUPS:-true}"
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: "nodejs -e \"http.get('http://localhost:3000', (res) => { console.log('status: ', res.statusCode); if (res.statusCode == 200) { process.exit(0); } else { process.exit(1); } });\""
|
test: "nodejs -e \"http.get('http://localhost:3000', (res) => { console.log('status: ', res.statusCode); if (res.statusCode == 200) { process.exit(0); } else { process.exit(1); } });\""
|
||||||
interval: 30s
|
interval: 30s
|
||||||
timeout: 10s
|
timeout: 10s
|
||||||
retries: 10
|
retries: 10
|
||||||
start_period: 1m
|
start_period: 1m
|
||||||
db:
|
|
||||||
image: postgres:16.4-alpine
|
|
||||||
environment:
|
|
||||||
- POSTGRES_USER=codimd
|
|
||||||
- POSTGRES_PASSWORD_FILE=/run/secrets/db_password
|
|
||||||
- POSTGRES_DB=codimd
|
|
||||||
volumes:
|
|
||||||
- "postgres:/var/lib/postgresql/data"
|
|
||||||
secrets:
|
|
||||||
- db_password
|
|
||||||
networks:
|
|
||||||
- internal
|
|
||||||
deploy:
|
|
||||||
labels:
|
|
||||||
backupbot.backup: "${ENABLE_BACKUPS:-true}"
|
|
||||||
backupbot.backup.pre-hook: "/pg_backup.sh backup"
|
|
||||||
backupbot.backup.volumes.postgres.path: "backup.sql"
|
|
||||||
backupbot.restore.post-hook: '/pg_backup.sh restore'
|
|
||||||
healthcheck:
|
|
||||||
test: "pg_isready"
|
|
||||||
interval: 30s
|
|
||||||
timeout: 10s
|
|
||||||
retries: 5
|
|
||||||
start_period: 1m
|
|
||||||
configs:
|
|
||||||
- source: pg_backup
|
|
||||||
target: /pg_backup.sh
|
|
||||||
mode: 0555
|
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
postgres:
|
|
||||||
codimd_uploads:
|
codimd_uploads:
|
||||||
|
codimd_database:
|
||||||
secrets:
|
secrets:
|
||||||
db_password:
|
|
||||||
external: true
|
|
||||||
name: ${STACK_NAME}_db_password_${SECRET_DB_PASSWORD_VERSION}
|
|
||||||
session_secret:
|
session_secret:
|
||||||
external: true
|
external: true
|
||||||
name: ${STACK_NAME}_session_secret_${SECRET_SESSION_SECRET_VERSION}
|
name: ${STACK_NAME}_session_secret_${SECRET_SESSION_SECRET_VERSION}
|
||||||
networks:
|
networks:
|
||||||
proxy:
|
proxy:
|
||||||
external: true
|
external: true
|
||||||
internal:
|
|
||||||
configs:
|
configs:
|
||||||
config_json:
|
config_json:
|
||||||
name: ${STACK_NAME}_config_${ENTRYPOINT_CONF_VERSION}
|
name: ${STACK_NAME}_config_${ENTRYPOINT_CONF_VERSION}
|
||||||
@ -119,6 +81,3 @@ configs:
|
|||||||
name: ${STACK_NAME}_entrypoint_${ENTRYPOINT_CONF_VERSION}
|
name: ${STACK_NAME}_entrypoint_${ENTRYPOINT_CONF_VERSION}
|
||||||
file: entrypoint.sh.tmpl
|
file: entrypoint.sh.tmpl
|
||||||
template_driver: golang
|
template_driver: golang
|
||||||
pg_backup:
|
|
||||||
name: ${STACK_NAME}_pg_backup_${PG_BACKUP_VERSION}
|
|
||||||
file: pg_backup.sh
|
|
||||||
|
@ -34,11 +34,13 @@ main() {
|
|||||||
mkdir -p "/hedgedoc/.npm" && \
|
mkdir -p "/hedgedoc/.npm" && \
|
||||||
chown -R 10000:65534 "/hedgedoc/.npm" && \
|
chown -R 10000:65534 "/hedgedoc/.npm" && \
|
||||||
chmod "u+rwx" "/hedgedoc/.npm"
|
chmod "u+rwx" "/hedgedoc/.npm"
|
||||||
|
|
||||||
|
chown -R 10000:65534 /database
|
||||||
}
|
}
|
||||||
|
|
||||||
main
|
main
|
||||||
|
|
||||||
export CMD_DB_URL=postgres://$CMD_DB_USER:$CMD_DB_PASSWORD@$CMD_DB_HOST:5432/$CMD_DB_NAME
|
export CMD_DB_URL="${CMD_DB_URL:-postgres://$CMD_DB_USER:$CMD_DB_PASSWORD@$CMD_DB_HOST:5432/$CMD_DB_NAME}"
|
||||||
|
|
||||||
# 3wc: `source /docker-entrypoint.sh -e` to load CMD_DB_URL for CLI scripts
|
# 3wc: `source /docker-entrypoint.sh -e` to load CMD_DB_URL for CLI scripts
|
||||||
if [ ! "${1-}" == "-e" ]; then
|
if [ ! "${1-}" == "-e" ]; then
|
||||||
|
Loading…
Reference in New Issue
Block a user