Add comprehensive backup system for Gitea database
This commit is contained in:
56
README.md
56
README.md
@@ -16,6 +16,7 @@ This is a Docker Compose configuration for running Gitea with PostgreSQL, config
|
||||
- SSH access for Git operations
|
||||
- Persistent data storage
|
||||
- Self-signed SSL certificates (can be replaced with Let's Encrypt)
|
||||
- Automated database backup system
|
||||
|
||||
## Configuration
|
||||
|
||||
@@ -96,6 +97,51 @@ Replace `your.domain.here` with your actual domain name.
|
||||
- For production use, consider using Let's Encrypt certificates
|
||||
- Self-signed certificates will show browser security warnings
|
||||
|
||||
## Backup System
|
||||
|
||||
This setup includes a comprehensive backup strategy to ensure your Gitea data is always protected. The backup system provides two complementary methods:
|
||||
|
||||
### Database Backups
|
||||
|
||||
PowerShell scripts are included to manage database backups:
|
||||
|
||||
1. **Creating Backups**:
|
||||
```powershell
|
||||
powershell -ExecutionPolicy Bypass -File .\backup-gitea-db.ps1
|
||||
```
|
||||
This creates a SQL dump of your PostgreSQL database, compressed as a ZIP file in the `backups` directory.
|
||||
|
||||
2. **Volume Backups**:
|
||||
```powershell
|
||||
powershell -ExecutionPolicy Bypass -File .\backup-volume.ps1
|
||||
```
|
||||
This backs up the entire PostgreSQL data volume as a TAR archive, compressed as a ZIP file.
|
||||
|
||||
3. **Automated Backups**:
|
||||
```powershell
|
||||
powershell -ExecutionPolicy Bypass -File .\schedule-backup.ps1
|
||||
```
|
||||
This creates a Windows Scheduled Task that runs database backups daily at 3 AM.
|
||||
|
||||
4. **Restoring from Backups**:
|
||||
```powershell
|
||||
# Restore from database dump
|
||||
powershell -ExecutionPolicy Bypass -File .\restore-gitea-db.ps1 -BackupFile "backups\your-backup-file.sql.zip"
|
||||
|
||||
# Restore from volume backup
|
||||
powershell -ExecutionPolicy Bypass -File .\restore-volume.ps1 -BackupFile "backups\your-volume-backup.tar.zip"
|
||||
```
|
||||
|
||||
### Backup Best Practices
|
||||
|
||||
- Keep multiple backups using both methods (database dumps and volume backups)
|
||||
- Store backups in multiple locations (local and off-site)
|
||||
- Test restoring from backups periodically
|
||||
- Create a backup before upgrading Gitea or making significant changes
|
||||
- **Never** run `docker-compose down -v` unless you have a recent backup
|
||||
|
||||
For more detailed information about the backup system, see [BACKUP-README.md](BACKUP-README.md).
|
||||
|
||||
## Stopping the Services
|
||||
|
||||
To stop the services, run:
|
||||
@@ -103,6 +149,8 @@ To stop the services, run:
|
||||
docker-compose down
|
||||
```
|
||||
|
||||
**Important**: Do not use the `-v` flag (`docker-compose down -v`) unless you intend to delete all data, as this will remove the Docker volumes containing your database.
|
||||
|
||||
## Data Persistence
|
||||
|
||||
All data is stored in Docker volumes and local directories:
|
||||
@@ -112,6 +160,7 @@ All data is stored in Docker volumes and local directories:
|
||||
- Docker volumes (managed by Docker):
|
||||
- `gitea-data` - Gitea repositories and application data
|
||||
- `postgres-data` - PostgreSQL database files
|
||||
- `./backups/` - Database and volume backups
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
@@ -126,4 +175,9 @@ All data is stored in Docker volumes and local directories:
|
||||
|
||||
3. **Local Network Access**:
|
||||
- If bee8333.ddns.net doesn't resolve locally, use localhost:3000 instead
|
||||
- Add an entry to your hosts file if needed
|
||||
- Add an entry to your hosts file if needed
|
||||
|
||||
4. **Database Backup Issues**:
|
||||
- Ensure Docker is running when attempting backups
|
||||
- Check that the container names match those in the backup scripts
|
||||
- For PowerShell execution issues, use the `-ExecutionPolicy Bypass` flag
|
||||
Reference in New Issue
Block a user