feat: Update backup commands
This commit is contained in:
parent
0bb2ba32b1
commit
c90d9b0f95
|
@ -8,7 +8,7 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|||
|
||||
codimd_help() {
|
||||
echo "./run backup : Lancement de la sauvegarde de Codimd"
|
||||
echo "./run restore : Restoration de la sauvegarde de Codimd"
|
||||
echo "./run restore : Restauration de la sauvegarde de Codimd"
|
||||
}
|
||||
|
||||
codimd_backup() {
|
||||
|
|
|
@ -12,8 +12,6 @@ TODO
|
|||
|
||||
```sh
|
||||
$ ./run
|
||||
./run backup : Lancement de la sauvegarde de Gitea
|
||||
./run restore : Restoration de la sauvegarde de Gitea
|
||||
```
|
||||
|
||||
## Liens
|
||||
|
|
17
gitea/run
17
gitea/run
|
@ -3,12 +3,14 @@
|
|||
set -eu
|
||||
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
SERVICE_NAME="Gitea"
|
||||
|
||||
. $DIR/../help.sh
|
||||
. $DIR/../postgres/run --only-source
|
||||
|
||||
gitea_help() {
|
||||
echo "./run backup : Lancement de la sauvegarde de Gitea"
|
||||
echo "./run restore : Restoration de la sauvegarde de Gitea"
|
||||
echo "./run backup : Lancement de la sauvegarde de ${SERVICE_NAME}"
|
||||
echo "./run restore : Restauration de la sauvegarde de ${SERVICE_NAME}"
|
||||
}
|
||||
|
||||
gitea_backup() {
|
||||
|
@ -17,18 +19,17 @@ gitea_backup() {
|
|||
BACKUP_DATE=${BACKUP_DATE:-$BACKUP_DATE_DEFAULT}
|
||||
backup_folder_create
|
||||
|
||||
POSTGRES_BACKUP_FILE=backups/${BACKUP_DATE}_gitea_postgres.sql
|
||||
POSTGRES_BACKUP_FILE=backups/${BACKUP_DATE}_${GITEA_DOMAIN}_postgres.sql
|
||||
postgres_backup
|
||||
|
||||
docker-compose run --rm -v $GITEA_VOLUME_NAME:/data -v $HOME/backups/gitea:/backup gitea tar cvf /backup/${BACKUP_DATE}_gitea_data.tar /data
|
||||
docker-compose run --rm -v $GITEA_VOLUME_NAME:/data -v $HOME/backups/gitea:/backup gitea tar cvf /backup/${BACKUP_DATE}_${GITEA_DOMAIN}_data.tar /data
|
||||
}
|
||||
|
||||
gitea_restore() {
|
||||
script_start
|
||||
script_env
|
||||
echo "🏁 Start restore PostgreSQL database '$POSTGRES_DB' from '$POSTGRES_BACKUP_FILE'"
|
||||
cat $POSTGRES_BACKUP_FILE | docker exec -i $POSTGRES_CONTAINER_NAME psql -U $POSTGRES_USER -d $POSTGRES_DB
|
||||
script_end
|
||||
|
||||
postgres_restore
|
||||
docker-compose run --rm -v $GITEA_VOLUME_NAME:/data -v $HOME/backups/gitea:/backup gitea tar xvf /backup/${BACKUP_DATE}_${GITEA_DOMAIN}_data.tar /data --strip 1
|
||||
}
|
||||
|
||||
if [ $# -ge 1 ]; then
|
||||
|
|
|
@ -26,6 +26,7 @@ docker-compose exec --user www-data nextcloud php occ db:add-missing-primary-key
|
|||
- [x] crontab https://docs.nextcloud.com//server/latest/admin_manual/configuration_server/background_jobs_configuration.html#cron
|
||||
- [x] Ajouter un redis : https://www.it-connect.fr/nextcloud-activer-et-configurer-le-cache-redis/
|
||||
- [ ] Ajout des informations SMTP
|
||||
- [ ] Prendre les bonnes pratique sur https://github.com/crazy-max/docker-nextcloud/blob/master/examples/traefik/docker-compose.yml
|
||||
|
||||
[github]: https://github.com/nextcloud/server
|
||||
[documentation]: https://docs.nextcloud.com/server/latest/admin_manual/contents.html
|
||||
|
|
|
@ -44,6 +44,9 @@ services:
|
|||
traefik.docker.network: ${TRAEFIK_NETWORK_NAME}
|
||||
traefik.http.routers.nextcloud.rule: 'Host(`${NEXTCLOUD_DOMAIN}`)'
|
||||
traefik.http.routers.nextcloud.entrypoints: 'web'
|
||||
traefik.http.routers.nextcloud.middlewares: nextcloud_redirect
|
||||
traefik.http.middlewares.nextcloud_redirect.redirectregex.regex: /.well-known/(card|cal)dav
|
||||
traefik.http.middlewares.nextcloud_redirect.redirectregex.replacement: /remote.php/dav/
|
||||
|
||||
nextcloud-postgres:
|
||||
container_name: ${POSTGRES_CONTAINER_NAME}
|
||||
|
|
|
@ -8,7 +8,7 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|||
|
||||
nextcloud_help() {
|
||||
echo "./run backup : Lancement de la sauvegarde de Nextcloud"
|
||||
echo "./run restore : Restoration de la sauvegarde de Nextcloud"
|
||||
echo "./run restore : Restauration de la sauvegarde de Nextcloud"
|
||||
}
|
||||
|
||||
nextcloud_backup() {
|
||||
|
@ -18,6 +18,7 @@ nextcloud_backup() {
|
|||
backup_folder_create
|
||||
|
||||
POSTGRES_BACKUP_FILE=backups/${BACKUP_DATE}_${NEXTCLOUD_DOMAIN}_postgres.sql
|
||||
docker-compose exec --user www-data nextcloud php occ maintenance:mode --on
|
||||
postgres_backup
|
||||
|
||||
docker run -it --rm -v $HOME/backups/${NEXTCLOUD_DOMAIN}:/backup --volumes-from nextcloud alpine:3.12.2 ash -c "cd /var/www/html && tar cvf /backup/${BACKUP_DATE}_${NEXTCLOUD_DOMAIN}_files.tar ."
|
||||
|
|
Loading…
Reference in New Issue