Skip to content

SIDC C2 Admin Install

Hey Sky edited this page Nov 15, 2026 · 3 revisions

SIDC – C2 — Admin & install

🇬🇧 English · 🇩🇪 Deutsche Version

What is this page about? Running C2: Docker deploy, .env settings, large map uploads, backups, the admin area, SIDC catalog files, map packages, the map server for ATAKmaps (API tokens) and the technical architecture. For whom? Server admins. Users and roles are explained on Roles & visibility; overview: SIDC – C2.

1. Architecture

Component Tech
Backend FastAPI (Python 3.12), SQLAlchemy 2.0, Alembic migrations
Database PostgreSQL 17
Realtime backplane Redis Pub/Sub
Frontend Vanilla TypeScript + Vite 6 + MapLibre‑GL 5 + milsymbol@3, built into the backend image
Auth pwdlib argon2 hashes + signed HttpOnly session cookie (itsdangerous), optional OIDC via authlib, login rate limit
TLS / external access external reverse proxy (e.g. Nginx Proxy Manager) — no proxy inside the stack

The Docker Compose stack has the services db, backup (rotating pg_dump), redis, backend and discord-bot (Discord bridge, idle without DISCORD_TOKEN). The backend container is the single entry point and serves frontend, REST API and WebSocket on one port.

  • Schema: on start the backend runs alembic upgrade head; an older database built with create_all is stamped to the baseline 0001_baseline once. create_all + an automatic ALTER TABLE ADD COLUMN stay as a safety net.
  • Volumes: pgdata (database), maps → /data/maps (imported map packages), uploads → /data/uploads (SIDC catalogs at /data/uploads/catalog, generated secret_key), backups (dumps), botdata (bot).
  • Realtime: WebSocket per plan at /plans/{plan_id}/live. backend/app/routers/live.py checks every operation against the caller's effective rights, the per‑marker lock and the phase visibility (player / builder / Zeus):
    • marker.create, stroke.* — the client renders optimistically with a temp id, the server confirms with the real id (marker.upsert incl. cid) or rejects.
    • marker.move / marker.modify / marker.lock / marker.delete — server‑authoritative, broadcast to the plan room.
    • presence.cursor — always allowed (also for viewers: the Point tool).
    • Builder content is only delivered to mission‑builder sockets (and Zeus sockets for released parts). Losing a right closes open sockets; after a reconnect the client resyncs.

2. Install & deploy

cp deploy/.env.example .env
cp docker-compose.example.yml docker-compose.yml
# edit .env: passwords, SECRET_KEY (or leave empty -> auto), FORWARDED_ALLOW_IPS, MAP_IMPORT_MAX_MB, SIDC_IMAGE_TAG
docker compose up -d

Since 1.1.0 nothing is built locally: the stack pulls the published image ghcr.io/gerskyking/sidc---c2---command-control with the tag from SIDC_IMAGE_TAG. Your own docker-compose.yml is a local copy of the template.

Then, in your reverse proxy, add a proxy host pointing at http://<docker-host>:8080 and enable WebSocket support. First login uses BOOTSTRAP_ADMIN_USER / BOOTSTRAP_ADMIN_PASSWORD from .env (idempotently created on every start; placeholder passwords are rejected).

Update an existing deployment (migrations run on start):

# set SIDC_IMAGE_TAG in .env to the new version, e.g. 1.5.0
docker compose pull && docker compose up -d

SIDC_IMAGE_TAG can be a fixed version (1.5.0, recommended), a series (1.5 = patch releases only) or latest. Check the backup before updating. Rollback: set the old tag and repeat the command.

Reset the password of a local account (account, data and rights stay; sessions and API tokens are revoked):

docker compose exec backend python -m app.cli reset-password admin

.env settings

Var Meaning
SIDC_IMAGE_TAG version of the backend image (1.5.0, 1.5 or latest)
HTTP_PORT container port (default 8080)
FORWARDED_ALLOW_IPS IP(s) of the proxy that X-Forwarded-* is trusted from
COOKIE_SECURE auto / true / false — Secure flag of the session cookie (production behind TLS: true)
SECRET_KEY cookie signing key; empty ⇒ generated on first start
POSTGRES_USER / _PASSWORD / _DB, DATABASE_URL database
REDIS_URL WebSocket backplane
BACKUP_KEEP / BACKUP_INTERVAL number of dumps to keep (default 14) / seconds between dumps (default 86400)
BOOTSTRAP_ADMIN_USER / _PASSWORD local admin account
DEFAULT_USER_GROUP put new users (local + first OIDC login) into this group automatically; empty = off
PUBLIC_URL public address — notifications contain a link
NOTIFY_ALLOW_PRIVATE_HOSTS true = allow LAN targets (self‑hosted ntfy/Gotify/Matrix); default only public addresses
BRIDGE_TOKEN long random value for the Discord/Matrix bridge; empty = off
DISCORD_TOKEN, DISCORD_OWNER_ID, BOT_PREFIX Discord bot in the stack; empty token = bot stays off
SMTP_HOST / _PORT / _USER / _PASSWORD / _FROM e‑mail channel; without SMTP_HOST it is greyed out
MAP_IMPORT_MAX_MB hard limit for map‑package uploads (default 2048)
ROAD_COLOR_MAIN / _SECONDARY / _PATH default road colours (users can override them per browser)
AUDIT_LOG_RETENTION_DAYS audit entries older than N days are deleted daily (default 180, 0 = off)
OIDC_ENABLED + OIDC_ISSUER / _CLIENT_ID / _CLIENT_SECRET / _REDIRECT_URL optional external login; local login stays active
OIDC_SYNC_DISPLAY_NAME true = take the display name from the token on every OIDC login and lock it in C2
OIDC_REQUIRED_GROUPS access groups (comma-separated): only users with at least one of them in the token get in; otherwise a rejection page and no account. Empty = every signed-in user
OIDC_ADMIN_GROUPS / _MISSION_BUILDER_GROUPS / _ZEUS_GROUPS / _CREATE_PLANS_GROUPS / _TECHNICIAN_GROUPS / _MANAGE_MAPS_GROUPS rights groups per right. Empty = the right is managed by hand. Set = every OIDC login sets the right exactly as the groups say; each group grants only its own right
OIDC_GROUPS_CLAIM / OIDC_SCOPES name of the groups claim (default groups) / requested scopes (default openid email profile)
OIDC_PROVIDER_NAME name of the sign-in service on the login button (max. 40 characters)
LOCAL_LOGIN all (default) or bootstrap-admin: only the bootstrap admin can sign in locally as an emergency access, form at /?local=1
SESSION_TTL_HOURS session lifetime in hours; 0 = 7 days

Large map uploads (multi‑GB packages)

Two things must be raised together:

  1. Reverse proxy (per proxy host → Advanced):
    client_max_body_size 5120m;
    proxy_request_buffering off;
    proxy_read_timeout 3600s;
    proxy_send_timeout 3600s;
    client_body_timeout 3600s;
    send_timeout 3600s;
    proxy_request_buffering off; is essential — otherwise the whole upload is buffered in the proxy before it reaches the backend.
  2. Backend .env: MAP_IMPORT_MAX_MB=5120 (the backend streams the body straight to disk and rejects anything above this limit).

The maps volume needs roughly 2× the package size free during an import (zip + unpacked copy).

Backup & restore

The backup container writes pg_dump dumps into the volume backups (it only rotates after a successful dump).

gunzip -c <dump>.sql.gz | docker compose exec -T db psql -U "$POSTGRES_USER" -d "$POSTGRES_DB"
# list dumps:  docker compose run --rm backup ls -lt /backups

3. Admin area

Sidebar Administration:

Item Content
Users & groups create local users, role, may create plans, Mission builder, Zeus, Technician, Manage maps, active/inactive, link an account to an OIDC sign-in (one-time link, 24 h), password reset (min. 12 characters; revokes the user's API tokens), Discord user ID, delete; groups with members and the same checkboxes
Log login attempts and all important actions, filterable (admin only)
Storage storage use per project (images, documents, number of plans) and per map, largest first (admin + technician)
Settings SIDC catalog upload, maps (from link, upload, update, DLC, delete), repo sources (Git / Gitea: list .zip / .json / .xlsx and import as map or catalog), legal (imprint and privacy policy as .md/.txt), Discord bridge, Restart backend (~5 s outage)

Who sees what: Users & groups and Storage are visible to admins and technicians (technicians read-only), the Log to admins only. Under Settings, maps and repo sources can only be managed by an admin or someone with the manage maps right; a technician sees the map list there read-only. Rights checkboxes can only be set by a local admin, see Roles & visibility.

The UI is bilingual DE / EN; map place labels support 13 languages (independent of the UI language).

4. Catalog files

C2 uses the same LocalMapData catalog files as the SIDC-Framework mod (format unchanged). The admin uploads them under Settings → SIDC catalog (or imports them from a repo source); max. 8 MB per file, a large file may need the proxy's client_max_body_size raised.

File Used for
SIDC_AllMarkersCatalog.json full marker catalog; the subCategory field keys into the modifier catalog
SIDC_QuickMarkerMenuCatalog.json quick‑menu layout
SIDC_PhaseLineStyleCatalog.json line colours / widths
SIDC_ModifierCatalog.json modifier options per sub‑category (the Advanced dropdowns)
SIDC_Translations.xlsx (game localisation export) symbol names and hover descriptions DE/EN — converted to SIDC_Translations.json on upload

After changing SIDC_AllMarkersCatalog.json (e.g. the subCategory field) also re‑upload the matching SIDC_ModifierCatalog.json. Without a marker catalog the wizard says "No marker catalog uploaded".

5. Map packages

C2 imports the exact same *_mappack_v*.zip packages produced by the ATAKmaps importer (pipeline/map_packages.py, Export tab):

mappack.json                       manifest (optional)
calibration.json                   origin + per-axis scale (game metres <-> fake WGS-84 degrees)
mbtiles/sat.mbtiles                required
mbtiles/terrain.mbtiles            optional - 3D + elevation readout (Terrarium RGB)
mbtiles/grid.mbtiles               optional - coordinate grid raster
mbtiles/dlc/<layer>_z<N>.mbtiles   optional - high-res zoom levels
topo.geojson                       optional - roads/paths
locations.json                     optional - named places, grouped by baseType
contours.geojson / peaks.geojson   optional - contour lines / elevation points
buildings|roads|water|powerlines|trees.geojson   optional - Enfusion TopoExport layers

All raw‑data processing (.topo → GeoJSON, mapLocations → locations.json, heightmap → contours/peaks) happens once in the ATAKmaps importer at pack‑build time; C2 only displays. Older packs with a raw mapLocations_locations.json must be processed in the importer and re‑exported. How contour lines/elevation points are computed: Map & tools.

Import in Settings → Maps: download link, direct upload or repo source (same map ID ⇒ the map is replaced). Update… loads a new ZIP. The map cannot be changed in an existing plan.

6. Map server for ATAKmaps (API tokens)

C2 can act as the map source of the ATAKmaps client (see ATAKmaps): players load maps from C2 instead of installing packages. Markers, live position and calibration stay on the player's machine.

  1. User: gear → API tokens → name (e.g. Laptop), optional expiry in days → Create token. Copy the token — it is shown once; only its SHA‑256 hash is stored. Revoke at any time (the client loses access immediately).
  2. ATAKmaps: setup GUI → tab Kartenserver → name, address (https://…), token.

Rules:

  • A token has the scope maps:read and works only on the read‑only map routes: GET /api/maps, /api/maps/{id}/tiles/…, style.json, topo.geojson, locations.json, contours.geojson, peaks.geojson (plus GET /api/client/ping as a connection test). Plans, markers, drawings, user data, map management and token management are cookie‑session only. Rate‑limited per token.
  • All signed‑in users may load all maps; there are no per‑user map permissions.
  • The client gets whatever quality C2 holds (imported base map, optional DLC). Locally installed maps/DLC take precedence and can add higher zoom levels.
  • A re‑import of a map changes its imported_at, which makes clients drop their cached tiles of that map.

7. Development

# Backend
cd backend && python -m venv .venv && .venv/bin/pip install -r requirements.txt
.venv/bin/uvicorn app.main:app --reload --port 8080
# Frontend (second terminal)
cd frontend && npm install && npm run dev
# Tests
cd backend && pip install -r requirements-dev.txt && pytest -q

If the local repo path contains & (like "SIDC - C2 - Command & Control"), npm scripts break on Windows — use node ./node_modules/vite/bin/vite.js build instead of npm run build. The Docker build is not affected.

Clone this wiki locally