增加backup.sh

This commit is contained in:
chinky 2018-07-09 09:26:22 +08:00
parent 9cf671eac7
commit b3af48ab95
2 changed files with 17 additions and 2 deletions

15
backup.sh Normal file
View File

@ -0,0 +1,15 @@
#!/bin/bash
# 自动备份时使用以下命令
# /bin/bash /srv/dev-disk-by-label-hd2/docker/gitea/backup.sh
cd $(dirname ${BASH_SOURCE:-$0})
cid=$(docker-compose ps -q gitea)
if [ ${#cid} -gt 0 ]; then
echo "Backuping applications ..."
docker-compose exec -T gitea /bin/bash -c "cd /app/gitea/backup; su git -c \"gitea dump\""
exit 0
else
echo "The container \"gitea\" not running. Please start container \"gitea\""
exit 1
fi

View File

@ -5,7 +5,7 @@ networks:
external: false external: false
services: services:
server: gitea:
image: gitea/gitea:latest image: gitea/gitea:latest
environment: environment:
- APP_NAME='通技的 gitea 服务器' - APP_NAME='通技的 gitea 服务器'
@ -27,7 +27,7 @@ services:
- gitea - gitea
volumes: volumes:
- ./data/gitea:/data - ./data/gitea:/data
- ./data/backup:/backup - ./data/backup:/app/gitea/backup
ports: ports:
- "3000:3000" - "3000:3000"
- "22:22" - "22:22"