FossilRepo
| 2eca4eb… | ragelink | 1 | # Sync Bridge |
| 2eca4eb… | ragelink | 2 | |
| 2eca4eb… | ragelink | 3 | The sync bridge mirrors Fossil repositories to GitHub and GitLab as downstream read-only copies. |
| 2eca4eb… | ragelink | 4 | |
| 2eca4eb… | ragelink | 5 | ## How It Works |
| 2eca4eb… | ragelink | 6 | |
| 2eca4eb… | ragelink | 7 | ```mermaid |
| 2eca4eb… | ragelink | 8 | flowchart LR |
| 2eca4eb… | ragelink | 9 | Fossil["Fossil Repo<br/>(source of truth)"] --> Bridge["Sync Bridge<br/>(Celery task)"] |
| 2eca4eb… | ragelink | 10 | Bridge --> Git["Git Export"] |
| 2eca4eb… | ragelink | 11 | Git --> GitHub["GitHub Mirror"] |
| 2eca4eb… | ragelink | 12 | Git --> GitLab["GitLab Mirror"] |
| 2eca4eb… | ragelink | 13 | ``` |
| 2eca4eb… | ragelink | 14 | |
| 2eca4eb… | ragelink | 15 | The bridge: |
| 2eca4eb… | ragelink | 16 | |
| 2eca4eb… | ragelink | 17 | 1. Exports Fossil commits as Git commits |
| 2eca4eb… | ragelink | 18 | 2. Pushes to configured Git remotes |
| 2eca4eb… | ragelink | 19 | 3. Optionally syncs tickets to GitHub/GitLab Issues |
| 2eca4eb… | ragelink | 20 | 4. Optionally syncs wiki pages to repo docs |
| 2eca4eb… | ragelink | 21 | |
| 2eca4eb… | ragelink | 22 | ## What Gets Synced |
| 2eca4eb… | ragelink | 23 | |
| 2eca4eb… | ragelink | 24 | | Fossil Artifact | Git Target | Configurable | |
| 2eca4eb… | ragelink | 25 | |---|---|---| |
| 2eca4eb… | ragelink | 26 | | Commits | Git commits | Always | |
| 2eca4eb… | ragelink | 27 | | Tags | Git tags | Always | |
| 2eca4eb… | ragelink | 28 | | Branches | Git branches | Always | |
| 2eca4eb… | ragelink | 29 | | Tickets | GitHub/GitLab Issues | Optional | |
| 2eca4eb… | ragelink | 30 | | Wiki | Repository docs | Optional | |
| 2eca4eb… | ragelink | 31 | |
| 2eca4eb… | ragelink | 32 | ## Configuration |
| 2eca4eb… | ragelink | 33 | |
| 2eca4eb… | ragelink | 34 | Set up mirroring through the Django management UI or environment variables: |
| 2eca4eb… | ragelink | 35 | |
| 2eca4eb… | ragelink | 36 | ```bash |
| 2eca4eb… | ragelink | 37 | # GitHub mirror |
| 2eca4eb… | ragelink | 38 | GITHUB_TOKEN=ghp_xxxxxxxxxxxx |
| 2eca4eb… | ragelink | 39 | |
| 2eca4eb… | ragelink | 40 | # GitLab mirror |
| 2eca4eb… | ragelink | 41 | GITLAB_TOKEN=glpat-xxxxxxxxxxxx |
| 2eca4eb… | ragelink | 42 | ``` |
| 2eca4eb… | ragelink | 43 | |
| 2eca4eb… | ragelink | 44 | Per-repository mirror configuration is managed in the dashboard under **Repository Settings > Sync**. |
| 2eca4eb… | ragelink | 45 | |
| 2eca4eb… | ragelink | 46 | ## Sync Modes |
| 2eca4eb… | ragelink | 47 | |
| 2eca4eb… | ragelink | 48 | ### On-Demand |
| 2eca4eb… | ragelink | 49 | |
| 2eca4eb… | ragelink | 50 | Trigger a sync manually from the dashboard or CLI: |
| 2eca4eb… | ragelink | 51 | |
| 2eca4eb… | ragelink | 52 | ```bash |
| 2eca4eb… | ragelink | 53 | docker compose exec django python manage.py fossil_sync my-project |
| 2eca4eb… | ragelink | 54 | ``` |
| 2eca4eb… | ragelink | 55 | |
| 2eca4eb… | ragelink | 56 | ### Scheduled |
| 2eca4eb… | ragelink | 57 | |
| 2eca4eb… | ragelink | 58 | Configure a Celery Beat schedule to sync at regular intervals: |
| 2eca4eb… | ragelink | 59 | |
| 2eca4eb… | ragelink | 60 | ```python |
| 2eca4eb… | ragelink | 61 | # Runs every 15 minutes |
| 2eca4eb… | ragelink | 62 | CELERY_BEAT_SCHEDULE = { |
| 2eca4eb… | ragelink | 63 | 'sync-all-repos': { |
| 2eca4eb… | ragelink | 64 | 'task': 'fossil.tasks.sync_all', |
| 2eca4eb… | ragelink | 65 | 'schedule': 900.0, |
| 2eca4eb… | ragelink | 66 | }, |
| 2eca4eb… | ragelink | 67 | } |
| 2eca4eb… | ragelink | 68 | ``` |
| 2eca4eb… | ragelink | 69 | |
| 2eca4eb… | ragelink | 70 | ### Upstream Pull |
| 2eca4eb… | ragelink | 71 | |
| 2eca4eb… | ragelink | 72 | Pull updates from a remote Fossil server into your local instance: |
| 2eca4eb… | ragelink | 73 | |
| 2eca4eb… | ragelink | 74 | ```bash |
| 2eca4eb… | ragelink | 75 | docker compose exec django python manage.py fossil_pull my-project |
| 2eca4eb… | ragelink | 76 | ``` |
| 2eca4eb… | ragelink | 77 | |
| 2eca4eb… | ragelink | 78 | !!! warning "Direction matters" |
| 2eca4eb… | ragelink | 79 | The sync bridge is **one-way**: Fossil to Git. Changes pushed directly to a Git mirror will be overwritten on the next sync. Always push to the Fossil repo. |