Compare commits
5 Commits
fc5e9c1294
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 6a34f34b51 | |||
| 6695ad06a6 | |||
| cba5e8167b | |||
| 5f329bc7e3 | |||
| f461f47e9f |
81
HTTPS-SETUP.md
Normal file
81
HTTPS-SETUP.md
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
# Setting Up HTTPS for Gitea with Traefik
|
||||||
|
|
||||||
|
This guide explains how to configure Gitea with proper HTTPS using Traefik as a reverse proxy with automatic certificate management via Let's Encrypt.
|
||||||
|
|
||||||
|
## Prerequisites
|
||||||
|
|
||||||
|
- A domain name pointing to your server (currently using `bee8333.ddns.net`)
|
||||||
|
- Ports 80 and 443 open and forwarded to your server
|
||||||
|
- Docker and Docker Compose installed
|
||||||
|
|
||||||
|
## Configuration Steps
|
||||||
|
|
||||||
|
1. **Update email address in docker-compose.yml**
|
||||||
|
|
||||||
|
Edit the `docker-compose.yml` file and replace `your-email@example.com` with your actual email address. Let's Encrypt will use this for certificate expiration notifications:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
--certificatesresolvers.letsencrypt.acme.email=your-email@example.com
|
||||||
|
```
|
||||||
|
|
||||||
|
2. **Start the services**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker-compose down
|
||||||
|
docker-compose up -d
|
||||||
|
```
|
||||||
|
|
||||||
|
3. **Check the status**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker-compose ps
|
||||||
|
```
|
||||||
|
|
||||||
|
All services should be running without errors.
|
||||||
|
|
||||||
|
## How It Works
|
||||||
|
|
||||||
|
- **Traefik** acts as a reverse proxy, handling incoming HTTP/HTTPS traffic
|
||||||
|
- Automatically redirects HTTP to HTTPS
|
||||||
|
- Obtains and renews SSL certificates from Let's Encrypt
|
||||||
|
- Routes requests to the appropriate containers based on domain name
|
||||||
|
|
||||||
|
## Troubleshooting
|
||||||
|
|
||||||
|
If you encounter issues:
|
||||||
|
|
||||||
|
1. **Check Traefik logs**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker-compose logs traefik
|
||||||
|
```
|
||||||
|
|
||||||
|
2. **Check Gitea logs**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker-compose logs server
|
||||||
|
```
|
||||||
|
|
||||||
|
3. **Verify DNS settings**
|
||||||
|
|
||||||
|
Make sure your domain (`bee8333.ddns.net`) correctly points to your server's IP address.
|
||||||
|
|
||||||
|
4. **Check firewall settings**
|
||||||
|
|
||||||
|
Ensure ports 80 and 443 are open and properly forwarded to your server.
|
||||||
|
|
||||||
|
## Git Client Configuration
|
||||||
|
|
||||||
|
When pushing to your Gitea repository from your local machine, you'll now be using HTTPS with a valid certificate. Use the following URL format:
|
||||||
|
|
||||||
|
```
|
||||||
|
https://bee8333.ddns.net/username/repository.git
|
||||||
|
```
|
||||||
|
|
||||||
|
## SSH Access
|
||||||
|
|
||||||
|
SSH access is still available on port 222. Use the following format in your SSH config or Git command:
|
||||||
|
|
||||||
|
```
|
||||||
|
ssh://git@bee8333.ddns.net:222/username/repository.git
|
||||||
|
```
|
||||||
@@ -1,32 +1,82 @@
|
|||||||
# Gitea Database Backup Script
|
# Gitea Database Backup Script
|
||||||
$timestamp = Get-Date -Format "yyyy-MM-dd_HH-mm-ss"
|
$timestamp = Get-Date -Format "yyyy-MM-dd_HH-mm-ss"
|
||||||
$backupDir = ".\backups"
|
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||||
$backupFile = "$backupDir\gitea-db-backup-$timestamp.sql"
|
$backupDir = Join-Path $scriptDir "backups"
|
||||||
|
$backupFile = Join-Path $backupDir "gitea-db-backup-$timestamp.sql"
|
||||||
|
$redundantBackupDir = "D:\Pr00jects\gitea-docker"
|
||||||
|
|
||||||
# Ensure backup directory exists
|
# Ensure backup directory exists
|
||||||
if (-not (Test-Path $backupDir)) {
|
if (-not (Test-Path $backupDir)) {
|
||||||
New-Item -ItemType Directory -Path $backupDir
|
New-Item -ItemType Directory -Path $backupDir
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Ensure redundant backup directory exists
|
||||||
|
if (-not (Test-Path $redundantBackupDir)) {
|
||||||
|
try {
|
||||||
|
New-Item -ItemType Directory -Path $redundantBackupDir -Force
|
||||||
|
} catch {
|
||||||
|
"[$timestamp] Warning: Could not create redundant backup directory at $redundantBackupDir. Error: $_" | Out-File -Append -FilePath $logFile
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Log execution of the script
|
||||||
|
$logFile = Join-Path $backupDir "backup-log.txt"
|
||||||
|
"[$timestamp] Starting database backup..." | Out-File -Append -FilePath $logFile
|
||||||
|
|
||||||
|
# Check if Docker is running
|
||||||
|
$dockerRunning = $false
|
||||||
|
try {
|
||||||
|
$dockerStatus = docker info 2>&1
|
||||||
|
$dockerRunning = $LASTEXITCODE -eq 0
|
||||||
|
} catch {
|
||||||
|
$dockerRunning = $false
|
||||||
|
}
|
||||||
|
|
||||||
|
if (-not $dockerRunning) {
|
||||||
|
"[$timestamp] Error: Docker is not running. Backup failed." | Out-File -Append -FilePath $logFile
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Check if Gitea container is running
|
||||||
|
$containerRunning = docker ps --format "{{.Names}}" | Select-String -Pattern "gitea-db" -Quiet
|
||||||
|
if (-not $containerRunning) {
|
||||||
|
"[$timestamp] Error: Gitea database container is not running. Backup failed." | Out-File -Append -FilePath $logFile
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
# Create database dump
|
# Create database dump
|
||||||
Write-Host "Creating database backup to $backupFile..."
|
"[$timestamp] Creating database backup to $backupFile..." | Out-File -Append -FilePath $logFile
|
||||||
docker exec gitea-db pg_dump -U gitea -d gitea > $backupFile
|
docker exec gitea-db pg_dump -U gitea -d gitea > $backupFile
|
||||||
|
|
||||||
# Check if backup was successful
|
# Check if backup was successful
|
||||||
if ($LASTEXITCODE -eq 0 -and (Test-Path $backupFile) -and (Get-Item $backupFile).Length -gt 0) {
|
if ($LASTEXITCODE -eq 0 -and (Test-Path $backupFile) -and (Get-Item $backupFile).Length -gt 0) {
|
||||||
Write-Host "Backup completed successfully!"
|
"[$timestamp] Backup completed successfully!" | Out-File -Append -FilePath $logFile
|
||||||
|
|
||||||
# Optional: Compress the backup file
|
# Optional: Compress the backup file
|
||||||
Compress-Archive -Path $backupFile -DestinationPath "$backupFile.zip" -Force
|
$zipFileName = "$backupFile.zip"
|
||||||
|
Compress-Archive -Path $backupFile -DestinationPath $zipFileName -Force
|
||||||
Remove-Item $backupFile
|
Remove-Item $backupFile
|
||||||
Write-Host "Backup compressed to $backupFile.zip"
|
"[$timestamp] Backup compressed to $zipFileName" | Out-File -Append -FilePath $logFile
|
||||||
|
|
||||||
|
# Copy backup to redundant location
|
||||||
|
if (Test-Path $redundantBackupDir) {
|
||||||
|
try {
|
||||||
|
$redundantBackupFile = Join-Path $redundantBackupDir (Split-Path -Leaf $zipFileName)
|
||||||
|
Copy-Item -Path $zipFileName -Destination $redundantBackupFile -Force
|
||||||
|
"[$timestamp] Backup copied to redundant location: $redundantBackupFile" | Out-File -Append -FilePath $logFile
|
||||||
|
} catch {
|
||||||
|
"[$timestamp] Error copying backup to redundant location: $_" | Out-File -Append -FilePath $logFile
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Write-Host "Backup failed!" -ForegroundColor Red
|
"[$timestamp] Warning: Redundant backup directory not found: $redundantBackupDir" | Out-File -Append -FilePath $logFile
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
"[$timestamp] Backup failed!" | Out-File -Append -FilePath $logFile
|
||||||
}
|
}
|
||||||
|
|
||||||
# Optional: Clean up old backups (keep last 10)
|
# Optional: Clean up old backups (keep last 10)
|
||||||
$oldBackups = Get-ChildItem -Path $backupDir -Filter "gitea-db-backup-*.zip" | Sort-Object LastWriteTime -Descending | Select-Object -Skip 10
|
$oldBackups = Get-ChildItem -Path $backupDir -Filter "gitea-db-backup-*.zip" | Sort-Object LastWriteTime -Descending | Select-Object -Skip 10
|
||||||
foreach ($backup in $oldBackups) {
|
foreach ($backup in $oldBackups) {
|
||||||
Remove-Item $backup.FullName
|
Remove-Item $backup.FullName
|
||||||
Write-Host "Removed old backup: $($backup.Name)"
|
"[$timestamp] Removed old backup: $($backup.Name)" | Out-File -Append -FilePath $logFile
|
||||||
}
|
}
|
||||||
@@ -1,36 +1,82 @@
|
|||||||
# Script to backup the entire Postgres Docker volume
|
# Script to backup the entire Postgres Docker volume
|
||||||
$timestamp = Get-Date -Format "yyyy-MM-dd_HH-mm-ss"
|
$timestamp = Get-Date -Format "yyyy-MM-dd_HH-mm-ss"
|
||||||
$backupDir = ".\backups"
|
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||||
|
$backupDir = Join-Path $scriptDir "backups"
|
||||||
$volumeName = "gitea-docker_postgres-data"
|
$volumeName = "gitea-docker_postgres-data"
|
||||||
$backupFile = "$backupDir\postgres-volume-backup-$timestamp.tar"
|
$backupFile = "postgres-volume-backup-$timestamp.tar"
|
||||||
|
$backupFilePath = Join-Path $backupDir $backupFile
|
||||||
|
$redundantBackupDir = "D:\Pr00jects\gitea-docker"
|
||||||
|
$logFile = Join-Path $backupDir "volume-backup-log.txt"
|
||||||
|
$currentDir = Get-Location
|
||||||
|
|
||||||
# Ensure backup directory exists
|
# Ensure backup directory exists
|
||||||
if (-not (Test-Path $backupDir)) {
|
if (-not (Test-Path $backupDir)) {
|
||||||
New-Item -ItemType Directory -Path $backupDir
|
New-Item -ItemType Directory -Path $backupDir
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Ensure redundant backup directory exists
|
||||||
|
if (-not (Test-Path $redundantBackupDir)) {
|
||||||
|
try {
|
||||||
|
New-Item -ItemType Directory -Path $redundantBackupDir -Force
|
||||||
|
} catch {
|
||||||
|
Add-Content -Path $logFile -Value "[$timestamp] Warning: Could not create redundant backup directory at $redundantBackupDir. Error: $_"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Log start of backup
|
||||||
|
Add-Content -Path $logFile -Value "[$timestamp] Starting volume backup for $volumeName..."
|
||||||
|
|
||||||
# Check if volume exists
|
# Check if volume exists
|
||||||
$volumeExists = docker volume ls --format "{{.Name}}" | Select-String -Pattern "^$volumeName$"
|
$volumeExists = docker volume ls --format "{{.Name}}" | Select-String -Pattern "^$volumeName$"
|
||||||
if (-not $volumeExists) {
|
if (-not $volumeExists) {
|
||||||
Write-Host "Volume $volumeName not found!" -ForegroundColor Red
|
Write-Host "Volume $volumeName not found!" -ForegroundColor Red
|
||||||
|
Add-Content -Path $logFile -Value "[$timestamp] Error: Volume $volumeName not found!"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
# Create a temporary container to access the volume
|
# Create a temporary container to access the volume
|
||||||
Write-Host "Creating backup of Docker volume $volumeName..."
|
Write-Host "Creating backup of Docker volume $volumeName..."
|
||||||
docker run --rm -v ${volumeName}:/volume -v ${PWD}/${backupDir}:/backup alpine tar -cf /backup/$(Split-Path $backupFile -Leaf) -C /volume ./
|
Add-Content -Path $logFile -Value "[$timestamp] Creating backup to $backupFilePath..."
|
||||||
|
|
||||||
|
# Change to backup directory and use simple relative paths for Docker
|
||||||
|
Set-Location -Path $backupDir
|
||||||
|
docker run --rm -v ${volumeName}:/volume -v ${PWD}:/backup alpine tar -cf /backup/$backupFile -C /volume ./
|
||||||
|
|
||||||
|
# Restore original directory
|
||||||
|
Set-Location -Path $currentDir
|
||||||
|
|
||||||
# Check if backup was successful
|
# Check if backup was successful
|
||||||
if ($LASTEXITCODE -eq 0 -and (Test-Path $backupFile) -and (Get-Item $backupFile).Length -gt 0) {
|
if ($LASTEXITCODE -eq 0 -and (Test-Path $backupFilePath) -and (Get-Item $backupFilePath).Length -gt 0) {
|
||||||
Write-Host "Volume backup completed successfully to $backupFile!" -ForegroundColor Green
|
Write-Host "Volume backup completed successfully to $backupFilePath!" -ForegroundColor Green
|
||||||
|
Add-Content -Path $logFile -Value "[$timestamp] Volume backup completed successfully!"
|
||||||
|
|
||||||
# Optional: Compress the backup file
|
# Optional: Compress the backup file
|
||||||
Write-Host "Compressing backup file..."
|
Write-Host "Compressing backup file..."
|
||||||
Compress-Archive -Path $backupFile -DestinationPath "$backupFile.zip" -Force
|
Add-Content -Path $logFile -Value "[$timestamp] Compressing backup file..."
|
||||||
Remove-Item $backupFile
|
$zipFileName = "$backupFilePath.zip"
|
||||||
Write-Host "Backup compressed to $backupFile.zip" -ForegroundColor Green
|
Compress-Archive -Path $backupFilePath -DestinationPath $zipFileName -Force
|
||||||
|
Remove-Item $backupFilePath
|
||||||
|
Write-Host "Backup compressed to $zipFileName" -ForegroundColor Green
|
||||||
|
Add-Content -Path $logFile -Value "[$timestamp] Backup compressed to $zipFileName"
|
||||||
|
|
||||||
|
# Copy backup to redundant location
|
||||||
|
if (Test-Path $redundantBackupDir) {
|
||||||
|
try {
|
||||||
|
$redundantBackupFile = Join-Path $redundantBackupDir (Split-Path -Leaf $zipFileName)
|
||||||
|
Copy-Item -Path $zipFileName -Destination $redundantBackupFile -Force
|
||||||
|
Write-Host "Backup copied to redundant location: $redundantBackupFile" -ForegroundColor Green
|
||||||
|
Add-Content -Path $logFile -Value "[$timestamp] Backup copied to redundant location: $redundantBackupFile"
|
||||||
|
} catch {
|
||||||
|
Write-Host "Error copying backup to redundant location: $_" -ForegroundColor Red
|
||||||
|
Add-Content -Path $logFile -Value "[$timestamp] Error copying backup to redundant location: $_"
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Write-Host "Warning: Redundant backup directory not found: $redundantBackupDir" -ForegroundColor Yellow
|
||||||
|
Add-Content -Path $logFile -Value "[$timestamp] Warning: Redundant backup directory not found: $redundantBackupDir"
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Write-Host "Volume backup failed!" -ForegroundColor Red
|
Write-Host "Volume backup failed!" -ForegroundColor Red
|
||||||
|
Add-Content -Path $logFile -Value "[$timestamp] Volume backup failed!"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Optional: Clean up old volume backups (keep last 5)
|
# Optional: Clean up old volume backups (keep last 5)
|
||||||
@@ -38,4 +84,5 @@ $oldBackups = Get-ChildItem -Path $backupDir -Filter "postgres-volume-backup-*.z
|
|||||||
foreach ($backup in $oldBackups) {
|
foreach ($backup in $oldBackups) {
|
||||||
Remove-Item $backup.FullName
|
Remove-Item $backup.FullName
|
||||||
Write-Host "Removed old volume backup: $($backup.Name)"
|
Write-Host "Removed old volume backup: $($backup.Name)"
|
||||||
|
Add-Content -Path $logFile -Value "[$timestamp] Removed old volume backup: $($backup.Name)"
|
||||||
}
|
}
|
||||||
BIN
backups/backup-log.txt
Normal file
BIN
backups/backup-log.txt
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
backups/gitea-db-backup-2025-04-21_03-03-47.sql.zip
Normal file
BIN
backups/gitea-db-backup-2025-04-21_03-03-47.sql.zip
Normal file
Binary file not shown.
BIN
backups/gitea-db-backup-2025-04-22_03-07-16.sql.zip
Normal file
BIN
backups/gitea-db-backup-2025-04-22_03-07-16.sql.zip
Normal file
Binary file not shown.
BIN
backups/gitea-db-backup-2025-04-23_03-00-49.sql.zip
Normal file
BIN
backups/gitea-db-backup-2025-04-23_03-00-49.sql.zip
Normal file
Binary file not shown.
BIN
backups/gitea-db-backup-2025-04-25_19-01-37.sql
Normal file
BIN
backups/gitea-db-backup-2025-04-25_19-01-37.sql
Normal file
Binary file not shown.
BIN
backups/gitea-db-backup-2025-05-18_01-16-38.sql.zip
Normal file
BIN
backups/gitea-db-backup-2025-05-18_01-16-38.sql.zip
Normal file
Binary file not shown.
BIN
backups/gitea-db-backup-2025-05-18_03-00-05.sql.zip
Normal file
BIN
backups/gitea-db-backup-2025-05-18_03-00-05.sql.zip
Normal file
Binary file not shown.
BIN
backups/gitea-db-backup-2025-05-19_03-00-05.sql.zip
Normal file
BIN
backups/gitea-db-backup-2025-05-19_03-00-05.sql.zip
Normal file
Binary file not shown.
BIN
backups/gitea-db-backup-2025-05-20_03-00-53.sql.zip
Normal file
BIN
backups/gitea-db-backup-2025-05-20_03-00-53.sql.zip
Normal file
Binary file not shown.
BIN
backups/gitea-db-backup-2025-05-21_03-03-22.sql.zip
Normal file
BIN
backups/gitea-db-backup-2025-05-21_03-03-22.sql.zip
Normal file
Binary file not shown.
BIN
backups/gitea-db-backup-2025-05-22_03-03-36.sql.zip
Normal file
BIN
backups/gitea-db-backup-2025-05-22_03-03-36.sql.zip
Normal file
Binary file not shown.
BIN
backups/gitea-db-backup-2025-05-23_03-21-26.sql
Normal file
BIN
backups/gitea-db-backup-2025-05-23_03-21-26.sql
Normal file
Binary file not shown.
BIN
backups/gitea-db-backup-2025-05-28_02-42-28.sql
Normal file
BIN
backups/gitea-db-backup-2025-05-28_02-42-28.sql
Normal file
Binary file not shown.
BIN
backups/gitea-db-backup-2025-06-09_21-22-55.sql.zip
Normal file
BIN
backups/gitea-db-backup-2025-06-09_21-22-55.sql.zip
Normal file
Binary file not shown.
Binary file not shown.
BIN
backups/postgres-volume-backup-2025-05-19_03-00-14.tar.zip
Normal file
BIN
backups/postgres-volume-backup-2025-05-19_03-00-14.tar.zip
Normal file
Binary file not shown.
BIN
backups/postgres-volume-backup-2025-05-20_03-14-23.tar.zip
Normal file
BIN
backups/postgres-volume-backup-2025-05-20_03-14-23.tar.zip
Normal file
Binary file not shown.
BIN
backups/postgres-volume-backup-2025-05-21_03-08-24.tar.zip
Normal file
BIN
backups/postgres-volume-backup-2025-05-21_03-08-24.tar.zip
Normal file
Binary file not shown.
BIN
backups/postgres-volume-backup-2025-05-22_03-03-49.tar.zip
Normal file
BIN
backups/postgres-volume-backup-2025-05-22_03-03-49.tar.zip
Normal file
Binary file not shown.
BIN
backups/postgres-volume-backup-2025-05-23_08-01-05.tar
Normal file
BIN
backups/postgres-volume-backup-2025-05-23_08-01-05.tar
Normal file
Binary file not shown.
BIN
backups/postgres-volume-backup-2025-06-09_21-30-15.tar.zip
Normal file
BIN
backups/postgres-volume-backup-2025-06-09_21-30-15.tar.zip
Normal file
Binary file not shown.
BIN
backups/postgres-volume-backup.tar
Normal file
BIN
backups/postgres-volume-backup.tar
Normal file
Binary file not shown.
104
backups/volume-backup-log.txt
Normal file
104
backups/volume-backup-log.txt
Normal file
@@ -0,0 +1,104 @@
|
|||||||
|
[2025-04-19_19-40-51] Starting volume backup for gitea-docker_postgres-data...
|
||||||
|
[2025-04-19_19-40-51] Creating backup to C:\Users\benne\Projects\gitea-docker\backups\postgres-volume-backup-2025-04-19_19-40-51.tar...
|
||||||
|
[2025-04-19_19-40-51] Volume backup failed!
|
||||||
|
[2025-04-19_19-41-05] Starting volume backup for gitea-docker_postgres-data...
|
||||||
|
[2025-04-19_19-41-05] Creating backup to C:\Users\benne\Projects\gitea-docker\backups\postgres-volume-backup-2025-04-19_19-41-05.tar...
|
||||||
|
[2025-04-19_19-41-05] Volume backup failed!
|
||||||
|
[2025-04-19_19-42-55] Starting volume backup for gitea-docker_postgres-data...
|
||||||
|
[2025-04-19_19-42-55] Creating backup to C:\Users\benne\Projects\gitea-docker\backups\postgres-volume-backup-2025-04-19_19-42-55.tar...
|
||||||
|
[2025-04-19_19-42-55] Volume backup completed successfully!
|
||||||
|
[2025-04-19_19-42-55] Compressing backup file...
|
||||||
|
[2025-04-19_19-42-55] Backup compressed to C:\Users\benne\Projects\gitea-docker\backups\postgres-volume-backup-2025-04-19_19-42-55.tar.zip
|
||||||
|
[2025-04-19_19-42-55] Backup copied to redundant location: D:\Pr00jects\gitea-docker\postgres-volume-backup-2025-04-19_19-42-55.tar.zip
|
||||||
|
[2025-04-19_19-43-53] Starting volume backup for gitea-docker_postgres-data...
|
||||||
|
[2025-04-19_19-43-53] Creating backup to C:\Users\benne\Projects\gitea-docker\backups\postgres-volume-backup-2025-04-19_19-43-53.tar...
|
||||||
|
[2025-04-19_19-43-53] Volume backup completed successfully!
|
||||||
|
[2025-04-19_19-43-53] Compressing backup file...
|
||||||
|
[2025-04-19_19-43-53] Backup compressed to C:\Users\benne\Projects\gitea-docker\backups\postgres-volume-backup-2025-04-19_19-43-53.tar.zip
|
||||||
|
[2025-04-19_19-43-53] Backup copied to redundant location: D:\Pr00jects\gitea-docker\postgres-volume-backup-2025-04-19_19-43-53.tar.zip
|
||||||
|
[2025-04-19_19-44-40] Starting volume backup for gitea-docker_postgres-data...
|
||||||
|
[2025-04-19_19-44-40] Creating backup to C:\Users\benne\Projects\gitea-docker\backups\postgres-volume-backup-2025-04-19_19-44-40.tar...
|
||||||
|
[2025-04-19_19-44-40] Volume backup completed successfully!
|
||||||
|
[2025-04-19_19-44-40] Compressing backup file...
|
||||||
|
[2025-04-19_19-44-40] Backup compressed to C:\Users\benne\Projects\gitea-docker\backups\postgres-volume-backup-2025-04-19_19-44-40.tar.zip
|
||||||
|
[2025-04-19_19-44-40] Backup copied to redundant location: D:\Pr00jects\gitea-docker\postgres-volume-backup-2025-04-19_19-44-40.tar.zip
|
||||||
|
[2025-04-20_03-06-24] Starting volume backup for gitea-docker_postgres-data...
|
||||||
|
[2025-04-20_03-06-24] Creating backup to C:\Users\benne\Projects\gitea-docker\backups\postgres-volume-backup-2025-04-20_03-06-24.tar...
|
||||||
|
[2025-04-20_03-06-24] Volume backup completed successfully!
|
||||||
|
[2025-04-20_03-06-24] Compressing backup file...
|
||||||
|
[2025-04-20_03-06-24] Backup compressed to C:\Users\benne\Projects\gitea-docker\backups\postgres-volume-backup-2025-04-20_03-06-24.tar.zip
|
||||||
|
[2025-04-20_03-06-24] Backup copied to redundant location: D:\Pr00jects\gitea-docker\postgres-volume-backup-2025-04-20_03-06-24.tar.zip
|
||||||
|
[2025-04-21_03-05-47] Starting volume backup for gitea-docker_postgres-data...
|
||||||
|
[2025-04-21_03-05-47] Creating backup to C:\Users\benne\Projects\gitea-docker\backups\postgres-volume-backup-2025-04-21_03-05-47.tar...
|
||||||
|
[2025-04-21_03-05-47] Volume backup completed successfully!
|
||||||
|
[2025-04-21_03-05-47] Compressing backup file...
|
||||||
|
[2025-04-21_03-05-47] Backup compressed to C:\Users\benne\Projects\gitea-docker\backups\postgres-volume-backup-2025-04-21_03-05-47.tar.zip
|
||||||
|
[2025-04-21_03-05-47] Backup copied to redundant location: D:\Pr00jects\gitea-docker\postgres-volume-backup-2025-04-21_03-05-47.tar.zip
|
||||||
|
[2025-04-21_03-05-47] Removed old volume backup: postgres-volume-backup-2025-03-01_23-23-13.tar.zip
|
||||||
|
[2025-04-22_03-27-19] Starting volume backup for gitea-docker_postgres-data...
|
||||||
|
[2025-04-22_03-27-19] Creating backup to C:\Users\benne\Projects\gitea-docker\backups\postgres-volume-backup-2025-04-22_03-27-19.tar...
|
||||||
|
[2025-04-22_03-27-19] Volume backup completed successfully!
|
||||||
|
[2025-04-22_03-27-19] Compressing backup file...
|
||||||
|
[2025-04-22_03-27-19] Backup compressed to C:\Users\benne\Projects\gitea-docker\backups\postgres-volume-backup-2025-04-22_03-27-19.tar.zip
|
||||||
|
[2025-04-22_03-27-19] Backup copied to redundant location: D:\Pr00jects\gitea-docker\postgres-volume-backup-2025-04-22_03-27-19.tar.zip
|
||||||
|
[2025-04-22_03-27-19] Removed old volume backup: postgres-volume-backup-2025-04-19_19-42-55.tar.zip
|
||||||
|
[2025-04-23_08-10-53] Starting volume backup for gitea-docker_postgres-data...
|
||||||
|
[2025-04-23_08-10-53] Creating backup to C:\Users\benne\Projects\gitea-docker\backups\postgres-volume-backup-2025-04-23_08-10-53.tar...
|
||||||
|
[2025-04-23_08-10-53] Volume backup completed successfully!
|
||||||
|
[2025-04-23_08-10-53] Compressing backup file...
|
||||||
|
[2025-04-23_08-10-53] Backup compressed to C:\Users\benne\Projects\gitea-docker\backups\postgres-volume-backup-2025-04-23_08-10-53.tar.zip
|
||||||
|
[2025-04-23_08-10-53] Backup copied to redundant location: D:\Pr00jects\gitea-docker\postgres-volume-backup-2025-04-23_08-10-53.tar.zip
|
||||||
|
[2025-04-23_08-10-53] Removed old volume backup: postgres-volume-backup-2025-04-19_19-43-53.tar.zip
|
||||||
|
[2025-05-18_01-22-29] Starting volume backup for gitea-docker_postgres-data...
|
||||||
|
[2025-05-18_01-22-29] Creating backup to C:\Users\benne\Projects\gitea-docker\backups\postgres-volume-backup-2025-05-18_01-22-29.tar...
|
||||||
|
[2025-05-18_01-22-29] Volume backup completed successfully!
|
||||||
|
[2025-05-18_01-22-29] Compressing backup file...
|
||||||
|
[2025-05-18_01-22-29] Backup compressed to C:\Users\benne\Projects\gitea-docker\backups\postgres-volume-backup-2025-05-18_01-22-29.tar.zip
|
||||||
|
[2025-05-18_01-22-29] Backup copied to redundant location: D:\Pr00jects\gitea-docker\postgres-volume-backup-2025-05-18_01-22-29.tar.zip
|
||||||
|
[2025-05-18_01-22-29] Removed old volume backup: postgres-volume-backup-2025-04-19_19-44-40.tar.zip
|
||||||
|
[2025-05-18_03-00-14] Starting volume backup for gitea-docker_postgres-data...
|
||||||
|
[2025-05-18_03-00-14] Creating backup to C:\Users\benne\Projects\gitea-docker\backups\postgres-volume-backup-2025-05-18_03-00-14.tar...
|
||||||
|
[2025-05-18_03-00-14] Volume backup completed successfully!
|
||||||
|
[2025-05-18_03-00-14] Compressing backup file...
|
||||||
|
[2025-05-18_03-00-14] Backup compressed to C:\Users\benne\Projects\gitea-docker\backups\postgres-volume-backup-2025-05-18_03-00-14.tar.zip
|
||||||
|
[2025-05-18_03-00-14] Backup copied to redundant location: D:\Pr00jects\gitea-docker\postgres-volume-backup-2025-05-18_03-00-14.tar.zip
|
||||||
|
[2025-05-18_03-00-14] Removed old volume backup: postgres-volume-backup-2025-04-20_03-06-24.tar.zip
|
||||||
|
[2025-05-19_03-00-14] Starting volume backup for gitea-docker_postgres-data...
|
||||||
|
[2025-05-19_03-00-14] Creating backup to C:\Users\benne\Projects\gitea-docker\backups\postgres-volume-backup-2025-05-19_03-00-14.tar...
|
||||||
|
[2025-05-19_03-00-14] Volume backup completed successfully!
|
||||||
|
[2025-05-19_03-00-14] Compressing backup file...
|
||||||
|
[2025-05-19_03-00-14] Backup compressed to C:\Users\benne\Projects\gitea-docker\backups\postgres-volume-backup-2025-05-19_03-00-14.tar.zip
|
||||||
|
[2025-05-19_03-00-14] Backup copied to redundant location: D:\Pr00jects\gitea-docker\postgres-volume-backup-2025-05-19_03-00-14.tar.zip
|
||||||
|
[2025-05-19_03-00-14] Removed old volume backup: postgres-volume-backup-2025-04-21_03-05-47.tar.zip
|
||||||
|
[2025-05-20_03-14-23] Starting volume backup for gitea-docker_postgres-data...
|
||||||
|
[2025-05-20_03-14-23] Creating backup to C:\Users\benne\Projects\gitea-docker\backups\postgres-volume-backup-2025-05-20_03-14-23.tar...
|
||||||
|
[2025-05-20_03-14-23] Volume backup completed successfully!
|
||||||
|
[2025-05-20_03-14-23] Compressing backup file...
|
||||||
|
[2025-05-20_03-14-23] Backup compressed to C:\Users\benne\Projects\gitea-docker\backups\postgres-volume-backup-2025-05-20_03-14-23.tar.zip
|
||||||
|
[2025-05-20_03-14-23] Backup copied to redundant location: D:\Pr00jects\gitea-docker\postgres-volume-backup-2025-05-20_03-14-23.tar.zip
|
||||||
|
[2025-05-20_03-14-23] Removed old volume backup: postgres-volume-backup-2025-04-22_03-27-19.tar.zip
|
||||||
|
[2025-05-21_03-08-24] Starting volume backup for gitea-docker_postgres-data...
|
||||||
|
[2025-05-21_03-08-24] Creating backup to C:\Users\benne\Projects\gitea-docker\backups\postgres-volume-backup-2025-05-21_03-08-24.tar...
|
||||||
|
[2025-05-21_03-08-24] Volume backup completed successfully!
|
||||||
|
[2025-05-21_03-08-24] Compressing backup file...
|
||||||
|
[2025-05-21_03-08-24] Backup compressed to C:\Users\benne\Projects\gitea-docker\backups\postgres-volume-backup-2025-05-21_03-08-24.tar.zip
|
||||||
|
[2025-05-21_03-08-24] Backup copied to redundant location: D:\Pr00jects\gitea-docker\postgres-volume-backup-2025-05-21_03-08-24.tar.zip
|
||||||
|
[2025-05-21_03-08-24] Removed old volume backup: postgres-volume-backup-2025-04-23_08-10-53.tar.zip
|
||||||
|
[2025-05-22_03-03-49] Starting volume backup for gitea-docker_postgres-data...
|
||||||
|
[2025-05-22_03-03-49] Creating backup to C:\Users\benne\Projects\gitea-docker\backups\postgres-volume-backup-2025-05-22_03-03-49.tar...
|
||||||
|
[2025-05-22_03-03-49] Volume backup completed successfully!
|
||||||
|
[2025-05-22_03-03-49] Compressing backup file...
|
||||||
|
[2025-05-22_03-03-49] Backup compressed to C:\Users\benne\Projects\gitea-docker\backups\postgres-volume-backup-2025-05-22_03-03-49.tar.zip
|
||||||
|
[2025-05-22_03-03-49] Backup copied to redundant location: D:\Pr00jects\gitea-docker\postgres-volume-backup-2025-05-22_03-03-49.tar.zip
|
||||||
|
[2025-05-22_03-03-49] Removed old volume backup: postgres-volume-backup-2025-05-18_01-22-29.tar.zip
|
||||||
|
[2025-05-23_08-01-05] Starting volume backup for gitea-docker_postgres-data...
|
||||||
|
[2025-05-23_08-01-05] Creating backup to C:\Users\benne\Projects\gitea-docker\backups\postgres-volume-backup-2025-05-23_08-01-05.tar...
|
||||||
|
[2025-05-23_08-01-05] Volume backup completed successfully!
|
||||||
|
[2025-05-23_08-01-05] Compressing backup file...
|
||||||
|
[2025-06-09_21-30-15] Starting volume backup for gitea-docker_postgres-data...
|
||||||
|
[2025-06-09_21-30-15] Creating backup to C:\Users\benne\Projects\gitea-docker\backups\postgres-volume-backup-2025-06-09_21-30-15.tar...
|
||||||
|
[2025-06-09_21-30-15] Volume backup completed successfully!
|
||||||
|
[2025-06-09_21-30-15] Compressing backup file...
|
||||||
|
[2025-06-09_21-30-15] Backup compressed to C:\Users\benne\Projects\gitea-docker\backups\postgres-volume-backup-2025-06-09_21-30-15.tar.zip
|
||||||
|
[2025-06-09_21-30-15] Backup copied to redundant location: D:\Pr00jects\gitea-docker\postgres-volume-backup-2025-06-09_21-30-15.tar.zip
|
||||||
|
[2025-06-09_21-30-15] Removed old volume backup: postgres-volume-backup-2025-05-18_03-00-14.tar.zip
|
||||||
20
docker-compose.headscale.yml
Normal file
20
docker-compose.headscale.yml
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
version: '3.8'
|
||||||
|
|
||||||
|
services:
|
||||||
|
headscale:
|
||||||
|
image: headscale/headscale:latest
|
||||||
|
container_name: headscale
|
||||||
|
restart: unless-stopped
|
||||||
|
ports:
|
||||||
|
- "8081:8080" # Web UI and API (avoiding conflict with Traefik)
|
||||||
|
- "50443:50443" # gRPC
|
||||||
|
volumes:
|
||||||
|
- ./headscale/config:/etc/headscale
|
||||||
|
- ./headscale/data:/var/lib/headscale
|
||||||
|
command: serve
|
||||||
|
networks:
|
||||||
|
- headscale-net
|
||||||
|
|
||||||
|
networks:
|
||||||
|
headscale-net:
|
||||||
|
driver: bridge
|
||||||
@@ -3,12 +3,49 @@ version: "3"
|
|||||||
networks:
|
networks:
|
||||||
gitea:
|
gitea:
|
||||||
external: false
|
external: false
|
||||||
|
traefik:
|
||||||
|
external: true
|
||||||
|
immich_default:
|
||||||
|
external: true
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
gitea-data:
|
gitea-data:
|
||||||
postgres-data:
|
postgres-data:
|
||||||
|
traefik-certs:
|
||||||
|
|
||||||
services:
|
services:
|
||||||
|
traefik:
|
||||||
|
image: traefik:v2.9
|
||||||
|
container_name: traefik
|
||||||
|
restart: always
|
||||||
|
ports:
|
||||||
|
- "8080:80" # HTTP (changed from 80 to 8080 for ISP testing)
|
||||||
|
- "8443:443" # HTTPS (changed from 443 to 8443 for ISP testing)
|
||||||
|
- "8081:8080" # Dashboard (changed to avoid conflict)
|
||||||
|
|
||||||
|
networks:
|
||||||
|
- gitea
|
||||||
|
- traefik
|
||||||
|
volumes:
|
||||||
|
- /var/run/docker.sock:/var/run/docker.sock:ro
|
||||||
|
- traefik-certs:/letsencrypt
|
||||||
|
command:
|
||||||
|
- "--providers.docker=true"
|
||||||
|
- "--providers.docker.exposedbydefault=false"
|
||||||
|
- "--providers.docker.network=traefik"
|
||||||
|
- "--entrypoints.web.address=:80"
|
||||||
|
- "--entrypoints.websecure.address=:443"
|
||||||
|
- "--entrypoints.web.http.redirections.entryPoint.to=websecure"
|
||||||
|
- "--entrypoints.web.http.redirections.entryPoint.scheme=https"
|
||||||
|
- "--certificatesresolvers.letsencrypt.acme.httpchallenge=true"
|
||||||
|
- "--certificatesresolvers.letsencrypt.acme.httpchallenge.entrypoint=web"
|
||||||
|
- "--certificatesresolvers.letsencrypt.acme.email=bennett.l.david@gmail.com"
|
||||||
|
- "--certificatesresolvers.letsencrypt.acme.storage=/letsencrypt/acme.json"
|
||||||
|
- "--api=true"
|
||||||
|
- "--api.dashboard=true"
|
||||||
|
- "--api.insecure=true"
|
||||||
|
- "--log.level=DEBUG"
|
||||||
|
|
||||||
server:
|
server:
|
||||||
image: gitea/gitea:latest
|
image: gitea/gitea:latest
|
||||||
container_name: gitea
|
container_name: gitea
|
||||||
@@ -20,29 +57,79 @@ services:
|
|||||||
- GITEA__database__NAME=gitea
|
- GITEA__database__NAME=gitea
|
||||||
- GITEA__database__USER=gitea
|
- GITEA__database__USER=gitea
|
||||||
- GITEA__database__PASSWD=gitea
|
- GITEA__database__PASSWD=gitea
|
||||||
# SSH Configuration
|
# Server Configuration
|
||||||
- GITEA__server__DOMAIN=bee8333.ddns.net
|
- GITEA__server__DOMAIN=bee8333.ddns.net
|
||||||
|
- GITEA__server__ROOT_URL=https://bee8333.ddns.net/gitea/
|
||||||
|
- GITEA__server__PROTOCOL=http
|
||||||
|
- GITEA__server__HTTP_PORT=3000
|
||||||
- GITEA__server__SSH_DOMAIN=bee8333.ddns.net
|
- GITEA__server__SSH_DOMAIN=bee8333.ddns.net
|
||||||
- GITEA__server__ROOT_URL=https://bee8333.ddns.net/
|
- GITEA__server__SSH_PORT=2224
|
||||||
- GITEA__server__SSH_PORT=222
|
|
||||||
- GITEA__server__SSH_LISTEN_PORT=22
|
- GITEA__server__SSH_LISTEN_PORT=22
|
||||||
- GITEA__server__PROTOCOL=https
|
- GITEA__server__START_SSH_SERVER=false
|
||||||
- GITEA__server__CERT_FILE=/data/gitea/cert.pem
|
- GITEA__server__OFFLINE_MODE=false
|
||||||
- GITEA__server__KEY_FILE=/data/gitea/key.pem
|
- GITEA__server__ENABLE_GZIP=true
|
||||||
|
# Reverse Proxy Settings
|
||||||
|
- GITEA__server__USE_PROXY_PROTOCOL=false
|
||||||
|
- GITEA__server__PROXY_PROTOCOL_TLS_BRIDGING=false
|
||||||
restart: always
|
restart: always
|
||||||
networks:
|
networks:
|
||||||
- gitea
|
- gitea
|
||||||
|
- traefik
|
||||||
volumes:
|
volumes:
|
||||||
- gitea-data:/data
|
- gitea-data:/data
|
||||||
- /etc/timezone:/etc/timezone:ro
|
# - /etc/timezone:/etc/timezone:ro
|
||||||
- /etc/localtime:/etc/localtime:ro
|
# - /etc/localtime:/etc/localtime:ro
|
||||||
- ./gitea/ssl/cert.pem:/data/gitea/cert.pem:ro
|
|
||||||
- ./gitea/ssl/key.pem:/data/gitea/key.pem:ro
|
|
||||||
ports:
|
ports:
|
||||||
- "3000:3000" # Web UI: Host port 3000 -> Container port 3000
|
- "2224:22" # SSH: Host port 2224 -> Container port 22
|
||||||
- "222:22" # SSH: Host port 222 -> Container port 22
|
|
||||||
depends_on:
|
depends_on:
|
||||||
- db
|
- db
|
||||||
|
labels:
|
||||||
|
- "traefik.enable=true"
|
||||||
|
- "traefik.docker.network=traefik"
|
||||||
|
# HTTPS Configuration for /gitea subpath
|
||||||
|
- "traefik.http.routers.gitea.rule=Host(`bee8333.ddns.net`) && PathPrefix(`/gitea`)"
|
||||||
|
- "traefik.http.routers.gitea.entrypoints=websecure"
|
||||||
|
- "traefik.http.routers.gitea.tls.certresolver=letsencrypt"
|
||||||
|
- "traefik.http.routers.gitea.priority=10"
|
||||||
|
- "traefik.http.services.gitea.loadbalancer.server.port=3000"
|
||||||
|
- "traefik.http.middlewares.gitea-stripprefix.stripprefix.prefixes=/gitea"
|
||||||
|
- "traefik.http.middlewares.gitea-headers.headers.customrequestheaders.X-Forwarded-Proto=https"
|
||||||
|
- "traefik.http.routers.gitea.middlewares=gitea-stripprefix@docker,gitea-headers@docker"
|
||||||
|
# HTTP Configuration for HTTP -> HTTPS redirection
|
||||||
|
- "traefik.http.routers.gitea-http.rule=Host(`bee8333.ddns.net`) && PathPrefix(`/gitea`)"
|
||||||
|
- "traefik.http.routers.gitea-http.entrypoints=web"
|
||||||
|
- "traefik.http.middlewares.https-redirect.redirectscheme.scheme=https"
|
||||||
|
- "traefik.http.middlewares.https-redirect.redirectscheme.permanent=true"
|
||||||
|
- "traefik.http.routers.gitea-http.middlewares=https-redirect@docker"
|
||||||
|
|
||||||
|
headscale:
|
||||||
|
image: headscale/headscale:latest
|
||||||
|
container_name: headscale
|
||||||
|
restart: unless-stopped
|
||||||
|
ports:
|
||||||
|
- "3478:3478/udp" # STUN for DERP relay
|
||||||
|
volumes:
|
||||||
|
- ./headscale/config:/etc/headscale
|
||||||
|
- ./headscale/data:/var/lib/headscale
|
||||||
|
command: serve
|
||||||
|
networks:
|
||||||
|
- gitea
|
||||||
|
- traefik
|
||||||
|
labels:
|
||||||
|
- "traefik.enable=true"
|
||||||
|
- "traefik.docker.network=traefik"
|
||||||
|
# HTTPS Configuration for /headscale subpath
|
||||||
|
- "traefik.http.routers.headscale.rule=Host(`bee8333.ddns.net`) && PathPrefix(`/headscale`)"
|
||||||
|
- "traefik.http.routers.headscale.entrypoints=websecure"
|
||||||
|
- "traefik.http.routers.headscale.tls.certresolver=letsencrypt"
|
||||||
|
- "traefik.http.services.headscale.loadbalancer.server.port=8080"
|
||||||
|
- "traefik.http.middlewares.headscale-stripprefix.stripprefix.prefixes=/headscale"
|
||||||
|
- "traefik.http.middlewares.headscale-headers.headers.customrequestheaders.X-Forwarded-Proto=https"
|
||||||
|
- "traefik.http.routers.headscale.middlewares=headscale-stripprefix@docker,headscale-headers@docker"
|
||||||
|
# HTTP Configuration for HTTP -> HTTPS redirection
|
||||||
|
- "traefik.http.routers.headscale-http.rule=Host(`bee8333.ddns.net`) && PathPrefix(`/headscale`)"
|
||||||
|
- "traefik.http.routers.headscale-http.entrypoints=web"
|
||||||
|
- "traefik.http.routers.headscale-http.middlewares=https-redirect@docker"
|
||||||
|
|
||||||
db:
|
db:
|
||||||
image: postgres:14
|
image: postgres:14
|
||||||
|
|||||||
83
ensure-docker-running.ps1
Normal file
83
ensure-docker-running.ps1
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
# Script to ensure Docker is running before scheduled backup
|
||||||
|
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||||
|
$logFile = Join-Path $scriptDir "backups\docker-status.log"
|
||||||
|
$timestamp = Get-Date -Format "yyyy-MM-dd_HH-mm-ss"
|
||||||
|
|
||||||
|
# Ensure log directory exists
|
||||||
|
$backupDir = Join-Path $scriptDir "backups"
|
||||||
|
if (-not (Test-Path $backupDir)) {
|
||||||
|
New-Item -ItemType Directory -Path $backupDir
|
||||||
|
}
|
||||||
|
|
||||||
|
"[$timestamp] Checking Docker status..." | Out-File -Append -FilePath $logFile
|
||||||
|
|
||||||
|
# Check if Docker Desktop is running
|
||||||
|
$dockerProcess = Get-Process "Docker Desktop" -ErrorAction SilentlyContinue
|
||||||
|
if ($null -eq $dockerProcess) {
|
||||||
|
"[$timestamp] Docker Desktop is not running. Attempting to start..." | Out-File -Append -FilePath $logFile
|
||||||
|
|
||||||
|
# Path to Docker Desktop
|
||||||
|
$dockerPath = "C:\Program Files\Docker\Docker\Docker Desktop.exe"
|
||||||
|
if (Test-Path $dockerPath) {
|
||||||
|
Start-Process $dockerPath
|
||||||
|
"[$timestamp] Started Docker Desktop." | Out-File -Append -FilePath $logFile
|
||||||
|
|
||||||
|
# Wait for Docker to start up (give it 60 seconds)
|
||||||
|
$maxWaitTime = 60
|
||||||
|
$waitTime = 0
|
||||||
|
$dockerRunning = $false
|
||||||
|
|
||||||
|
while (-not $dockerRunning -and $waitTime -lt $maxWaitTime) {
|
||||||
|
Start-Sleep -Seconds 5
|
||||||
|
$waitTime += 5
|
||||||
|
|
||||||
|
try {
|
||||||
|
$dockerStatus = docker info 2>&1
|
||||||
|
if ($LASTEXITCODE -eq 0) {
|
||||||
|
$dockerRunning = $true
|
||||||
|
"[$timestamp] Docker is now running after waiting $waitTime seconds." | Out-File -Append -FilePath $logFile
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
# Keep waiting
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (-not $dockerRunning) {
|
||||||
|
"[$timestamp] Docker did not start successfully after waiting $maxWaitTime seconds." | Out-File -Append -FilePath $logFile
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
"[$timestamp] Docker Desktop executable not found at expected location: $dockerPath" | Out-File -Append -FilePath $logFile
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
"[$timestamp] Docker Desktop is already running." | Out-File -Append -FilePath $logFile
|
||||||
|
}
|
||||||
|
|
||||||
|
# Check if containers are running
|
||||||
|
try {
|
||||||
|
$containersRunning = docker ps 2>&1
|
||||||
|
if ($LASTEXITCODE -eq 0) {
|
||||||
|
"[$timestamp] Docker containers status: " | Out-File -Append -FilePath $logFile
|
||||||
|
$runningContainers = docker ps --format "{{.Names}}" 2>&1
|
||||||
|
$runningContainers | Out-File -Append -FilePath $logFile
|
||||||
|
|
||||||
|
# Check specifically for gitea containers
|
||||||
|
$giteaRunning = $runningContainers | Select-String -Pattern "gitea" -Quiet
|
||||||
|
if (-not $giteaRunning) {
|
||||||
|
"[$timestamp] Gitea containers are not running. Starting containers..." | Out-File -Append -FilePath $logFile
|
||||||
|
|
||||||
|
# Navigate to gitea-docker directory and start containers
|
||||||
|
Set-Location $scriptDir
|
||||||
|
docker-compose up -d 2>&1 | Out-File -Append -FilePath $logFile
|
||||||
|
|
||||||
|
if ($LASTEXITCODE -eq 0) {
|
||||||
|
"[$timestamp] Successfully started Gitea containers." | Out-File -Append -FilePath $logFile
|
||||||
|
} else {
|
||||||
|
"[$timestamp] Failed to start Gitea containers." | Out-File -Append -FilePath $logFile
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
"[$timestamp] Failed to check running containers. Docker might not be ready yet." | Out-File -Append -FilePath $logFile
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
"[$timestamp] Error checking Docker containers: $_" | Out-File -Append -FilePath $logFile
|
||||||
|
}
|
||||||
BIN
gitea-dump.zip
Normal file
BIN
gitea-dump.zip
Normal file
Binary file not shown.
54
headscale/config/config.yaml
Normal file
54
headscale/config/config.yaml
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
server_url: https://bee8333.ddns.net/headscale/
|
||||||
|
listen_addr: 0.0.0.0:8080
|
||||||
|
metrics_listen_addr: 127.0.0.1:9090
|
||||||
|
grpc_listen_addr: 0.0.0.0:50443
|
||||||
|
grpc_allow_insecure: false
|
||||||
|
|
||||||
|
tls_cert_path: ""
|
||||||
|
tls_key_path: ""
|
||||||
|
|
||||||
|
private_key_path: /var/lib/headscale/private.key
|
||||||
|
noise:
|
||||||
|
private_key_path: /var/lib/headscale/noise_private.key
|
||||||
|
|
||||||
|
prefixes:
|
||||||
|
v4: 100.64.0.0/10
|
||||||
|
v6: fd7a:115c:a1e0::/48
|
||||||
|
|
||||||
|
derp:
|
||||||
|
server:
|
||||||
|
enabled: true
|
||||||
|
region_id: 900
|
||||||
|
region_code: "homelab"
|
||||||
|
region_name: "Home Lab"
|
||||||
|
stun_listen_addr: "0.0.0.0:3478"
|
||||||
|
private_key_path: /var/lib/headscale/derp_server_private.key
|
||||||
|
urls:
|
||||||
|
- https://controlplane.tailscale.com/derpmap/default
|
||||||
|
|
||||||
|
disable_check_updates: false
|
||||||
|
ephemeral_node_inactivity_timeout: 30m
|
||||||
|
database:
|
||||||
|
type: sqlite3
|
||||||
|
sqlite:
|
||||||
|
path: /var/lib/headscale/db.sqlite
|
||||||
|
|
||||||
|
log:
|
||||||
|
format: text
|
||||||
|
level: info
|
||||||
|
|
||||||
|
policy:
|
||||||
|
path: ""
|
||||||
|
|
||||||
|
dns:
|
||||||
|
override_local_dns: true
|
||||||
|
nameservers:
|
||||||
|
global:
|
||||||
|
- 1.1.1.1
|
||||||
|
- 8.8.8.8
|
||||||
|
search_domains: []
|
||||||
|
magic_dns: true
|
||||||
|
base_domain: headscale.bee8333.local
|
||||||
|
|
||||||
|
unix_socket: /var/run/headscale/headscale.sock
|
||||||
|
unix_socket_permission: "0770"
|
||||||
36
immich-https.conf
Normal file
36
immich-https.conf
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
events {
|
||||||
|
worker_connections 1024;
|
||||||
|
}
|
||||||
|
|
||||||
|
http {
|
||||||
|
upstream immich {
|
||||||
|
server immich_server:2283;
|
||||||
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 443 ssl;
|
||||||
|
server_name bee8333.ddns.net;
|
||||||
|
|
||||||
|
# Self-signed SSL certificate (will be generated at startup)
|
||||||
|
ssl_certificate /etc/ssl/certs/immich.crt;
|
||||||
|
ssl_certificate_key /etc/ssl/private/immich.key;
|
||||||
|
ssl_protocols TLSv1.2 TLSv1.3;
|
||||||
|
ssl_ciphers HIGH:!aNULL:!MD5;
|
||||||
|
|
||||||
|
client_max_body_size 50000M;
|
||||||
|
|
||||||
|
# Direct proxy to Immich - NO subpath manipulation
|
||||||
|
location / {
|
||||||
|
proxy_pass http://immich;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto https;
|
||||||
|
|
||||||
|
# WebSocket support for real-time features
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
proxy_set_header Connection "upgrade";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
49
immich-nginx.conf
Normal file
49
immich-nginx.conf
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
events {
|
||||||
|
worker_connections 1024;
|
||||||
|
}
|
||||||
|
|
||||||
|
http {
|
||||||
|
upstream immich {
|
||||||
|
server immich_server:2283;
|
||||||
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name bee8333.ddns.net;
|
||||||
|
|
||||||
|
client_max_body_size 50000M;
|
||||||
|
|
||||||
|
# Main application - all requests go to Immich
|
||||||
|
location / {
|
||||||
|
proxy_pass http://immich;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
|
||||||
|
# Critical headers for subpath handling
|
||||||
|
proxy_set_header X-Forwarded-Prefix /immich;
|
||||||
|
proxy_set_header X-Script-Name /immich;
|
||||||
|
|
||||||
|
# WebSocket support for real-time features
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
proxy_set_header Connection "upgrade";
|
||||||
|
|
||||||
|
# SPA support - handle client-side routing
|
||||||
|
proxy_intercept_errors on;
|
||||||
|
error_page 404 = @fallback;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Fallback for SPA routing
|
||||||
|
location @fallback {
|
||||||
|
proxy_pass http://immich;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
proxy_set_header X-Forwarded-Prefix /immich;
|
||||||
|
proxy_set_header X-Script-Name /immich;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
17
run-backup.ps1
Normal file
17
run-backup.ps1
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
# This script is automatically generated - do not edit manually
|
||||||
|
# It runs the Docker check script followed by database and volume backup scripts
|
||||||
|
|
||||||
|
# Get the script directory
|
||||||
|
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||||
|
|
||||||
|
# Run the Docker check script first
|
||||||
|
$dockerCheckScript = Join-Path $scriptDir "ensure-docker-running.ps1"
|
||||||
|
& $dockerCheckScript
|
||||||
|
|
||||||
|
# Then run the database backup script
|
||||||
|
$dbBackupScript = Join-Path $scriptDir "backup-gitea-db.ps1"
|
||||||
|
& $dbBackupScript
|
||||||
|
|
||||||
|
# Finally run the volume backup script
|
||||||
|
$volumeBackupScript = Join-Path $scriptDir "backup-volume.ps1"
|
||||||
|
& $volumeBackupScript
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
# Script to create a scheduled task for Gitea database backups
|
# Script to create a scheduled task for Gitea database backups
|
||||||
$scriptPath = Join-Path (Get-Location) "backup-gitea-db.ps1"
|
$workingDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||||
|
$scriptPath = Join-Path $workingDir "backup-gitea-db.ps1"
|
||||||
|
$dockerCheckScript = Join-Path $workingDir "ensure-docker-running.ps1"
|
||||||
$taskName = "GiteaDatabaseBackup"
|
$taskName = "GiteaDatabaseBackup"
|
||||||
$taskDescription = "Regular backup of Gitea PostgreSQL database"
|
$taskDescription = "Regular backup of Gitea PostgreSQL database"
|
||||||
|
|
||||||
@@ -9,20 +11,56 @@ if (-not (Test-Path $scriptPath)) {
|
|||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Check if the Docker check script exists
|
||||||
|
if (-not (Test-Path $dockerCheckScript)) {
|
||||||
|
Write-Host "Docker check script not found at: $dockerCheckScript" -ForegroundColor Red
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Create a batch script that runs both scripts
|
||||||
|
$batchScriptPath = Join-Path $workingDir "run-backup.ps1"
|
||||||
|
@"
|
||||||
|
# This script is automatically generated - do not edit manually
|
||||||
|
# It runs the Docker check script followed by the backup script
|
||||||
|
|
||||||
|
# Get the script directory
|
||||||
|
`$scriptDir = Split-Path -Parent `$MyInvocation.MyCommand.Path
|
||||||
|
|
||||||
|
# Run the Docker check script first
|
||||||
|
`$dockerCheckScript = Join-Path `$scriptDir "ensure-docker-running.ps1"
|
||||||
|
& `$dockerCheckScript
|
||||||
|
|
||||||
|
# Then run the backup script
|
||||||
|
`$backupScript = Join-Path `$scriptDir "backup-gitea-db.ps1"
|
||||||
|
& `$backupScript
|
||||||
|
"@ | Out-File -FilePath $batchScriptPath -Encoding utf8
|
||||||
|
|
||||||
# Create a scheduled task to run daily at 3 AM
|
# Create a scheduled task to run daily at 3 AM
|
||||||
$action = New-ScheduledTaskAction -Execute "PowerShell.exe" -Argument "-NoProfile -ExecutionPolicy Bypass -File `"$scriptPath`""
|
$action = New-ScheduledTaskAction -Execute "PowerShell.exe" -Argument "-NoProfile -ExecutionPolicy Bypass -File `"$batchScriptPath`"" -WorkingDirectory "$workingDir"
|
||||||
$trigger = New-ScheduledTaskTrigger -Daily -At 3AM
|
$trigger = New-ScheduledTaskTrigger -Daily -At 3AM
|
||||||
$settings = New-ScheduledTaskSettingsSet -StartWhenAvailable -DontStopOnIdleEnd -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries
|
$settings = New-ScheduledTaskSettingsSet -StartWhenAvailable -DontStopOnIdleEnd -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries
|
||||||
|
|
||||||
|
# Create a principal that runs with highest privileges
|
||||||
|
$principal = New-ScheduledTaskPrincipal -UserId "NT AUTHORITY\SYSTEM" -LogonType ServiceAccount -RunLevel Highest
|
||||||
|
|
||||||
# Register the scheduled task
|
# Register the scheduled task
|
||||||
$taskExists = Get-ScheduledTask -TaskName $taskName -ErrorAction SilentlyContinue
|
$taskExists = Get-ScheduledTask -TaskName $taskName -ErrorAction SilentlyContinue
|
||||||
|
|
||||||
if ($taskExists) {
|
if ($taskExists) {
|
||||||
Write-Host "Task '$taskName' already exists. Updating..." -ForegroundColor Yellow
|
Write-Host "Task '$taskName' already exists. Updating..." -ForegroundColor Yellow
|
||||||
Set-ScheduledTask -TaskName $taskName -Action $action -Trigger $trigger -Settings $settings -Description $taskDescription
|
# Get the existing task
|
||||||
|
$task = Get-ScheduledTask -TaskName $taskName
|
||||||
|
# Update the task properties
|
||||||
|
$task.Actions = $action
|
||||||
|
$task.Triggers = $trigger
|
||||||
|
$task.Settings = $settings
|
||||||
|
$task.Principal = $principal
|
||||||
|
$task.Description = $taskDescription
|
||||||
|
# Save the updated task
|
||||||
|
Set-ScheduledTask -InputObject $task
|
||||||
} else {
|
} else {
|
||||||
Write-Host "Creating new scheduled task '$taskName'..." -ForegroundColor Green
|
Write-Host "Creating new scheduled task '$taskName'..." -ForegroundColor Green
|
||||||
Register-ScheduledTask -TaskName $taskName -Action $action -Trigger $trigger -Settings $settings -Description $taskDescription -User "$env:USERDOMAIN\$env:USERNAME"
|
Register-ScheduledTask -TaskName $taskName -Action $action -Trigger $trigger -Settings $settings -Description $taskDescription -Principal $principal
|
||||||
}
|
}
|
||||||
|
|
||||||
Write-Host "Scheduled task setup complete. The database will be backed up daily at 3 AM." -ForegroundColor Green
|
Write-Host "Scheduled task setup complete. The database will be backed up daily at 3 AM." -ForegroundColor Green
|
||||||
|
|||||||
Reference in New Issue
Block a user