docker compose yml and backup script done by crone
This commit is contained in:
19
backup.sh
Executable file
19
backup.sh
Executable file
@@ -0,0 +1,19 @@
|
||||
#!/bin/bash
|
||||
|
||||
DATE=$(date +%F-%H-%M)
|
||||
BACKUP_DIR="/root/gitea/backups"
|
||||
SOURCE_DIR="/root/gitea"
|
||||
|
||||
# Create temp SQL dump
|
||||
docker exec gitea-db mysqldump -u root -prootstrongpassword gitea > $BACKUP_DIR/db-$DATE.sql
|
||||
|
||||
# Create full backup archive
|
||||
tar czf $BACKUP_DIR/gitea-backup-$DATE.tar.gz \
|
||||
-C $SOURCE_DIR \
|
||||
gitea mariadb
|
||||
|
||||
# Optional: remove SQL dump after packing (keeps archive clean)
|
||||
rm $BACKUP_DIR/db-$DATE.sql
|
||||
|
||||
# Cleanup old backups (keep last 7 days)
|
||||
find $BACKUP_DIR -type f -mtime +7 -delete
|
||||
61
docker-compose.yml
Normal file
61
docker-compose.yml
Normal file
@@ -0,0 +1,61 @@
|
||||
services:
|
||||
gitea:
|
||||
image: gitea/gitea:latest
|
||||
container_name: gitea
|
||||
restart: always
|
||||
depends_on:
|
||||
- db
|
||||
environment:
|
||||
- USER_UID=1000
|
||||
- USER_GID=1000
|
||||
|
||||
# Database config
|
||||
- GITEA__database__DB_TYPE=mysql
|
||||
- GITEA__database__HOST=db:3306
|
||||
- GITEA__database__NAME=gitea
|
||||
- GITEA__database__USER=gitea
|
||||
- GITEA__database__PASSWD=strongpassword
|
||||
|
||||
volumes:
|
||||
- ./gitea:/data
|
||||
|
||||
ports:
|
||||
- "3000:3000"
|
||||
- "222:22"
|
||||
|
||||
networks:
|
||||
- gitea
|
||||
|
||||
logging:
|
||||
driver: "json-file"
|
||||
options:
|
||||
max-size: "10m"
|
||||
max-file: "3"
|
||||
|
||||
db:
|
||||
image: mariadb:11
|
||||
container_name: gitea-db
|
||||
restart: always
|
||||
|
||||
environment:
|
||||
- MYSQL_ROOT_PASSWORD=rootstrongpassword
|
||||
- MYSQL_DATABASE=gitea
|
||||
- MYSQL_USER=gitea
|
||||
- MYSQL_PASSWORD=strongpassword
|
||||
|
||||
command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
|
||||
|
||||
volumes:
|
||||
- ./mariadb:/var/lib/mysql
|
||||
|
||||
networks:
|
||||
- gitea
|
||||
|
||||
logging:
|
||||
driver: "json-file"
|
||||
options:
|
||||
max-size: "10m"
|
||||
max-file: "3"
|
||||
|
||||
networks:
|
||||
gitea:
|
||||
Reference in New Issue
Block a user