DslrDirector/scripts/README_BACKUP.md
2025-09-29 00:46:38 -07:00

29 lines
1.2 KiB
Markdown

Backup to Gitea
This folder contains a PowerShell script to snapshot the repository and push the snapshot into a Gitea backup repository.
Quick steps
1. On your Gitea server create a repository for backups (for example username/dslr-director-backups). Make it private if desired.
2. Create a personal access token in Gitea for your user with repository push permissions.
3. From the repository root run (PowerShell):
```powershell
$GITEA_URL = 'https://gitea.example.com'
$GITEA_USER = 'youruser'
$GITEA_TOKEN = 'YOUR_TOKEN'
.\scripts\backup_to_gitea.ps1 -GiteaUrl $GITEA_URL -GiteaUser $GITEA_USER -GiteaToken $GITEA_TOKEN -BackupRepo "youruser/dslr-director-backups"
```
What the script does
- Clones the backup repo into a temporary directory (or pulls latest if already present).
- Creates a timestamped folder under `snapshots/` and copies the project files there (skips `.git` and virtual environments).
- Commits and pushes the snapshot to the backup repo using the provided credentials.
Notes
- The script uses `robocopy` for directory copy on Windows. Make sure Git and robocopy are available in PATH.
- The script uses HTTPS pushes with credentials in the URL. Keep your token secret.
- You can schedule this script as a Windows Scheduled Task to run nightly.