# Gitea

## backup scripts

from https://gist.github.com/sinbad/4bb771b916fa8facaf340af3fc49ee43

### Backup

`backup_gitea.sh` writes to `/mnt/drive/backups/gitea/`

### Restore
* Requires `7z` (`apt install p7zip-full`)

```bash

#restore_gitea_data.sh [--dry-run] <source_dir> <dest_dir> <sql_file_dest>
 ./restore_gitea_data.sh /srv/dev-disk-by-uuid-45e2e732-9e00-4a82-a7cc-9c743e033671/datastore/gitea data
 ```

## Samples
### Backup
```bash
./backup_gitea.sh
Backing up Gitea data to /mnt/drive/backups/gitea/gitea_backup.zip via gitea:/tmp/gitea_dump_temp.zip
2022/03/23 22:49:30 ...dules/setting/log.go:286:newLogService() [I] Gitea v1.15.8 built with GNU Make 4.3, go1.16.12 : bindata, timetzdata, sqlite, sqlite_unlock_notify
2022/03/23 22:49:30 ...dules/setting/log.go:333:newLogService() [I] Gitea Log Mode: Console(Console:)
2022/03/23 22:49:30 ...dules/setting/log.go:249:generateNamedLogger() [I] Router Log: Console(console:)
2022/03/23 22:49:30 ...les/setting/cache.go:78:newCacheService() [I] Cache Service Enabled
2022/03/23 22:49:30 ...les/setting/cache.go:93:newCacheService() [I] Last Commit Cache Service Enabled
2022/03/23 22:49:30 ...s/setting/session.go:77:newSessionService() [I] Session Service Enabled
2022/03/23 22:49:30 ...es/setting/mailer.go:109:newMailService() [I] Mail Service Enabled
2022/03/23 22:49:30 ...s/storage/storage.go:171:initAttachments() [I] Initialising Attachment storage with type:
2022/03/23 22:49:30 ...les/storage/local.go:47:NewLocalStorage() [I] Creating new Local Storage at /data/gitea/attachments
2022/03/23 22:49:30 ...s/storage/storage.go:165:initAvatars() [I] Initialising Avatar storage with type:
2022/03/23 22:49:30 ...les/storage/local.go:47:NewLocalStorage() [I] Creating new Local Storage at /data/gitea/avatars
2022/03/23 22:49:30 ...s/storage/storage.go:183:initRepoAvatars() [I] Initialising Repository Avatar storage with type:
2022/03/23 22:49:30 ...les/storage/local.go:47:NewLocalStorage() [I] Creating new Local Storage at /data/gitea/repo-avatars
2022/03/23 22:49:30 ...s/storage/storage.go:177:initLFS() [I] Initialising LFS storage with type:
2022/03/23 22:49:30 ...les/storage/local.go:47:NewLocalStorage() [I] Creating new Local Storage at /data/git/lfs
2022/03/23 22:49:30 ...s/storage/storage.go:189:initRepoArchives() [I] Initialising Repository Archive storage with type:
2022/03/23 22:49:30 ...les/storage/local.go:47:NewLocalStorage() [I] Creating new Local Storage at /data/gitea/repo-archive
2022/03/23 22:49:30 cmd/dump.go:221:runDump() [I] Skip dumping local repositories
2022/03/23 22:49:30 cmd/dump.go:267:runDump() [I] Dumping database...
2022/03/23 22:49:30 cmd/dump.go:279:runDump() [I] Adding custom configuration file from /data/gitea/conf/app.ini
2022/03/23 22:49:30 cmd/dump.go:295:runDump() [I] Custom dir /data/gitea is inside data dir /data/gitea, skipped
2022/03/23 22:49:30 cmd/dump.go:307:runDump() [I] Packing data directory.../data/gitea
2022/03/23 22:49:31 cmd/dump.go:352:runDump() [I] Skip dumping log files
Backing up git repositories
Backing up LFS data
Gitea backup completed successfully
```
##Restore
```
todo
```