feat: Add HedgeDoc service
This commit is contained in:
parent
4cd564f530
commit
a5be480d39
|
@ -0,0 +1,33 @@
|
|||
########
|
||||
# DOCKER
|
||||
|
||||
COMPOSE_FILE=../postgres/docker-compose.yml:./docker-compose.traefik.yml:./docker-compose.yml
|
||||
|
||||
##########
|
||||
# HEDGEDOC
|
||||
|
||||
HEDGEDOC_DOMAIN=md.cool.life
|
||||
#HEDGEDOC_VOLUME_NAME=
|
||||
#HEDGEDOC_CONTAINER_NAME=
|
||||
#HEDGEDOC_IMAGE=
|
||||
#NODE_ENV=
|
||||
#CMD_PROTOCOL_USESSL=
|
||||
#CMD_ALLOW_GRAVATAR=
|
||||
#CMD_ALLOW_FREEURL=
|
||||
#CMD_ALLOW_EMAIL_REGISTER=
|
||||
|
||||
##########
|
||||
# POSTGRES
|
||||
|
||||
POSTGRES_USER=user
|
||||
POSTGRES_PASSWORD=password
|
||||
POSTGRES_DB=database
|
||||
#POSTGRES_VOLUME_NAME=
|
||||
#POSTGRES_CONTAINER_NAME=
|
||||
#POSTGRES_IMAGE=
|
||||
|
||||
#########
|
||||
# TRAEFIK
|
||||
|
||||
#TRAEFIK_NETWORK_NAME=
|
||||
#TRAEFIK_ROUTER_NAME=
|
|
@ -0,0 +1,33 @@
|
|||
# HedgeDoc
|
||||
|
||||
> Le meilleur moyen d'écrire et partager votre savoir en markdown.
|
||||
|
||||
## Docker compose
|
||||
|
||||
La configuration est séparé en 3 fichiers :
|
||||
- docker-compose.yml avec le service spécifique à HedgeDoc
|
||||
- docker-compose.traefik.yml avec la configuration spécifique pour Traefik
|
||||
- ../postgres/docker-compose.yml pour la partie base de donnée
|
||||
|
||||
## Configuration
|
||||
|
||||
[De nombreuses variables d'environnement][documentation] peuvent être précisé pour configurer HedgeDoc.
|
||||
|
||||
Modifier les variables dans le fichier `.env`.
|
||||
|
||||
Lancer le service :
|
||||
|
||||
```sh
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
## Liens
|
||||
|
||||
- [Site officiel][website]
|
||||
- [Github][github]
|
||||
- [L'image Docker][docker]
|
||||
|
||||
[website]: https://hedgedoc.org/
|
||||
[docker]: https://hub.docker.com/r/linuxserver/hedgedoc
|
||||
[github]: https://github.com/hedgedoc/hedgedoc
|
||||
[documentation]: https://docs.hedgedoc.org/configuration/
|
|
@ -0,0 +1,13 @@
|
|||
version: "3.8"
|
||||
|
||||
networks:
|
||||
default:
|
||||
name: ${TRAEFIK_NETWORK_NAME:-traefik}
|
||||
|
||||
services:
|
||||
hedgedoc:
|
||||
labels:
|
||||
- traefik.enable=true
|
||||
- traefik.docker.network=${TRAEFIK_NETWORK_NAME:-traefik}
|
||||
- traefik.http.routers.${TRAEFIK_ROUTER_NAME:-hedgedoc}.rule=Host(`${HEDGEDOC_DOMAIN:?err}`)
|
||||
- traefik.http.routers.${TRAEFIK_ROUTER_NAME:-hedgedoc}.entrypoints=web
|
|
@ -0,0 +1,26 @@
|
|||
version: "3.8"
|
||||
|
||||
volumes:
|
||||
hedgedoc:
|
||||
name: ${HEDGEDOC_VOLUME_NAME:-hedgedoc}
|
||||
|
||||
services:
|
||||
hedgedoc:
|
||||
container_name: ${HEDGEDOC_CONTAINER_NAME:-hedgedoc}
|
||||
image: ${HEDGEDOC_IMAGE:-linuxserver/hedgedoc:1.8.2-ls22}
|
||||
restart: always
|
||||
depends_on:
|
||||
- postgres
|
||||
volumes:
|
||||
- hedgedoc:/config
|
||||
- /etc/timezone:/etc/timezone:ro
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
environment:
|
||||
# https://docs.hedgedoc.org/configuration/
|
||||
CMD_DB_URL: postgres://${POSTGRES_USER:?err}:${POSTGRES_PASSWORD:?err}@postgres:${POSTGRES_PORT:-5432}/${POSTGRES_DB:?err}
|
||||
CMD_DOMAIN: ${HEDGEDOC_DOMAIN:?err}
|
||||
NODE_ENV: ${NODE_ENV:-development} # `production` or `development`
|
||||
CMD_PROTOCOL_USESSL: ${CMD_PROTOCOL_USESSL:-false}
|
||||
CMD_ALLOW_GRAVATAR: ${CMD_ALLOW_GRAVATAR:-true}
|
||||
CMD_ALLOW_FREEURL: ${CMD_ALLOW_FREEURL:-false}
|
||||
CMD_ALLOW_EMAIL_REGISTER: ${CMD_ALLOW_EMAIL_REGISTER:-true}
|
|
@ -0,0 +1,47 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -eu
|
||||
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
. $DIR/../help.sh
|
||||
. $DIR/../postgres/run --only-source
|
||||
|
||||
hedgedoc_help() {
|
||||
echo "./run backup : Lancement de la sauvegarde de HedgeDoc"
|
||||
echo "./run restore : Restauration de la sauvegarde de HedgeDoc"
|
||||
}
|
||||
|
||||
hedgedoc_backup() {
|
||||
script_env
|
||||
BACKUP_DATE_DEFAULT=`date +%Y%m%d_%H%M%S`
|
||||
BACKUP_DATE=${BACKUP_DATE:-$BACKUP_DATE_DEFAULT}
|
||||
backup_folder_create
|
||||
|
||||
POSTGRES_BACKUP_FILE=backups/${BACKUP_DATE}_${HEDGEDOC_DOMAIN}_postgres.sql
|
||||
postgres_backup
|
||||
|
||||
docker run -it --rm -v $HOME/backups/${HEDGEDOC_DOMAIN}:/backup --volumes-from hedgedoc alpine:3.12.3 ash -c "cd config && tar cvf /backup/${BACKUP_DATE}_${HEDGEDOC_DOMAIN}_config.tar ."
|
||||
}
|
||||
|
||||
hedgedoc_restore() {
|
||||
script_env
|
||||
|
||||
postgres_restore
|
||||
docker run -it --rm -v $HOME/backups/${HEDGEDOC_DOMAIN}:/backup --volumes-from hedgedoc alpine:3.12.3 ash -c "cd /config && tar xvf /backup/${BACKUP_DATE}_${HEDGEDOC_DOMAIN}_config.tar --strip 1"
|
||||
}
|
||||
|
||||
if [ $# -ge 1 ]; then
|
||||
if [ "${1}" == "backup" ]; then
|
||||
script_start
|
||||
hedgedoc_backup
|
||||
script_end
|
||||
elif [ "${1}" == "restore" ]; then
|
||||
script_start
|
||||
hedgedoc_restore
|
||||
script_end
|
||||
elif [ "${1}" != "--only-source" ]; then
|
||||
hedgedoc_help
|
||||
fi
|
||||
else
|
||||
hedgedoc_help
|
||||
fi
|
Loading…
Reference in New Issue