gitea: add config
This commit is contained in:
parent
fe35e4baf1
commit
56faa4323b
17 changed files with 354 additions and 13 deletions
40
roles/gitea/files/compose.yml
Normal file
40
roles/gitea/files/compose.yml
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
version: '3'
|
||||
|
||||
services:
|
||||
app:
|
||||
# Latest contains a development version
|
||||
image: 'gitea/gitea:1.20.1'
|
||||
restart: 'always'
|
||||
|
||||
ports:
|
||||
- '22:22'
|
||||
- '8010:3000'
|
||||
volumes:
|
||||
- '/etc/gitea/app.ini:/data/gitea/conf/app.ini'
|
||||
- '/mnt/data1/gitea/data:/data'
|
||||
- '/mnt/data1/gitea/repositories:/data/git/repositories'
|
||||
- '/mnt/data1/gitea/lfs:/data/git/lfs'
|
||||
- '/etc/timezone:/etc/timezone:ro'
|
||||
- '/etc/localtime:/etc/localtime:ro'
|
||||
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
|
||||
db:
|
||||
image: 'postgres:14.8-alpine'
|
||||
restart: 'always'
|
||||
|
||||
healthcheck:
|
||||
test: ["CMD", "pg_isready", "-U", "gitea"]
|
||||
interval: 30s
|
||||
start_period: 30s
|
||||
timeout: 5s
|
||||
retries: 3
|
||||
|
||||
environment:
|
||||
- 'POSTGRES_USER=gitea'
|
||||
- 'POSTGRES_PASSWORD=gitea'
|
||||
- 'POSTGRES_DB=gitea'
|
||||
volumes:
|
||||
- '/mnt/data1/gitea/postgres:/var/lib/postgresql/data'
|
||||
12
roles/gitea/files/gitea.data.backup.sh
Normal file
12
roles/gitea/files/gitea.data.backup.sh
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
data_dir='/mnt/data1/gitea/data'
|
||||
snapshot_dir="${data_dir}.snapshot"
|
||||
|
||||
# Read-only snapshot for atomic backup
|
||||
btrfs subvolume snapshot -r "$data_dir" "$snapshot_dir" || exit $?
|
||||
|
||||
/usr/local/bin/restic backup "$snapshot_dir"
|
||||
|
||||
# Always remove snapshot subvolume, even if restic fails
|
||||
btrfs subvolume delete "$snapshot_dir"
|
||||
12
roles/gitea/files/gitea.lfs.backup.sh
Normal file
12
roles/gitea/files/gitea.lfs.backup.sh
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
data_dir='/mnt/data1/gitea/lfs'
|
||||
snapshot_dir="${data_dir}.snapshot"
|
||||
|
||||
# Read-only snapshot for atomic backup
|
||||
btrfs subvolume snapshot -r "$data_dir" "$snapshot_dir" || exit $?
|
||||
|
||||
/usr/local/bin/restic backup "$snapshot_dir"
|
||||
|
||||
# Always remove snapshot subvolume, even if restic fails
|
||||
btrfs subvolume delete "$snapshot_dir"
|
||||
7
roles/gitea/files/gitea.postgres.backup.sh
Normal file
7
roles/gitea/files/gitea.postgres.backup.sh
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
cd /etc/gitea
|
||||
|
||||
/usr/bin/docker compose exec -T db pg_dump -U gitea gitea |
|
||||
/usr/bin/gzip --rsyncable |
|
||||
/usr/local/bin/restic backup --stdin --stdin-filename gitea-postgres.sql.gz
|
||||
12
roles/gitea/files/gitea.repositories.backup.sh
Normal file
12
roles/gitea/files/gitea.repositories.backup.sh
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
data_dir='/mnt/data1/gitea/repositories'
|
||||
snapshot_dir="${data_dir}.snapshot"
|
||||
|
||||
# Read-only snapshot for atomic backup
|
||||
btrfs subvolume snapshot -r "$data_dir" "$snapshot_dir" || exit $?
|
||||
|
||||
/usr/local/bin/restic backup "$snapshot_dir"
|
||||
|
||||
# Always remove snapshot subvolume, even if restic fails
|
||||
btrfs subvolume delete "$snapshot_dir"
|
||||
15
roles/gitea/files/gitea.service
Normal file
15
roles/gitea/files/gitea.service
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
[Unit]
|
||||
Description=Private, Fast, Reliable DevOps Platform
|
||||
After=docker.target
|
||||
Requires=docker.target
|
||||
|
||||
[Service]
|
||||
Type=exec
|
||||
User=gitea
|
||||
Group=gitea
|
||||
WorkingDirectory=/etc/gitea
|
||||
ExecStart=/usr/bin/docker compose up
|
||||
ExecStop=/usr/bin/docker compose down
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
Loading…
Add table
Add a link
Reference in a new issue