Compare commits

...

86 Commits
main ... main

Author SHA1 Message Date
828c7c1300 chore: publish 3.0.2+1.10.3 release 2025-06-10 17:29:07 +02:00
f0c6a3c19c
critical fix to run postgres database 2025-06-10 17:26:40 +02:00
94f238c4af
add breaking change release note to version 1.2.2+1.10.1 2025-05-27 19:56:55 +02:00
1dfdd90845
fix CI 2025-05-27 19:40:49 +02:00
f
660a5fee21 chore: publish 3.0.1+1.10.3 release 2025-04-23 16:48:57 -03:00
8d23542076 Merge pull request 'security upgrade' (#17) from upgrade into main
Reviewed-on: coop-cloud/hedgedoc#17
Reviewed-by: decentral1se <decentral1se@noreply.git.coopcloud.tech>
2025-04-23 19:46:19 +00:00
f
29968706fc fix: check for password file presence to build db url 2025-04-11 17:02:46 -03:00
f
1db30e2cda fix: typo 2025-04-11 17:01:25 -03:00
f
ec1735a005 feat: set db type 2025-04-11 17:00:56 -03:00
f
29a7d585dc fix: provide default values for variables 2025-04-10 15:42:21 -03:00
f
d0191f1c49 fix: prevent unbound variable error 2025-04-10 09:50:06 -03:00
f
58bfa65b8a fix: security upgrade
https://github.com/hedgedoc/hedgedoc/security/advisories/GHSA-3983-rrqh-mvx5
2025-04-10 09:26:42 -03:00
3wc
98c0268b72 chore: publish 3.0.0+1.10.1 release 2025-02-24 12:34:13 -05:00
3wc
73c8b662d4 Switch to pgautoupgrade to handle major database upgrades 2025-02-24 12:33:07 -05:00
3wc
674cbd0431 Fix CMD_DB_URL setting for postgres 2025-02-24 12:32:54 -05:00
f
4972af78e8 chore: publish 2.0.0+1.10.1 release 2025-02-04 12:57:45 +01:00
aa2afc2270 Revert "chore: publish 1.3.0+1.10.1 release"
This reverts commit 6fbaeb7af07940e21e7c22abd7f55cecdc7c4baf.
2025-02-04 12:56:14 +01:00
f
6fbaeb7af0 chore: publish 1.3.0+1.10.1 release 2025-02-03 09:45:58 -03:00
f
aa70a53ef1 Merge branch 'sqlite' of ssh://git.coopcloud.tech:2222/fauno/hedgedoc 2025-02-03 09:44:47 -03:00
f
3efbfec419 chore: publish 1.2.2+1.10.1 release 2025-02-03 09:42:30 -03:00
f
93e5604fcb fix: GHSA-6w39-x2c6-6mpf
https://github.com/hedgedoc/hedgedoc/security/advisories/GHSA-6w39-x2c6-6mpf
2025-02-03 09:34:32 -03:00
917766023b Update .drone.yml 2025-01-08 10:09:12 -08:00
6feab6a99e Merge pull request 'envvars' (#16) from fauno/hedgedoc:envvars into main
Reviewed-on: coop-cloud/hedgedoc#16
2024-10-27 06:22:01 +00:00
f
24c3349074 fix: backup bot configuration 2024-10-26 13:20:05 -03:00
f
6429b2720f fix: chown the database 2024-10-26 13:11:12 -03:00
f
ca5a95bea6 fix: load secret from file into env var 2024-10-26 11:01:18 -03:00
f
45986d1af4 fix: db_password secret not needed 2024-10-26 10:59:54 -03:00
f
35e78f4834 fix: don't overwrite CMD_DB_URL 2024-10-25 17:52:50 -03:00
f
3a98857b5c feat: postgresql support is optional 2024-10-25 17:51:49 -03:00
f
2310cb9378 feat: support sqlite 2024-10-25 17:50:18 -03:00
f
6a036c4c82 fix: set session secret 2024-10-25 17:47:27 -03:00
f
d19f286c11 fix: require authentication for free urls 2024-10-25 17:46:47 -03:00
635eee710b chore: publish 1.2.1+1.10.0 release 2024-10-25 21:04:02 +02:00
49f06173e9 fix drone runner 2024-10-24 13:31:31 +02:00
9194256835 update backupbot label 2024-10-24 13:22:27 +02:00
081f2139fa chore: publish 1.2.0+1.10.0 release 2024-10-01 13:12:13 +02:00
6f15d5f2c7 chore: publish 1.1.0+1.9.9 release 2024-07-16 17:32:26 +02:00
8bc03406a1 Remove legacy backup configuration
by @wolcen
2024-07-16 17:31:57 +02:00
bc8996f558 Correct README re: configuring users
by @wolcen
2024-07-16 17:31:20 +02:00
fcf5bade21 Add basic health check for db container
by @wolcen
2024-07-16 17:29:45 +02:00
3fc480b82b Remove unnecessary mode assignment for config.json @wolcen 2024-07-16 17:29:45 +02:00
f71534e396 fix indentation for backupbot labels 2024-07-16 17:29:45 +02:00
5e815e63a5 Merge pull request 'fix: use new uploads path' (#12) from fix-uploads-volume into main
Reviewed-on: coop-cloud/hedgedoc#12
2024-07-16 14:52:03 +00:00
ec98bab9d5 Merge pull request 'Pass -p also in entrypoint' (#14) from entrypoint-fix into main
Reviewed-on: coop-cloud/hedgedoc#14
2024-07-16 14:49:28 +00:00
65ec56ac08 add alakazam integration file alaconnect.yml 2024-05-13 17:41:59 +02:00
1ed15423c3
fix: pass "-p" and use new lines
Closes coop-cloud/hedgedoc#13
2024-04-28 17:57:38 +02:00
0443ffc984
chore: remove tabs 2024-04-28 17:55:55 +02:00
c727320a31
fix: use new uploads path 2024-04-23 09:21:38 +02:00
e8f1186965 chore: publish 1.0.1+1.9.9 release 2024-04-17 17:14:23 +02:00
66c5160812 fix backupbot label 2024-04-17 17:07:53 +02:00
c656afb176 chore: publish 1.0.0+1.9.9 release 2023-12-13 07:49:46 -08:00
97f2d94079 chore: publish 0.6.0+1.9.9 release 2023-10-26 11:14:40 -07:00
4846a09169 add timeout label 2023-10-19 22:50:23 +02:00
210a37cd0c fix permissions for real 2023-10-13 17:10:41 +02:00
3wc
914ef6b026 Spooky permissions fix?
See https://github.com/hedgedoc/container/issues/463
2023-10-02 19:11:13 +01:00
5f205c149f Merge pull request 'update outdated readme + add restore hook' (#10) from mayel-patch-1 into main
Reviewed-on: coop-cloud/hedgedoc#10
2023-07-29 11:37:09 +00:00
d2c8993fcc Update compose.yml 2023-07-29 10:42:49 +00:00
1c93adcf21 add restore hook 2023-07-29 10:42:21 +00:00
7970e7c61e typo 2023-07-28 23:08:08 +00:00
e14f050ede update outdated readme based on docker compose file 2023-07-28 22:55:38 +00:00
3wc
5fd556d358 chore: publish 0.5.1+1.9.8 release 2023-07-08 19:39:01 +01:00
3wc
4c2417901e Switch to self-hosted stack-ssh-deploy image [mass update] 2023-01-21 11:49:55 -08:00
3wc
6bc2679dee Fix CI by adding networks: [mass update] 2023-01-20 11:58:41 -08:00
3wc
d2d5b8ceb1 Automatically generate catalogue on release [mass update]
Re: coop-cloud/recipes-catalogue-json#4
2023-01-20 10:27:11 -08:00
3wc
afd3b03b21 Update abra syntax in examples (finally) [mass update] 2023-01-19 16:02:27 -08:00
b43724ecba Merge pull request 'Add configuration option for maximum note length' (#8) from wolcen/hedgedoc:main into main
Reviewed-on: coop-cloud/hedgedoc#8
2022-12-15 20:29:18 +00:00
8e973cbed1 Closing `'s seem not required when indented
Otherwise, extra `` prints on README display.
2022-12-15 20:10:29 +00:00
Chris Thompson
7780eb9f13 Bump configuration version 2022-12-15 15:05:13 -05:00
Chris Thompson
9e88945b9b Corrections to get config updating and effective 2022-12-15 15:05:02 -05:00
Chris Thompson
6139cff626 Correct link 2022-12-15 14:39:19 -05:00
Chris Thompson
0c96d5a45f Add config file template for documentMaxLength setting 2022-12-15 14:39:14 -05:00
a896d27542 chore: publish 0.5.0+1.9.6 release 2022-12-02 16:04:10 +01:00
90d5d3fc18 chore: publish 0.4.0+1.9.3 release 2022-07-05 16:58:09 +02:00
b282386419 update oauth envs 2022-07-05 16:50:01 +02:00
980cac71d8 chore: publish 0.3.0+1.9.3 release 2022-05-09 14:46:44 +02:00
d277bd9ac1 add backupbot labels 2022-05-09 14:43:57 +02:00
3wc
5343ebb076 chore: publish 0.2.0+1.9.3 release 2022-04-13 21:38:04 +02:00
3wc
f6827630d8 Goodbye, emojis! 😢
[ci skip]
2021-11-23 12:19:05 +02:00
3wc
29448933fc New version, sync labels 2021-10-16 17:04:37 +02:00
3wc
399f1f718b New .env.sample format, extra OIDC vars 2021-10-16 16:59:32 +02:00
3wc
92e554fb5c Update Drone for nüname 2021-08-17 20:42:51 +02:00
3wc
ccb340b7ff Update for Hedgedoc 🦔 2021-08-17 20:29:07 +02:00
3wc
1f1cd735d1 Fix abra app .. run example command 2021-07-30 20:55:38 +02:00
fd2c333a54 Merge pull request 'Add selected environment options' (#7) from nicksellen/codimd:add/more-env-options into main
Reviewed-on: coop-cloud/codimd#7
2021-07-30 18:45:57 +00:00
a781e47fe2
Set new config options to default values 2021-07-30 19:43:00 +01:00
f81b91db99
Add selected environment options 2021-07-30 19:11:32 +01:00
18 changed files with 284 additions and 103 deletions

View File

@ -3,30 +3,40 @@ kind: pipeline
name: deploy to swarm-test.autonomic.zone
steps:
- name: deployment
image: decentral1se/stack-ssh-deploy:latest
image: git.coopcloud.tech/coop-cloud/stack-ssh-deploy:latest
settings:
host: swarm-test.autonomic.zone
stack: codimd
stack: hedgedoc
networks:
- proxy
deploy_key:
from_secret: drone_ssh_swarm_test
generate_secrets: true
purge: true
environment:
DOMAIN: codimd.swarm-test.autonomic.zone
STACK_NAME: codimd
DOMAIN: hedgedoc.swarm-test.autonomic.zone
STACK_NAME: hedgedoc
LETS_ENCRYPT_ENV: production
SECRET_DB_PASSWORD_VERSION: v1
SECRET_SESSION_SECRET_VERSION: v1
ENTRYPOINT_CONF_VERSION: v1
PG_BACKUP_VERSION: v1
trigger:
branch:
- main
---
kind: pipeline
name: recipe release
name: generate recipe catalogue
steps:
- name: release a new version
image: thecoopcloud/drone-abra:latest
image: plugins/downstream
settings:
command: recipe codimd release
deploy_key:
from_secret: abra_bot_deploy_key
server: https://build.coopcloud.tech
token:
from_secret: drone_abra-bot_token
fork: true
repositories:
- toolshed/auto-recipes-catalogue-json
trigger:
event: tag

View File

@ -1,20 +1,54 @@
TYPE=codimd
TYPE=hedgedoc
TIMEOUT=300
ENABLE_AUTO_UPDATE=true
ENABLE_BACKUPS=true
DOMAIN=codimd.example.com
DOMAIN=hedgedoc.example.com
## Domain aliases
#EXTRA_DOMAINS=', `www.codimd.example.com`'
#EXTRA_DOMAINS=', `www.hedgedoc.example.com`'
LETS_ENCRYPT_ENV=production
SECRET_DB_PASSWORD_VERSION=v1
SECRET_SESSION_SECRET_VERSION=v1
# OAuth, see https://hackmd.io/@codimd/codimd-generic-oauth-2
COMPOSE_FILE="compose.yml"
#COMPOSE_FILE="compose.yml:compose.oauth.yml"
# PostgreSQL
#COMPOSE_FILE="$COMPOSE_FILE:compose.postgresql.yml"
#SECRET_DB_PASSWORD_VERSION=v1
# OAuth, see https://docs.hedgedoc.org/guides/auth/keycloak/
#COMPOSE_FILE="$COMPOSE_FILE:compose.oauth.yml"
#CMD_OAUTH2_PROVIDERNAME="Keycloak"
#CMD_OAUTH2_BASEURL="https://keycloak.example.com/realms/realmname/protocol/openid-connect/"
#CMD_OAUTH2_CLIENT_ID="codimd"
#CMD_OAUTH2_CLIENT_ID="hedgedoc"
#CMD_OAUTH2_AUTHORIZATION_URL="https://keycloak.example.com/auth/realms/realmname/protocol/openid-connect/auth"
#CMD_OAUTH2_TOKEN_URL="https://keycloak.example.com/auth/realms/realmname/protocol/openid-connect/token"
#CMD_OAUTH2_USER_PROFILE_URL="https://keycloak.example.com/auth/realms/realmname/protocol/openid-connect/userinfo"
#CMD_OAUTH2_USER_PROFILE_USERNAME_ATTR=ocs.data.id
#CMD_OAUTH2_USER_PROFILE_DISPLAY_NAME_ATTR=ocs.data.display-name
#CMD_OAUTH2_USER_PROFILE_EMAIL_ATTR=ocs.data.email
#CMD_OAUTH2_PROVIDERNAME=Keycloak
#CMD_OAUTH2_SCOPE="openid email profile"
#
#SECRET_OAUTH_KEY_VERSION=v1
# Options, see https://docs.hedgedoc.org/configuration/
# CMD_ALLOW_ANONYMOUS=true
# CMD_ALLOW_ANONYMOUS_EDITS=false
# CMD_ALLOW_EMAIL_REGISTER=true
# CMD_ALLOW_FREEURL=false
# CMD_REQUIRE_FREEURL_AUTHENTICATION=true
# CMD_ALLOW_GRAVATAR=true
# CMD_ALLOW_ORIGIN=localhost
# CMD_COOKIE_POLICY=lax
# CMD_CSP_ADD_DISQUS=false
# CMD_CSP_ADD_GOOGLE_ANALYTICS=false
# CMD_CSP_ENABLE=true
# CMD_CSP_REPORTURI=undefined
# CMD_DEFAULT_PERMISSION=editable
# CMD_EMAIL=true
# CMD_SESSION_LIFE=1209600000
# Only present in config.json (no equivalent env var):
# DOCUMENT_MAX_LENGTH=100000

View File

@ -1,35 +1,34 @@
# CodiMD
# Hedgedoc
[![Build Status](https://drone.autonomic.zone/api/badges/coop-cloud/codimd/status.svg)](https://drone.autonomic.zone/coop-cloud/codimd)
[![Build Status](https://drone.autonomic.zone/api/badges/coop-cloud/hedegedoc/status.svg)](https://drone.autonomic.zone/coop-cloud/hedegedoc)
[CodiMD][codimd] using Coöp Cloud ♥
[Hedgedoc][hedegedoc] using Coöp Cloud ♥
<!-- metadata -->
* **Category**: Apps
* **Status**: ❷💛
* **Image**: [`hackmdio/hackmd`](https://hub.docker.com/r/hackmdio/hackmd/), ❶💚, upstream
* **Status**: 2, beta
* **Image**: [`quay.io/hedgedoc/hedgedoc`](https://quay.io/hedgedoc/hedgedoc), 4, upstream
* **Healthcheck**: Yes
* **Backups**: No
* **Backups**: Yes
* **Email**: No
* **Tests**: ❷💛
* **SSO**: ❶💚 (OAuth)
* **Tests**: 2
* **SSO**: 3 (OAuth)
<!-- endmetadata -->
## Basic usage
1. Set up Docker Swarm and [`abra`][abra]
2. Deploy [`coop-cloud/traefik`][compose-traefik]
3. `abra app new codimd`
4. `abra app YOURAPPDOMAIN config` - be sure to change `$DOMAIN` to something that resolves to
3. `abra app new hedgedoc`
4. `abra app config YOURAPPDOMAIN` - be sure to change `$DOMAIN` to something that resolves to
your Docker swarm box
5. `abra app YOURAPPDOMAIN deploy`
5. `abra app deploy YOURAPPDOMAIN`
6. Create initial user:
```
abra run YOURAPPDOMAIN app bash
. /docker-entrypoint2.sh -e
abra app run YOURAPPDOMAIN app bash
. /docker-entrypoint.sh -e
bin/manage_users
```
[codimd]: https://github.com/hackmdio/codimd
[hedegedoc]: https://github.com/hedgedoc/hedgedoc
[abra]: https://git.autonomic.zone/autonomic-cooperative/abra
[compose-traefik]: https://git.autonomic.zone/coop-cloud/traefik

15
abra.sh
View File

@ -1,13 +1,2 @@
export ENTRYPOINT_CONF_VERSION=v1
abra_backup_app() {
_abra_backup_dir "app:/home/hackmd/app/public/uploads/"
}
abra_backup_db() {
_abra_backup_postgres "db" "codimd" "codimd" "db_password"
}
abra_backup() {
abra_backup_app && abra_backup_db
}
export ENTRYPOINT_CONF_VERSION=v13
export PG_BACKUP_VERSION=v1

15
alaconnect.yml Normal file
View File

@ -0,0 +1,15 @@
authentik:
env:
CMD_OAUTH2_USER_PROFILE_URL: https://authentik.example.com/application/o/userinfo/
CMD_OAUTH2_USER_PROFILE_USERNAME_ATTR: preferred_username
CMD_OAUTH2_USER_PROFILE_DISPLAY_NAME_ATTR: name
CMD_OAUTH2_USER_PROFILE_EMAIL_ATTR: email
CMD_OAUTH2_TOKEN_URL: https://authentik.example.com/application/o/token/
CMD_OAUTH2_AUTHORIZATION_URL: https://authentik.example.com/application/o/authorize/
CMD_OAUTH2_CLIENT_ID: hedgedoc
CMD_OAUTH2_PROVIDERNAME: Authentik
uncomment:
- compose.oauth.yml
- SECRET_OAUTH_KEY_VERSION
shared_secrets:
hedgedoc_secret: oauth_key

View File

@ -5,13 +5,15 @@ services:
app:
environment:
- CMD_OAUTH2_PROVIDERNAME
- CMD_OAUTH2_BASEURL
- CMD_OAUTH2_CLIENT_ID
- CMD_OAUTH2_CLIENT_SECRET_FILE=/run/secrets/oauth_key
- CMD_OAUTH2_AUTHORIZATION_URL
- CMD_OAUTH2_TOKEN_URL
- CMD_OAUTH2_USER_PROFILE_URL
- CMD_OAUTH2_USER_PROFILE_USERNAME_ATTR
- CMD_OAUTH2_USER_PROFILE_DISPLAY_NAME_ATTR
- CMD_OAUTH2_USER_PROFILE_EMAIL_ATTR
- CMD_OAUTH2_SCOPE
secrets:
- oauth_key

55
compose.postgresql.yml Normal file
View File

@ -0,0 +1,55 @@
version: "3.8"
services:
app:
environment:
- CMD_DB_TYPE=postgres
- 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: pgautoupgrade/pgautoupgrade:16-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

View File

@ -1,28 +1,45 @@
version: "3.8"
services:
app:
image: hackmdio/hackmd:2.4.1
image: quay.io/hedgedoc/hedgedoc:1.10.3
environment:
- CMD_USECDN=false
- CMD_DB_NAME=codimd
- CMD_DB_USER=codimd
- CMD_DB_HOST=db
- CMD_DB_PASSWORD_FILE=/run/secrets/db_password
- CMD_EMAIL # Email login enabled?
depends_on:
- db
- CMD_URL_ADDPORT=false
- CMD_DOMAIN=$DOMAIN
- CMD_PROTOCOL_USESSL=true
- CMD_HSTS_ENABLE=false
- CMD_DB_URL=sqlite:/database/db.sqlite3
- CMD_ALLOW_ANONYMOUS
- CMD_ALLOW_ANONYMOUS_EDITS
- CMD_ALLOW_EMAIL_REGISTER
- CMD_ALLOW_FREEURL
- CMD_REQUIRE_FREEURL_AUTHENTICATION
- CMD_ALLOW_GRAVATAR
- CMD_ALLOW_ORIGIN
- CMD_COOKIE_POLICY
- CMD_CSP_ADD_DISQUS
- CMD_CSP_ADD_GOOGLE_ANALYTICS
- CMD_CSP_ENABLE
- CMD_CSP_REPORTURI
- CMD_DEFAULT_PERMISSION
- CMD_EMAIL
- CMD_SESSION_LIFE
- CMD_SESSION_SECRET_FILE=/run/secrets/session_secret
- DOCUMENT_MAX_LENGTH
networks:
- proxy
- internal
volumes:
- codimd_uploads:/home/hackmd/app/public/uploads
- codimd_uploads:/hedgedoc/public/uploads
- codimd_database:/database
secrets:
- db_password
- session_secret
entrypoint: /docker-entrypoint.sh
configs:
- source: entrypoint_conf
target: /docker-entrypoint.sh
mode: 0555
- source: config_json
target: /files/config.json
deploy:
restart_policy:
condition: on-failure
@ -36,39 +53,30 @@ services:
- "traefik.http.routers.${STACK_NAME}.middlewares=${STACK_NAME}-redirect"
- "traefik.http.middlewares.${STACK_NAME}-redirect.headers.SSLForceHost=true"
- "traefik.http.middlewares.${STACK_NAME}-redirect.headers.SSLHost=${DOMAIN}"
- coop-cloud.${STACK_NAME}.app.version=2.4.1-e93929f3
- "coop-cloud.${STACK_NAME}.timeout=${TIMEOUT:-120}"
- "coop-cloud.${STACK_NAME}.version=3.0.2+1.10.3"
- "backupbot.backup=${ENABLE_BACKUPS:-true}"
healthcheck:
test: ["CMD", "wget", "-qO", "-", "http://localhost:3000"]
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
timeout: 10s
retries: 10
start_period: 1m
db:
image: postgres:11.12-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: ['coop-cloud.${STACK_NAME}.db.version=11.12-alpine-09c7c402']
volumes:
postgres:
codimd_uploads:
codimd_database:
secrets:
db_password:
session_secret:
external: true
name: ${STACK_NAME}_db_password_${SECRET_DB_PASSWORD_VERSION}
name: ${STACK_NAME}_session_secret_${SECRET_SESSION_SECRET_VERSION}
networks:
proxy:
external: true
internal:
configs:
config_json:
name: ${STACK_NAME}_config_${ENTRYPOINT_CONF_VERSION}
file: config.json.tmpl
template_driver: golang
entrypoint_conf:
name: ${STACK_NAME}_entrypoint_${ENTRYPOINT_CONF_VERSION}
file: entrypoint.sh.tmpl

7
config.json.tmpl Normal file
View File

@ -0,0 +1,7 @@
{
{{ if (env "DOCUMENT_MAX_LENGTH") }}
"production": {
"documentMaxLength": {{ env "DOCUMENT_MAX_LENGTH" }}
}
{{ end }}
}

View File

@ -1,46 +1,57 @@
#!/usr/bin/env bash
file_env() {
# 3wc: Load $VAR_FILE into $VAR - useful for secrets. See
# https://medium.com/@adrian.gheorghe.dev/using-docker-secrets-in-your-environment-variables-7a0609659aab
local var="$1"
local fileVar="${var}_FILE"
local def="${2:-}"
# 3wc: Load $VAR_FILE into $VAR - useful for secrets. See
# https://medium.com/@adrian.gheorghe.dev/using-docker-secrets-in-your-environment-variables-7a0609659aab
local var="$1"
local fileVar="${var}_FILE"
local def="${2:-}"
if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then
echo >&2 "error: both $var and $fileVar are set (but are exclusive)"
exit 1
fi
local val="$def"
if [ "${!var:-}" ]; then
val="${!var}"
elif [ "${!fileVar:-}" ]; then
val="$(< "${!fileVar}")"
fi
export "$var"="$val"
unset "$fileVar"
if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then
echo >&2 "error: both $var and $fileVar are set (but are exclusive)"
exit 1
fi
local val="$def"
if [ "${!var:-}" ]; then
val="${!var}"
elif [ "${!fileVar:-}" ]; then
val="$(< "${!fileVar}")"
fi
export "$var"="$val"
unset "$fileVar"
}
load_vars() {
file_env "CMD_DB_PASSWORD"
file_env "CMD_OAUTH2_CLIENT_SECRET"
if [ -n "${CMD_DB_PASSWORD_FILE:-""}" ] ; then
file_env "CMD_DB_PASSWORD"
fi
file_env "CMD_OAUTH2_CLIENT_SECRET"
file_env "CMD_SESSION_SECRET"
}
main() {
set -eu
set -eu
load_vars
load_vars
mkdir -p "/hedgedoc/.npm" && \
chown -R 10000:65534 "/hedgedoc/.npm" && \
chmod "u+rwx" "/hedgedoc/.npm"
chown -R 10000:65534 /database
}
main
export CMD_DB_URL=postgres://$CMD_DB_USER:$CMD_DB_PASSWORD@$CMD_DB_HOST/$CMD_DB_NAME
if [ -n "${CMD_DB_PASSWORD:-""}" ] ; then
export CMD_DB_URL="${CMD_DB_TYPE}://$CMD_DB_USER:$CMD_DB_PASSWORD@$CMD_DB_HOST:5432/$CMD_DB_NAME"
fi
# 3wc: `source /docker-entrypoint2.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
# 3wc: upstream ENTRYPOINT
# https://github.com/hackmdio/codimd/blob/develop/deployments/Dockerfile
/home/hackmd/app/docker-entrypoint.sh
# 3wc: upstream ENTRYPOINT
# https://github.com/hedgedoc/container/blob/master/alpine/Dockerfile
mkdir -p "/hedgedoc/.npm" && chown -R 10000:65534 "/hedgedoc/.npm"
/usr/local/bin/docker-entrypoint.sh npm start
fi
set +eu

34
pg_backup.sh Normal file
View File

@ -0,0 +1,34 @@
#!/bin/bash
set -e
BACKUP_FILE='/var/lib/postgresql/data/backup.sql'
function backup {
export PGPASSWORD=$(cat /run/secrets/db_password)
pg_dump -U ${POSTGRES_USER} ${POSTGRES_DB} > $BACKUP_FILE
}
function restore {
cd /var/lib/postgresql/data/
restore_config(){
# Restore allowed connections
cat pg_hba.conf.bak > pg_hba.conf
su postgres -c 'pg_ctl reload'
}
# Don't allow any other connections than local
cp pg_hba.conf pg_hba.conf.bak
echo "local all all trust" > pg_hba.conf
su postgres -c 'pg_ctl reload'
trap restore_config EXIT INT TERM
# Recreate Database
psql -U ${POSTGRES_USER} -d postgres -c "DROP DATABASE ${POSTGRES_DB} WITH (FORCE);"
createdb -U ${POSTGRES_USER} ${POSTGRES_DB}
psql -U ${POSTGRES_USER} -d ${POSTGRES_DB} -1 -f $BACKUP_FILE
trap - EXIT INT TERM
restore_config
}
$@

7
release/1.0.0+1.9 Normal file
View File

@ -0,0 +1,7 @@
WARNING WARNING WARNING 🚨
This release includes a major Postgres database upgrade, but does not yet include tools to automatically upgrade from older Postgres releases.
PLEASE DO NOT UPGRADE EXISTING INSTANCES TO THIS VERSION.
This should be fixed soon.

1
release/1.2.0+1.10.0 Normal file
View File

@ -0,0 +1 @@
Fixes security issue: https://github.com/hedgedoc/hedgedoc/security/advisories/GHSA-pjf2-269h-cx7p

5
release/1.2.2+1.10.1 Normal file
View File

@ -0,0 +1,5 @@
Upgrade to fix GHSA-6w39-x2c6-6mpf
BREAKING CHANGE!! new secret "session_secret" added, run:
abra app secret generate <app_domain> session_secret v1

1
release/1.3.0+1.10.1 Normal file
View File

@ -0,0 +1 @@
This release adds SQLite support by default, if you were using PostgreSQL make sure to update the env file!

1
release/3.0.0+1.10.1 Normal file
View File

@ -0,0 +1 @@
This release switches to `pgaautoupgrade` for easier Postgresql upgrades. If you are using Postgres, please take extra care to take a backup before upgrading.

1
release/3.0.1+1.10.3 Normal file
View File

@ -0,0 +1 @@
Security upgrade for GHSA-3983-rrqh-mvx5

1
release/3.0.2+1.10.3 Normal file
View File

@ -0,0 +1 @@
CRITICAL FIX: since version 3 this recipe uses always sqlite as database. This patch fixes instances running postgres