This document describes the automated workflow for maintaining this fork of Bazarr.
This fork contains custom modifications (primarily the OpenSubtitles.org web scraper provider) that are automatically kept in sync with the upstream Bazarr repository. The workflow handles:
- Upstream Synchronization - Daily automatic merging of upstream changes
- Conflict Resolution - Automatic PR creation when merge conflicts occur
- Docker Builds - Automated multi-architecture Docker image builds
- Publishing - Images published to GitHub Container Registry
┌─────────────────────────────────────────────────────────────────────────────┐
│ GitHub Actions Workflows │
├─────────────────────────────────────────────────────────────────────────────┤
│ │
│ ┌─────────────────────┐ ┌─────────────────────────────────────┐ │
│ │ sync-upstream.yml │ │ build-docker.yml │ │
│ │ │ │ │ │
│ │ • Daily 4 AM UTC │────────>│ • Build frontend │ │
│ │ • Fetch upstream │ trigger │ • Build Docker image │ │
│ │ • Auto merge │ │ • Push to ghcr.io │ │
│ │ • Conflict PR │ │ • multi-arch (amd64/arm64) │ │
│ └─────────────────────┘ └─────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────────────────┘
Schedule: Daily at 4:00 AM UTC (5:00 AM Budapest time)
Triggers:
- Scheduled cron job
- Manual dispatch from GitHub Actions UI
Process:
- Fetches latest commits from
morpheus65535/bazarr:master - Compares with current fork
- Attempts automatic merge
- If successful: pushes changes and triggers Docker build
- If conflicts: creates a PR with
sync-conflictlabel
Manual Trigger:
# Via GitHub CLI
gh workflow run sync-upstream.yml
# With force sync (even if no new commits)
gh workflow run sync-upstream.yml -f force_sync=trueTriggers:
- Push to
mainbranch - Called by sync workflow after successful merge
- Manual dispatch
- Tag creation (for releases)
Output:
ghcr.io/lavx/bazarr:latest- Latest buildghcr.io/lavx/bazarr:vX.Y.Z-lavx.YYYYMMDD- Versioned buildghcr.io/lavx/bazarr:sha-XXXXXXX- Git SHA reference
docker run -d \
--name bazarr \
-p 6767:6767 \
-v /path/to/config:/config \
-v /path/to/movies:/movies \
-v /path/to/tv:/tv \
-e PUID=1000 \
-e PGID=1000 \
-e TZ=Europe/Budapest \
ghcr.io/lavx/bazarr:latestCreate a docker-compose.yml:
services:
bazarr:
image: ghcr.io/lavx/bazarr:latest
container_name: bazarr
restart: unless-stopped
ports:
- "6767:6767"
environment:
- PUID=1000
- PGID=1000
- TZ=Europe/Budapest
volumes:
- ./config:/config
- /path/to/movies:/movies
- /path/to/tv:/tvThen run:
docker compose up -d| Variable | Default | Description |
|---|---|---|
PUID |
1000 |
User ID for file permissions |
PGID |
1000 |
Group ID for file permissions |
TZ |
UTC |
Timezone (e.g., Europe/Budapest) |
When upstream changes conflict with fork modifications:
- Notification: A PR is automatically created with the
sync-conflictlabel - Review: Check the PR for conflict markers
- Fix locally:
git fetch origin sync/upstream-XXXXXXXX git checkout sync/upstream-XXXXXXXX # Resolve conflicts in your editor git add . git commit -m "Resolve merge conflicts" git push origin sync/upstream-XXXXXXXX
- Merge: Merge the PR via GitHub UI
- Build: Docker build will trigger automatically
These files are unique to this fork and should be preserved during merges:
| File | Purpose |
|---|---|
custom_libs/subliminal_patch/providers/opensubtitles_scraper.py |
OpenSubtitles.org scraper mixin |
custom_libs/subliminal_patch/providers/opensubtitles.py |
Modified provider with scraper support |
opensubtitles-scraper/ |
Git submodule - web scraper service |
package_info |
Fork identification (shown in System Status) |
bazarr/app/check_update.py |
Modified to use fork's releases |
.github/workflows/sync-upstream.yml |
Upstream sync workflow |
.github/workflows/build-docker.yml |
Docker build workflow |
Dockerfile |
Production Docker image |
docker-compose.yml |
User deployment template |
.gitattributes |
Merge conflict protection rules |
This fork includes the OpenSubtitles Scraper as a git submodule. The scraper is a standalone service that provides web scraping capabilities for OpenSubtitles.org.
┌────────────────────┐ HTTP API ┌─────────────────────────┐
│ Bazarr │ ───────────────> │ OpenSubtitles Scraper │
│ (LavX Fork) │ │ (Port 8765) │
│ │ <─────────────── │ │
│ Uses provider: │ JSON Response │ Scrapes: │
│ opensubtitles.org │ │ - opensubtitles.org │
└────────────────────┘ └─────────────────────────┘
The docker-compose.yml includes both services:
services:
opensubtitles-scraper:
image: ghcr.io/lavx/opensubtitles-scraper:latest
ports:
- "8765:8765"
bazarr:
image: ghcr.io/lavx/bazarr:latest
depends_on:
- opensubtitles-scraper
environment:
- OPENSUBTITLES_SCRAPER_URL=http://opensubtitles-scraper:8765To update the scraper to the latest version:
cd opensubtitles-scraper
git pull origin main
cd ..
git add opensubtitles-scraper
git commit -m "Update opensubtitles-scraper submodule"
git pushThis fork uses a versioning scheme that combines upstream version with fork identifier:
{upstream_version}-lavx.{date}
Example: v1.5.3-lavx.20241214
This makes it clear:
- Which upstream version the build is based on
- When the fork build was created
- That it contains fork-specific modifications
The Docker image runs with --no-update flag to prevent Bazarr's built-in update mechanism from overwriting your fork modifications. This is intentional.
| Scenario | Behavior |
|---|---|
| Docker Container | Auto-update disabled; use new Docker image for updates |
| Manual Installation | Auto-update can be enabled, but will pull from this fork |
| Release Info in UI | Shows releases from this fork (LavX/bazarr) |
The fork is configured to check releases from LavX/bazarr instead of upstream. This is controlled by:
# In bazarr/app/check_update.py
RELEASES_REPO = os.environ.get('BAZARR_RELEASES_REPO', 'LavX/bazarr')To change the release source (e.g., for debugging), set the environment variable:
# docker-compose.yml
environment:
- BAZARR_RELEASES_REPO=morpheus65535/Bazarr # Use upstream releasesTo update to a new version:
# Pull the latest image
docker compose pull
# Recreate the container
docker compose up -d
# Or in one command
docker compose up -d --pull always- Preservation of modifications: Auto-update would download vanilla Bazarr, losing the OpenSubtitles scraper
- Immutable containers: Docker best practices recommend replacing containers rather than modifying them
- Reproducibility: Pinned versions ensure consistent behavior
- Rollback capability: Easy to rollback by pulling a specific tag
- Check the workflow logs in GitHub Actions
- Verify upstream repository is accessible
- Check if there are unresolved conflicts from previous sync
- Check if frontend build succeeded
- Verify all required files are present
- Check for syntax errors in Dockerfile
# Login to GitHub Container Registry
echo $GITHUB_TOKEN | docker login ghcr.io -u USERNAME --password-stdin
# Pull the image
docker pull ghcr.io/lavx/bazarr:latestWhen making changes to fork-specific files:
- Test changes locally first
- Ensure changes don't conflict with upstream structure
- Document any new environment variables or features
- Update this documentation if workflow changes