stronghold/references/examples/ANALYSIS.md
robojerk c31e48e2b1 Proof of concept: Container management with FastAPI backend
- FastAPI backend with REST API endpoints
- SQLite database for container metadata
- Docker/Podman SDK integration with label filtering
- Frontend: Server creation form and management page
- Container operations: create, list, start, stop, delete
- Single container deployment (nginx + Python + supervisor)
- Support for Docker and Podman (rootless)
- Volume management for persistent data
2025-10-31 11:50:31 -07:00

5.2 KiB

Docker Compose Examples Analysis

This document analyzes various docker-compose.yml examples to identify patterns, edge cases, and implementation requirements for Stronghold.

Common Patterns

Basic Server Setup

Pattern Elements:

  • Image: itzg/minecraft-server
  • Required: EULA=TRUE
  • Port mapping: 25565:25565
  • Volume: Persistent data storage
  • Environment variables for configuration

Modded Server Setup

Pattern Elements:

  • TYPE: FORGE, FABRIC, or other mod loader
  • MODPACK or MODS: Modpack/mod installation
  • Additional memory allocation
  • Mod volume mounts (/mods)
  • Config volume mounts (/config)

Plugin Server Setup

Pattern Elements:

  • TYPE: PAPER, SPIGOT, BUKKIT
  • Plugin volume mounts (/plugins)
  • PLUGINS environment variable or volume

Proxy Server Setup

Pattern Elements:

  • Image: itzg/mc-proxy
  • PROXY_TYPE: BUNGEE, VELOCITY, WATERFALL
  • Backend server configuration
  • Network linking

Edge Cases to Handle

1. Multiple Mod Sources

environment:
  COPY_MODS_SRC: /mods-common,/mods-local
volumes:
  - ../shared-mods:/mods-common:ro
  - ./local-mods:/mods-local:ro

Stronghold needs: UI to manage multiple mod source directories

2. Generic Pack with Custom Configuration

environment:
  GENERIC_PACK: https://example.com/server-pack.zip
  GENERIC_PACKS_DISABLE_MODS: "conflicting-mod.jar"
  APPLY_EXTRA_FILES: "config/server.properties<https://example.com/custom.properties"

Stronghold needs: Support for generic packs and file patching

3. Environment Variable Substitution in Configs

environment:
  REPLACE_ENV_SUFFIXES: "yml,yaml,properties,json"
  REPLACE_ENV_VARIABLES_EXCLUDES: "secrets.yml"
volumes:
  - ./config:/config

Stronghold needs: UI for managing env var substitution rules

4. Auto-removal of Mods/Plugins

environment:
  REMOVE_OLD_MODS: "TRUE"
  REMOVE_OLD_MODS_INCLUDE: "*.jar"
  REMOVE_OLD_MODS_EXCLUDE: "core-mod.jar"
  REMOVE_OLD_MODS_DEPTH: 1

Stronghold needs: Options for mod/plugin cleanup behavior

5. Multiple Generic Packs with Prefix/Suffix

environment:
  GENERIC_PACKS: configs-v9.0.1,mods-v4.3.6
  GENERIC_PACKS_PREFIX: "https://cdn.example.org/"
  GENERIC_PACKS_SUFFIX: ".zip"

Stronghold needs: Support for batch generic pack installation

6. Mod/Plugin URL Lists via File

environment:
  MODS_FILE: /extras/mods.txt
volumes:
  - ./mods-list.txt:/extras/mods.txt:ro

Stronghold needs: File-based mod/plugin list management

7. Custom Copy Destinations

environment:
  COPY_PLUGINS_SRC: /plugins-custom
  COPY_PLUGINS_DEST: /data/plugins
  COPY_MODS_SRC: /mods-custom
  COPY_MODS_DEST: /data/mods
  COPY_CONFIG_SRC: /config-custom
  COPY_CONFIG_DEST: /data/config

Stronghold needs: Advanced volume mount configuration options

8. Multi-Server Network with Proxy

Complex Setup:

  • Multiple backend servers
  • Proxy server
  • Internal Docker network
  • Port mapping coordination
  • Service dependencies

Stronghold needs: Multi-container orchestration UI

9. Modpack Updates with Checksum Control

environment:
  MODPACK: modrinth:abc123
  SKIP_GENERIC_PACK_CHECKSUM: "false"
  SKIP_GENERIC_PACK_UPDATE_CHECK: "false"
  FORCE_GENERIC_PACK_UPDATE: "true"

Stronghold needs: Modpack update management UI

10. Hybrid Server (Mods + Plugins)

environment:
  TYPE: MAGMA  # or other hybrid type
  USES_PLUGINS: "true"
volumes:
  - ./mods:/mods
  - ./plugins:/plugins

Stronghold needs: Detection and configuration of hybrid server types

Configuration Complexity Levels

Level 1: Simple

  • Basic vanilla server
  • Minimal configuration
  • Default settings

Stronghold UI: Simple wizard, minimal options

Level 2: Standard

  • Common server types (Paper, Forge, Fabric)
  • Standard modpack installation
  • Basic resource allocation

Stronghold UI: Guided setup with sensible defaults

Level 3: Advanced

  • Custom configurations
  • Multiple mod sources
  • Environment variable substitution
  • Custom volumes

Stronghold UI: Advanced options panel, expert mode

Level 4: Expert

  • Edge cases
  • Manual docker-compose editing
  • Complex network setups
  • Custom scripts

Stronghold UI: YAML editor with validation, export/import

Stronghold Implementation Priorities

Phase 1 (MVP)

  • Level 1 configurations (simple servers)
  • Basic modpack installation (MODPACK env var)
  • Standard volume mounts

Phase 2 (V1.0)

  • Level 2 configurations
  • Individual mod/plugin management
  • Multiple mod sources
  • Basic generic pack support

Phase 3 (V1.5+)

  • Level 3 configurations
  • Advanced volume mount options
  • Environment variable substitution UI
  • Multi-server orchestration

Phase 4 (Future)

  • Level 4 expert mode
  • YAML editor/validator
  • Import existing docker-compose files
  • Template marketplace

Key Takeaways

  1. Most users need Level 1-2: Focus UI on these first
  2. Edge cases are powerful: Support them but don't make them required
  3. Flexibility is key: Allow export to docker-compose.yml for advanced users
  4. Validate configurations: Check for conflicts and errors before applying
  5. Presets help: Provide templates for common scenarios
  6. Documentation: Link to itzg docs for advanced features