Initial commit

This commit is contained in:
bmen 2019-10-01 22:05:49 +02:00
commit 434bd5f277
2 changed files with 56 additions and 0 deletions

22
backup.sh Normal file
View File

@ -0,0 +1,22 @@
#!/bin/bash
#Löscht alle "*.tar.gz" und "*.sql" Dateien die älter als 14 Tage sind:
find -P "/mnt/storage-bx20/data-nextcloud/bmen/files/Server/Hetzner-Cloud-CX21/Gitea/" -maxdepth 1 -type f \( -name '*.tar.gz' \) -ctime +14 -exec rm {} \;
find -P "/mnt/storage-bx20/data-nextcloud/bmen/files/Server/Hetzner-Cloud-CX21/Gitea/" -maxdepth 1 -type f \( -name '*.sql' \) -ctime +14 -exec rm {} \;
#Zur Sicherheit noch einen SQL-Dump der Datenbank
docker exec -i bmen-gitea-db -ugitea -pgitea gitea > /mnt/storage-bx20/data-nextcloud/bmen/files/Server/Hetzner-Cloud-CX21/Gitea/gitea-`date '+%Y%m%d%H%M'`.sql
#Die Docker Container stoppen und die Datenverzeichnisse komprimieren und wegkopieren
cd /root/deployments/gitea/
docker-compose stop
cd /opt/appdata/
tar cvf /mnt/storage-bx20/data-nextcloud/bmen/files/Server/Hetzner-Cloud-CX21/Gitea/gitea-`date '+%Y%m%d%H%M'`.tar.gz nextcloud/
#Docker Container aktualisieren und starten
cd /root/deployments/gitea/
docker-compose pull
docker-compose start
#Nextcloud Datenbank über die Dateiänderung Bescheid geben
docker exec --user www-data nextcloud php occ files:scan -p bmen/files/Server/Hetzner-Cloud-CX21/Gitea/

34
docker-compose.yml Normal file
View File

@ -0,0 +1,34 @@
version: "2"
services:
server:
image: gitea/gitea:latest
environment:
- USER_UID=1000
- USER_GID=1000
- DB_TYPE=mysql
- DB_HOST=db:3306
- DB_NAME=gitea
- DB_USER=gitea
- DB_PASSWD=gitea
restart: always
volumes:
- /opt/appdata/gitea/data:/data
ports:
- "3000:3000"
- "222:22"
container_name: bmen-gitea
depends_on:
- db
db:
image: mysql:5.7
restart: always
environment:
- MYSQL_ROOT_PASSWORD=gitea
- MYSQL_USER=gitea
- MYSQL_PASSWORD=gitea
- MYSQL_DATABASE=gitea
container_name: bmen-gitea-db
volumes:
- /opt/appdata/gitea/mysql:/var/lib/mysql