Appearance
ADR 0002: VPS Infrastructure Consolidation
Status
Accepted
Context
The previous VPS infrastructure consisted of multiple independent docker-compose projects scattered across the /opt/ directory (e.g., /opt/traefik, /opt/n8n, /opt/antigravity). This lead to several problems:
- Fragmentation: No single overview of all running services, making it easy to overlook a component.
- Security:
- The
docker.sockwas mountedrwinto theantigravitycontainer, giving the AI desktop instance effective root control over the host. - The MariaDB port 3306 was exposed to the public internet, creating a critical security risk.
- The
- Instability: The
n8nservice was crashing in a restart loop due to incorrect directory ownership on the host. - Missing Health Checks: Containers lacked health check definitions, making it harder to determine their actual operational state automatically.
Decision
We decided to replace the fragmented setup with a single source of truth: a central docker-compose.yml file located at /opt/cfs-infra/docker-compose.yml. This file defines every service, network, and volume in one place.
Specifically, the following changes were made:
- Centralization: All services (Traefik, MariaDB, Antigravity, Portainer, n8n, Ollama, Open-WebUI) are defined in one compose file and share a single
.envfile for secrets. - Security Enhancements:
- Removed the
docker.sockmount from theantigravitycontainer. It now operates as a pure VNC desktop instance. Docker management is handled viaportainer. - Removed the external port mapping for MariaDB. The database is now only accessible via the internal Docker network.
- Removed the
- Stability Fixes: The ownership of
/opt/stacks/n8n/datawas fixed (chown -R 1000:1000), allowingn8nto run stably without crashing. - Resiliency: Added Docker health checks for
cfs-database,n8n, andopen-webui.
Consequences
- Positive: Improved security, easier management, and clear visibility of all running services. The AI desktop operates safely without host privileges.
- Negative/Trade-offs: A single compose file implies that bringing down the stack affects all services simultaneously, although individual services can still be managed (e.g.,
docker compose stop svc). Any changes to infrastructure now require modifying the central file.