Files
TheGreatCompose/Gitea-mirror/compose.yaml
T
2025-09-24 12:53:14 -05:00

133 lines
5.8 KiB
YAML

services:
gitea-mirror:
container_name: gitea-mirror
image: ghcr.io/raylabshq/gitea-mirror:v3.7.0
restart: unless-stopped
ports:
- 4321:4321
volumes:
- /mnt/appdata/gitea-mirror/data:/app/data
# Mount custom CA certificates - choose one option:
# Option 1: Mount individual CA certificates from certs directory
# - ./certs:/app/certs:ro
# Option 2: Mount system CA bundle (if your CA is already in system store)
# - /etc/ssl/certs/ca-certificates.crt:/etc/ssl/certs/ca-certificates.crt:ro
environment:
# For a complete list of all supported environment variables, see:
# docs/ENVIRONMENT_VARIABLES.md or .env.example
- NODE_ENV=production
- DATABASE_URL=file:data/gitea-mirror.db
- HOST=0.0.0.0
- PORT=4321
- BETTER_AUTH_SECRET=${BETTER_AUTH_SECRET}
- BETTER_AUTH_URL=http://gitea-mirror
# Optional: ENCRYPTION_SECRET will be auto-generated if not provided
# - ENCRYPTION_SECRET=
# GitHub/Gitea Mirror Config
- GITHUB_USERNAME=NinjaSurge
- GITHUB_TOKEN=${GITHUB_TOKEN}
- GITHUB_TYPE=personal
- GITHUB_EXCLUDED_ORGS=
- SKIP_FORKS=false
- PRIVATE_REPOSITORIES=true
- MIRROR_METADATA=true
- MIRROR_ISSUES=true
- MIRROR_WIKI=true
- MIRROR_STARRED=true
- MIRROR_ORGANIZATIONS=false
- PRESERVE_ORG_STRUCTURE=false
- ONLY_MIRROR_ORGS=false
- SKIP_STARRED_ISSUES=false
- GITEA_URL=http://gitea.homelab.local
- GITEA_TOKEN=${GITEA_TOKEN}
- GITEA_USERNAME=NinjaSurge
- GITEA_ORGANIZATION=github-mirrors
- GITEA_ORG_VISIBILITY=public
- DELAY=3600 # Legacy: same as SCHEDULE_INTERVAL, kept for backward compatibility
# Scheduling and Sync Configuration (Issue #72 fixes)
- SCHEDULE_ENABLED=false # When true, auto-imports and mirrors all repos on startup (v3.5.3+)
- GITEA_MIRROR_INTERVAL=8h # Mirror sync interval (5m, 30m, 1h, 8h, 24h, 1d, 7d) - also triggers auto-start, automatically enables scheduler
- AUTO_IMPORT_REPOS=true
# Repository Cleanup Configuration
- CLEANUP_DELETE_IF_NOT_IN_GITHUB=false # Auto-remove repos that no longer exist in GitHub
- CLEANUP_ORPHANED_REPO_ACTION=archive # Options: skip, archive, delete
- CLEANUP_DRY_RUN=true # Test mode without actual deletion (set to false for production)
# Header Authentication (for Reverse Proxy SSO)
- HEADER_AUTH_ENABLED=false
- HEADER_AUTH_USER_HEADER=X-Authentik-Username
- HEADER_AUTH_EMAIL_HEADER=X-Authentik-Email
- HEADER_AUTH_NAME_HEADER=X-Authentik-Name
- HEADER_AUTH_AUTO_PROVISION=false
- HEADER_AUTH_ALLOWED_DOMAINS=
# Optional: Skip TLS verification (insecure, use only for testing)
- GITEA_SKIP_TLS_VERIFY=true # WARNING: Only use for testing
- MIRROR_RELEASES=true # Mirror GitHub releases
- INCLUDE_ARCHIVED=true
- MIRROR_STRATEGY=single-org # Options: preserve, single-org, flat-user, mixed
- GITEA_LFS=true # Enable LFS support
- MIRROR_PULL_REQUESTS=true # Mirror pull requests
- MIRROR_LABELS=true # Mirror labels
- MIRROR_MILESTONES=true # Mirror milestones
# Cleanup Execution
- CLEANUP_BATCH_SIZE=10
- CLEANUP_PAUSE_BETWEEN_DELETES=2000 # Pause between deletions (ms)
# Protected Repositories (comma-separated)
- CLEANUP_PROTECTED_REPOS=important-repo,critical-project
# Repository Cleanup (v3.4.0+)
- CLEANUP_DELETE_FROM_GITEA=false # Delete repos from Gitea
# Basic Cleanup Settings
- CLEANUP_ENABLED=false
- CLEANUP_RETENTION_DAYS=7 # Days to keep events
# Notifications
- SCHEDULE_NOTIFY_ON_FAILURE=true
- SCHEDULE_NOTIFY_ON_SUCCESS=false
- SCHEDULE_LOG_LEVEL=info # Options: error, warn, info, debug
- SCHEDULE_TIMEZONE=UTC
# Maintenance
- SCHEDULE_CLEANUP_BEFORE_MIRROR=false # Run cleanup before mirroring
# Update Detection
- SCHEDULE_ONLY_MIRROR_UPDATED=false # Only mirror repos with updates
- SCHEDULE_UPDATE_INTERVAL=86400000 # Check for updates interval (ms)
- SCHEDULE_SKIP_RECENTLY_MIRRORED=true
- SCHEDULE_RECENT_THRESHOLD=3600000 # Skip if mirrored within this time (ms)
# Retry Configuration
- SCHEDULE_RETRY_ATTEMPTS=3
- SCHEDULE_RETRY_DELAY=60000 # Delay between retries (ms)
- SCHEDULE_TIMEOUT=3600000 # Max time for a mirror operation (ms)
- SCHEDULE_AUTO_RETRY=true
# Execution Settings
- SCHEDULE_CONCURRENT=false # Allow concurrent mirror operations
- SCHEDULE_BATCH_SIZE=10 # Number of repos to process in parallel
- SCHEDULE_PAUSE_BETWEEN_BATCHES=5000 # Pause between batches (ms)
# Basic Schedule Settings
- SCHEDULE_INTERVAL=3600 # Interval in seconds or cron expression (e.g., "0 2 * * *")
# Release and Metadata
- RELEASE_LIMIT=10 # Maximum number of releases to mirror per repository
# Fork Handling
- GITEA_FORK_STRATEGY=reference # Options: skip, reference, full-copy
# Topic Settings
- GITEA_ADD_TOPICS=true # Add topics to repositories
- GITEA_TOPIC_PREFIX=gh- # Prefix for topics
# Template Settings (for using repository templates)
- GITEA_TEMPLATE_OWNER=template-owner
- GITEA_TEMPLATE_REPO=template-repo
- GITEA_PRESERVE_VISIBILITY=false # Preserve GitHub repo visibility in Gitea
labels:
traefik.enable: true
traefik.http.routers.gitea-mirror.rule: Host(`gitea-mirror.homelab.local`)
traefik.http.routers.gitea-mirror.entrypoints: http
healthcheck:
test:
[
"CMD",
"wget",
"--no-verbose",
"--tries=3",
"--spider",
"http://localhost:4321/api/health",
]
interval: 30s
timeout: 10s
retries: 5
start_period: 15s