feat: nextcloud backup script
This commit is contained in:
6
.gitignore
vendored
6
.gitignore
vendored
@@ -1,5 +1,3 @@
|
|||||||
.env
|
|
||||||
.docker
|
|
||||||
# Created by https://www.toptal.com/developers/gitignore/api/archives
|
# Created by https://www.toptal.com/developers/gitignore/api/archives
|
||||||
# Edit at https://www.toptal.com/developers/gitignore?templates=archives
|
# Edit at https://www.toptal.com/developers/gitignore?templates=archives
|
||||||
|
|
||||||
@@ -38,4 +36,6 @@
|
|||||||
*.txz
|
*.txz
|
||||||
|
|
||||||
# End of https://www.toptal.com/developers/gitignore/api/archives
|
# End of https://www.toptal.com/developers/gitignore/api/archives
|
||||||
|
.env
|
||||||
|
.docker
|
||||||
|
backup/
|
||||||
|
|||||||
6
nextcloud/backup.sh
Executable file
6
nextcloud/backup.sh
Executable file
@@ -0,0 +1,6 @@
|
|||||||
|
source .env
|
||||||
|
CONTAINER_APP=app
|
||||||
|
docker compose exec $CONTAINER_APP ./occ maintenance:mode --on
|
||||||
|
docker compose exec $MYSQL_HOST sh -c "mariadb-dump --single-transaction -h $MYSQL_HOST -u $MYSQL_USER --password=$MYSQL_PASSWORD $MYSQL_DATABASE > backup/nextcloud-sqlbkp_`date +'%Y%m%d'`.bak" \
|
||||||
|
&& echo "SQL dump saved"
|
||||||
|
docker compose exec $CONTAINER_APP ./occ maintenance:mode --off
|
||||||
@@ -5,11 +5,12 @@ services:
|
|||||||
command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
|
command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
|
||||||
volumes:
|
volumes:
|
||||||
- ./db:/var/lib/mysql
|
- ./db:/var/lib/mysql
|
||||||
|
- ./backup:/backup
|
||||||
env_file:
|
env_file:
|
||||||
- env
|
- .env
|
||||||
|
|
||||||
app:
|
app:
|
||||||
image: nextcloud
|
image: nextcloud:stable
|
||||||
restart: always
|
restart: always
|
||||||
ports:
|
ports:
|
||||||
- 50000:80
|
- 50000:80
|
||||||
@@ -18,4 +19,4 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- ./nextcloud:/var/www/html
|
- ./nextcloud:/var/www/html
|
||||||
env_file:
|
env_file:
|
||||||
- env
|
- .env
|
||||||
|
|||||||
Reference in New Issue
Block a user