Logo

Ganymede

Ganymede is a Twitch VOD and Live Stream archiving platform with a real-time chat experience. Every archive includes a rendered chat for viewing outside of Ganymede. Files are saved in a friendly format allowing for use without Ganymede.

--- ## Screenshot ![ganymede-readme_landing](https://github.com/user-attachments/assets/b1c024f5-f5ad-4611-84db-42d599364a74) https://github.com/user-attachments/assets/184451f1-e3ce-4329-8516-a9842648c01b ## About Ganymede allows archiving of past streams (VODs) and live streams with a real-time chat playback along with a archival-friendly rendered chat. All files are saved in a friendly way that doesn't require Ganymede to view them (see [file structure](https://github.com/Zibbp/ganymede/wiki/File-Structure)). Ganymede is the successor of [Ceres](https://github.com/Zibbp/Ceres). ## Features - Realtime Chat Playback - SSO / OAuth authentication ([wiki](https://github.com/Zibbp/ganymede/wiki/SSO---OpenID-Connect)) - Light/dark mode toggle. - 'Watched channels' - Allows watching channels for archiving past broadcasts and live streams. Includes advanced filtering options. - Twitch VOD/Livestream support. - Full VOD, Channel, and User management. - Custom post-download video FFmpeg parameters. - Custom chat render parameters. - Webhook notifications. - Simple file structure for long-term archival that will outlast Ganymede. - Recoverable queue system. - Playback / progress saving. - Playlists. ## Documentation For in-depth documentation on features visit the [wiki](https://github.com/Zibbp/ganymede/wiki). ## API Visit the [docs](https://github.com/Zibbp/ganymede/tree/main/docs) folder for the API docs. ## Translations See the [messages](https://github.com/Zibbp/ganymede/tree/main/frontend/messages) directory for available translations. If you would like to add a new translation, please create a pull request with the new translation file. The file should be named `.json` where `` is the language code (e.g. `de.json` for German). Additionally the language needs to be added to the navbar in the `frontend/app/layout/Navbar.tsx` file in the `languages` array. Use the `frontend/translation-coverage.js` script to see what has been translated or with the `-u` option to populate missing keys in translation files. ## Installation ### Requirements - Linux environment with Docker. - _Optional_ network mounted storage. - 50gb+ free storage, see [storage requirements](https://github.com/Zibbp/ganymede/wiki/Storage-Requirements). - A Twitch Application - [Create an application](https://dev.twitch.tv/console/apps/create). ### Installation Ganymede consists of two docker containers: 1. Server 2. Postgres Database Feel free to use an existing Postgres database container if you don't want to spin new ones up. 1. Download `compose.yaml` and `.env.example` into the same directory. 2. Copy `.env.example` to `.env` and edit it: set the Twitch credentials, choose a database password, and set the host storage paths. See [environment variables](https://github.com/Zibbp/ganymede#environment-variables) for more information. Keep `.env` private: it contains credentials. 3. Run `docker compose up -d` from that directory. 4. Visit `http://:4800` (or the port set by `GANYMEDE_PORT`) and log in with username: `admin` password: `ganymede`. 5. Change the admin password _or_ create a new user, grant admin permissions on that user, and delete the admin user. #### Migrating an existing Compose installation Copy your existing settings and host and container paths into `.env` before starting the new Compose file. Keep the same Compose project directory, project name, and database storage path to use the existing data. If you used `-p` or `COMPOSE_PROJECT_NAME`, continue using the same project name. Remove or rename the old `docker-compose.yml` after adopting `compose.yaml`, and migrate any settings in an existing `docker-compose.override.yml` to `compose.override.yaml`. Changing `DB_USER`, `DB_PASS`, or `DB_NAME` in `.env` does not update an already initialized PostgreSQL database; keep its existing credentials or change them in PostgreSQL as well. Single-quote passwords containing `$` in `.env` to prevent Compose interpolation. For example, write `DB_PASS='pa$word'` to preserve the literal password `pa$word`. PostgreSQL is no longer published on host port 4801. If host access is needed, add a `compose.override.yaml` with a port mapping, preferably bound to localhost, and attach PostgreSQL to the default network as well as its internal database network: ```yaml services: ganymede-db: ports: - "127.0.0.1:4801:5432" networks: - default ``` #### Stop grace period A clean shutdown can take up to ~80s. The example compose file sets `stop_grace_period: 90s`; on Kubernetes set `terminationGracePeriodSeconds: 90`. A fatal process error stops the container with exit code `0`, so use the `unless-stopped`/`always` restart policy, not `on-failure`. ### Images Images are published to ghcr.io. There are four types of tags available. | Tag | Description | | -------------------- | ------------------------------------------------------------------------ | | latest | Points to the latest release. | | semver - e.g. 4.10.0 | The latest release in semver format. | | dev | Build of the 'main' branch. Use for testing new features before release. | | pr-* - e.g. pr-123 | Build of a pull request. Gets deleted when the PR is closed. | ### Rootless The API container can be run as a non root user. To do so add `PUID` and `PGID` environment variables, setting the value to your user. Read [linuxserver's docs](https://docs.linuxserver.io/general/understanding-puid-and-pgid) about this for more information. Note: On startup the container will `chown` the config, temp, and logs directories. It will not recursively `chown` the videos directory (`/data/videos` by default). Ensure the mounted videos directory is readable by the set user. If your storage does not support `chown`, such as an NFS or SMB mount (e.g. TrueNAS with NFSv4 ACLs), set `SKIP_CHOWN=true` to skip this step. Ensure the directories are already writable by the set user. ### Config A configuration file is generate on initial start of Ganymede. By default the configuration is at `/data/config/config.json`. See the [config.go](https://github.com/Zibbp/ganymede/blob/main/internal/config/config.go) file for a full list of configuration settings. Most of the settings can be configured in the Web UI by navigating to Admin > Settings. ### Environment Variables The `.env.example` file documents the Compose settings and common environment variables. Below is a list of environment variables and their descriptions. See the [env.go](https://github.com/Zibbp/ganymede/blob/main/internal/config/env.go) file for a full list of all environment variables and their default values. In the Compose example, `GANYMEDE_PORT` sets the host port for the web interface (default `4800`). `VIDEOS_HOST_DIR`, `TEMP_HOST_DIR`, `LOGS_HOST_DIR`, `CONFIG_HOST_DIR`, and `DB_HOST_DIR` select the host storage locations. Relative paths are resolved from the Compose project directory. The corresponding application `*_DIR` values select paths inside the container. Shell variables take precedence over `.env` for Compose interpolation; directory paths and shared database credentials are passed to both services or mounts using those interpolated values. PostgreSQL uses a dedicated internal network shared with Ganymede; Ganymede also uses the default network for external connectivity. ##### Server | ENV Name | Description | | --------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `DEBUG` | Enable debug logging `true` or `false`. | | `VIDEOS_DIR` | Path inside the container to the videos directory. Default: `/data/videos`. | | `TEMP_DIR` | Path inside the container where temporary files are stored during archiving. Default: `/data/temp`. | | `LOGS_DIR` | Path inside the container where log files are stored. Default: `/data/logs`. | | `CONFIG_DIR` | Path inside the container where the config is stored. Default: `/data/config`. | | `SKIP_CHOWN` | _Optional_ Skip `chown` of the data directories on startup. Useful when storage does not support `chown`, e.g. NFS/SMB. Default: `false`. | | `PATH_MIGRATION_ENABLED` | Enable path migration at startup. Default: `true`. | | `TZ` | Timezone. | | `DB_HOST` | Host of the database. | | `DB_PORT` | Port of the database. | | `DB_USER` | Username for the database. | | `DB_PASS` | Password for the database. | | `DB_NAME` | Name of the database. | | `DB_SSL` | Whether to use SSL. Default: `disable`. See [DB SSL](https://github.com/Zibbp/ganymede/wiki/DB-SSL) for more information. | | `DB_SSL_ROOT_CERT` | _Optional_ Path to DB SSL root certificate. See [DB SSL](https://github.com/Zibbp/ganymede/wiki/DB-SSL) for more information. | | `DB_MAX_CONNS` | _Optional_ Caps each Postgres pool. API and worker each open 2 pools, and the worker's task queue holds 1 more connection outside its pool, so the total is at most 4 × value + 1 (`5` allows 21). Low values queue requests under load. Minimum `2`. Default: library defaults. | | `TWITCH_CLIENT_ID` | Twitch application client ID. | | `TWITCH_CLIENT_SECRET` | Twitch application client secret. | | `OAUTH_ENABLED` | _Optional_ Wether OAuth is enabled `true` or `false`. Must have the other OAuth variables set if this is enabled. | | `OAUTH_PROVIDER_URL` | _Optional_ OAuth provider URL. See https://github.com/Zibbp/ganymede/wiki/SSO---OpenID-Connect | | `OAUTH_CLIENT_ID` | _Optional_ OAuth client ID. | | `OAUTH_CLIENT_SECRET` | _Optional_ OAuth client secret. | | `OAUTH_REDIRECT_URL` | _Optional_ OAuth redirect URL, points to the API. Example: `http://localhost:4000/api/v1/auth/oauth/callback`. | | `MAX_CHAT_DOWNLOAD_EXECUTIONS` | Maximum number of chat downloads that can be running at once. Live streams bypass this limit. This is memory-intensive, using around 1.9GB (per execution). CPU is negligible. Uses some network bandwidth. | | `MAX_CHAT_RENDER_EXECUTIONS` | Maximum number of chat renders that can be running at once. This is very CPU-intensive. Memory is around 500MB (per execution). | | `MAX_VIDEO_DOWNLOAD_EXECUTIONS` | Maximum number of video downloads that can be running at once. Live streams bypass this limit. Is storage- and network-intensive. | | `MAX_VIDEO_CONVERT_EXECUTIONS` | Maximum number of video conversions that can be running at once. Can be resource-intensive depending on your FFmpeg arguments. By default, it is storage intensive and uses some memory. | | `MAX_VIDEO_SPRITE_THUMBNAIL_EXECUTIONS` | Maximum number of video sprite thumbnail generation jobs that can be running at once. CPU, memory, and storage utilization is negligible. | | `DISABLE_LIVE_ARCHIVE_STALL_CHECK` | Disable FFmpeg progress based stall detection for live archives. Default: `false`. | | `LIVE_ARCHIVE_STALL_TIMEOUT_SECONDS` | Seconds without FFmpeg media progress before a live capture is stopped. Default: `180`; values below `30` use the default. | | `SHOW_SSO_LOGIN_BUTTON` | Frontend: `true/false` Show a "login via sso" button on the login page (defaults to false). | | `FORCE_SSO_AUTH` | Frontend: `true/false` Force users to login via SSO by bypassing the login page (defaults to false). | | `REQUIRE_LOGIN` | Frontend: `true/false` Require users to be logged in to view videos (defaults to false). | | `SHOW_LOCALE_BUTTON` | Frontend: `true/false` Show the locale/language button on the navbar (defaults to true). | | `DEFAULT_LOCALE` | Frontend: Sets the default locale/language. Must be the short code of the language. Example: `en` for English, `de` for German. | | `FORCE_LOGIN` | Frontend: `true/false` Force require users to login to view any page (defaults to false). | ##### DB **Ensure these are the same in the API environment variables.** | ENV Name | Description | | ------------------- | --------------------- | | `POSTGRES_PASSWORD` | Database password | | `POSTGRES_USER` | Database username. | | `POSTGRES_DB` | Name of the database. | ### Volumes ##### API | Volume | Description | Example | | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------- | | `/data/videos` | Mount for video storage. This **must** match the `VIDEOS_DIR` environment variable. | `/mnt/nas/vods:/data/videos` | | `/data/logs` | Mount to store task logs. This **must** match the `LOGS_DIR` environment variable. | `./logs:/data/logs` | | `/data/temp` | Mount to store temporary files during the archive process. This is mounted to the host so files are recoverable in the event of a crash. This **must** match the `TEMP_DIR` environment variable. | `./temp:/data/temp` | | `/data/config` | Mount to store the config. This **must** match the `CONFIG_DIR` environment variable. | `./config:/data/config` | ## Development There are two supported development paths: host-native development with [mise](https://mise.jdx.dev/) and Docker Compose, or the all-in-one devcontainer for VS Code/Codespaces. ### Local development (mise + Docker Compose) Toolchains (Go 1.27, Node 26, air, golangci-lint) run natively on your machine via mise, along with ffmpeg/ffprobe for the API's metadata endpoints. PostgreSQL 18 and the pinned media toolchain for worker processing (FFmpeg, yt-dlp, TwitchDownloaderCLI) run in Docker Compose: ```bash mise trust && mise install mise run setup # seeds .env, starts the dev database, installs frontend dependencies mise run db # PostgreSQL 18 on 127.0.0.1:5432 (idempotent; also starts it after setup) mise run server # API server with live reload on :4000 mise run web # Next.js dev server mise run worker # worker with live reload, inside the media image ``` The API server, web server, and worker are long-running services, so run each in its own terminal. The API can enqueue jobs without the worker, but nothing executes them until `mise run worker` is running. | Task | Description | | --------------------- | ------------------------------------------------------------------ | | `mise run setup` | First-time setup: seed `.env`, start dev database, install frontend dependencies | | `mise run db` | Start dev PostgreSQL 18 (127.0.0.1:5432) | | `mise run server` | API server with live reload, native on the host | | `mise run web` | Next.js dev server | | `mise run worker` | Worker with live reload, inside the pinned media image | | `mise run media -- ` | One-off command inside the media image, e.g. `ffmpeg -version` | | `mise run lint` | golangci-lint (same major as CI) | | `mise run test` | Full test suite in Docker, the same `tests` stage CI builds | | `mise run ent` / `mise run swagger` | Ent / Swagger codegen | | `mise run db:tui` | River queue TUI against the dev database | | `mise run dev:chown` | Reclaim `dev/` and `tmp/` from root-owned worker files | `ffmpeg` and `ffprobe` are installed by mise because the host-native API uses them for the video information view and version reporting. `yt-dlp` and `TwitchDownloaderCLI` are only in the pinned media image. Run media processing inside the pinned image, for example `mise run media -- ffmpeg -version`. The worker runs there too: `mise run worker` starts it with live reload against the same database and `dev/` directories. `mise run setup` creates `dev/` and `tmp/` as your user. The worker container runs as root, so files and directories it creates under those bind mounts are root-owned. If the host server then cannot write or clean them up, stop the worker and reclaim them with `mise run dev:chown` (equivalent to `sudo chown -R "$(id -u):$(id -g)" dev tmp`). Run the recovery again after a later worker run creates new paths. Committed Compose files bind services to `127.0.0.1` only. For machine-specific overrides (LAN port publishing, different ports), use an untracked `compose.local.yml` — it is gitignored, and merging it requires Docker Compose >= 2.24.4 for `!override` support: ```yaml # compose.local.yml (untracked) services: db: ports: !override ["0.0.0.0:5432:5432"] # expose the dev DB on the LAN ``` The mise tasks read `COMPOSE_FILE`, which defaults to `compose.dev.yml`. To merge the override, add this to an untracked `mise.local.toml`: ```toml [env] COMPOSE_FILE = "compose.dev.yml:compose.local.yml" ``` If you invoke Compose directly instead of through mise, pass both files explicitly, for example `docker compose -f compose.dev.yml -f compose.local.yml up -d --wait db`. Personal mise overrides (tool versions, env) belong in an untracked `mise.local.toml`. ### Devcontainer A [devcontainer](https://containers.dev/) is included for development. This container includes all the necessary tools to develop Ganymede. Once setup, the [Makefile](/Makefile) can be used to run the development environment. - `make dev_server` - Starts the server. - `make dev_worker` - Starts the worker. - `make dev_web` - Starts the web server. View the [Makefile](/Makefile) for more commands. ## Acknowledgements - [TwitchDownloader](https://github.com/lay295/TwitchDownloader) - [yt-dlp](https://github.com/yt-dlp/yt-dlp) ## License [GNU General Public License v3.0](https://github.com/Zibbp/ganymede/blob/main/LICENSE)