Env var updates

This commit is contained in:
Arunavo Ray
2025-08-29 18:11:26 +05:30
parent 18855f09c4
commit cbf6e11de3
4 changed files with 77 additions and 22 deletions

View File

@@ -111,6 +111,8 @@ DOCKER_TAG=latest
# Basic Schedule Settings # Basic Schedule Settings
# SCHEDULE_ENABLED=false # SCHEDULE_ENABLED=false
# SCHEDULE_INTERVAL=3600 # Interval in seconds or cron expression (e.g., "0 2 * * *") # SCHEDULE_INTERVAL=3600 # Interval in seconds or cron expression (e.g., "0 2 * * *")
# GITEA_MIRROR_INTERVAL=8h # Mirror sync interval (5m, 30m, 1h, 8h, 24h, 1d, 7d)
# AUTO_IMPORT_REPOS=true # Automatically discover and import new GitHub repositories
# DELAY=3600 # Legacy: same as SCHEDULE_INTERVAL, kept for backward compatibility # DELAY=3600 # Legacy: same as SCHEDULE_INTERVAL, kept for backward compatibility
# Execution Settings # Execution Settings
@@ -148,11 +150,11 @@ DOCKER_TAG=latest
# CLEANUP_ENABLED=false # CLEANUP_ENABLED=false
# CLEANUP_RETENTION_DAYS=7 # Days to keep events # CLEANUP_RETENTION_DAYS=7 # Days to keep events
# Repository Cleanup # Repository Cleanup (v3.4.0+)
# CLEANUP_DELETE_FROM_GITEA=false # Delete repos from Gitea # CLEANUP_DELETE_FROM_GITEA=false # Delete repos from Gitea
# CLEANUP_DELETE_IF_NOT_IN_GITHUB=true # Delete if not in GitHub - automatically enables cleanup # 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_ORPHANED_REPO_ACTION=archive # Options: skip, archive, delete
# CLEANUP_DRY_RUN=true # Test mode without actual deletion # CLEANUP_DRY_RUN=true # Test mode without actual deletion (set to false for production)
# Protected Repositories (comma-separated) # Protected Repositories (comma-separated)
# CLEANUP_PROTECTED_REPOS=important-repo,critical-project # CLEANUP_PROTECTED_REPOS=important-repo,critical-project

View File

@@ -40,7 +40,10 @@ First user signup becomes admin. Configure GitHub and Gitea through the web inte
- 🚫 **Repository ignore** - Mark specific repos to skip - 🚫 **Repository ignore** - Mark specific repos to skip
- 🔐 Secure authentication with Better Auth (email/password, SSO, OIDC) - 🔐 Secure authentication with Better Auth (email/password, SSO, OIDC)
- 📊 Real-time dashboard with activity logs - 📊 Real-time dashboard with activity logs
- ⏱️ Scheduled automatic mirroring with flexible intervals - ⏱️ Scheduled automatic mirroring with configurable intervals
- 🔄 **Auto-discovery** - Automatically import new GitHub repositories (v3.4.0+)
- 🧹 **Repository cleanup** - Auto-remove repos deleted from GitHub (v3.4.0+)
- 🎯 **Proper mirror intervals** - Respects configured sync intervals (v3.4.0+)
- 🗑️ Automatic database cleanup with configurable retention - 🗑️ Automatic database cleanup with configurable retention
- 🐳 Dockerized with multi-arch support (AMD64/ARM64) - 🐳 Dockerized with multi-arch support (AMD64/ARM64)
@@ -204,25 +207,39 @@ Enable in Settings → Mirror Options → Mirror metadata
- **Automatic Cleanup** - Configure retention period for activity logs - **Automatic Cleanup** - Configure retention period for activity logs
- **Scheduled Sync** - Set custom intervals for automatic mirroring - **Scheduled Sync** - Set custom intervals for automatic mirroring
### Automatic Mirroring ### Automatic Mirroring & Synchronization
Gitea Mirror can automatically sync your repositories at regular intervals. There are two ways to configure this: Gitea Mirror provides powerful automatic synchronization features:
#### Via Web Interface (Recommended) #### Features (v3.4.0+)
Navigate to the Configuration page and enable "Automatic Mirroring" with your preferred interval (e.g., every 6 hours, daily, etc.). - **Auto-discovery**: Automatically discovers and imports new GitHub repositories
- **Repository cleanup**: Removes repositories that no longer exist in GitHub
- **Proper intervals**: Mirrors respect your configured sync intervals (not Gitea's default 24h)
- **Smart scheduling**: Only syncs repositories that need updating
#### Via Environment Variables #### Configuration via Web Interface (Recommended)
Set `GITEA_MIRROR_INTERVAL` to automatically enable scheduled mirroring: Navigate to the Configuration page and enable "Automatic Mirroring" with your preferred interval.
#### Configuration via Environment Variables
```bash ```bash
# Examples of supported formats: # Enable automatic scheduling (required for auto features)
GITEA_MIRROR_INTERVAL=8h # Every 8 hours SCHEDULE_ENABLED=true
GITEA_MIRROR_INTERVAL=30m # Every 30 minutes
GITEA_MIRROR_INTERVAL=1d # Daily # Mirror interval (how often to sync)
GITEA_MIRROR_INTERVAL=86400 # Every 86400 seconds (24 hours) GITEA_MIRROR_INTERVAL=8h # Every 8 hours (default)
# Other examples: 5m, 30m, 1h, 24h, 1d, 7d
# Auto-import new repositories (default: true)
AUTO_IMPORT_REPOS=true
# Auto-cleanup orphaned repositories
CLEANUP_DELETE_IF_NOT_IN_GITHUB=true
CLEANUP_ORPHANED_REPO_ACTION=archive # or 'delete'
CLEANUP_DRY_RUN=false # Set to true to test without changes
``` ```
When this variable is set, the scheduler automatically enables and runs at the specified interval. The timer starts from the last successful sync, not from container startup. **Important**: The scheduler checks every minute for tasks to run. The `GITEA_MIRROR_INTERVAL` determines how often each repository is actually synced. For example, with `8h`, each repo syncs every 8 hours from its last successful sync.
## Troubleshooting ## Troubleshooting

View File

@@ -1,5 +1,7 @@
# Gitea Mirror alternate deployment configuration # Minimal Gitea Mirror deployment
# Standard deployment with host path and minimal environments # Only includes what CANNOT be configured via the Web UI
# Everything else can be set up through the web interface after deployment
services: services:
gitea-mirror: gitea-mirror:
image: ghcr.io/raylabshq/gitea-mirror:latest image: ghcr.io/raylabshq/gitea-mirror:latest
@@ -11,17 +13,43 @@ services:
volumes: volumes:
- ./data:/app/data - ./data:/app/data
environment: environment:
# For a complete list of all supported environment variables, see: # === ABSOLUTELY REQUIRED ===
# docs/ENVIRONMENT_VARIABLES.md or .env.example # This MUST be set and CANNOT be changed via UI
- BETTER_AUTH_SECRET=${BETTER_AUTH_SECRET} # Min 32 chars, required for sessions
# === CORE SETTINGS ===
# These are technically required but have working defaults
- NODE_ENV=production - NODE_ENV=production
- DATABASE_URL=file:data/gitea-mirror.db - DATABASE_URL=file:data/gitea-mirror.db
- HOST=0.0.0.0 - HOST=0.0.0.0
- PORT=4321 - PORT=4321
- BETTER_AUTH_URL=http://localhost:4321 - BETTER_AUTH_URL=${BETTER_AUTH_URL:-http://localhost:4321}
- BETTER_AUTH_SECRET=${BETTER_AUTH_SECRET:-your-secret-key-change-this-in-production}
healthcheck: healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=3", "--spider", "http://localhost:4321/api/health"] test: ["CMD", "wget", "--no-verbose", "--tries=3", "--spider", "http://localhost:4321/api/health"]
interval: 30s interval: 30s
timeout: 10s timeout: 10s
retries: 5 retries: 5
start_period: 15s start_period: 15s
# === QUICK START ===
#
# 1. Create a .env file with only ONE required variable:
# BETTER_AUTH_SECRET=your-32-character-minimum-secret-key-here
#
# 2. Run:
# docker-compose -f docker-compose.alt.yml up -d
#
# 3. Access at http://localhost:4321
#
# 4. Sign up for an account (first user becomes admin)
#
# 5. Configure everything else through the web UI:
# - GitHub credentials
# - Gitea credentials
# - Mirror settings
# - Scheduling options
# - Auto-import settings
# - Cleanup preferences
#
# That's it! Everything else can be configured via the web interface.

View File

@@ -53,6 +53,14 @@ services:
- GITEA_ORGANIZATION=${GITEA_ORGANIZATION:-github-mirrors} - GITEA_ORGANIZATION=${GITEA_ORGANIZATION:-github-mirrors}
- GITEA_ORG_VISIBILITY=${GITEA_ORG_VISIBILITY:-public} - GITEA_ORG_VISIBILITY=${GITEA_ORG_VISIBILITY:-public}
- DELAY=${DELAY:-3600} - DELAY=${DELAY:-3600}
# Scheduling and Sync Configuration (Issue #72 fixes)
- SCHEDULE_ENABLED=${SCHEDULE_ENABLED:-false}
- GITEA_MIRROR_INTERVAL=${GITEA_MIRROR_INTERVAL:-8h}
- AUTO_IMPORT_REPOS=${AUTO_IMPORT_REPOS:-true}
# Repository Cleanup Configuration
- CLEANUP_DELETE_IF_NOT_IN_GITHUB=${CLEANUP_DELETE_IF_NOT_IN_GITHUB:-false}
- CLEANUP_ORPHANED_REPO_ACTION=${CLEANUP_ORPHANED_REPO_ACTION:-archive}
- CLEANUP_DRY_RUN=${CLEANUP_DRY_RUN:-true}
# Optional: Skip TLS verification (insecure, use only for testing) # Optional: Skip TLS verification (insecure, use only for testing)
# - GITEA_SKIP_TLS_VERIFY=${GITEA_SKIP_TLS_VERIFY:-false} # - GITEA_SKIP_TLS_VERIFY=${GITEA_SKIP_TLS_VERIFY:-false}
# Header Authentication (for Reverse Proxy SSO) # Header Authentication (for Reverse Proxy SSO)