mirror of
https://github.com/jhd3197/ServerKit.git
synced 2026-11-02 10:07:29 +09:00
ServerKit's backend manages the host it runs on -- it creates app dirs under /var/serverkit/apps, drives the host Docker daemon (one container per app), and reloads nginx. The default compose containerized the backend, so it ran as a non-root user into a root-owned /var/serverkit/apps with no host docker.sock: WordPress/app creation failed with `Permission denied: /var/serverkit/apps/...`. It also contradicted install.sh, which runs the backend on the host via systemd and expects compose to bring up only the frontend. - docker-compose.yml: frontend-only; the frontend reaches the host backend via extra_hosts ["backend:host-gateway"]. - backend/Dockerfile: chown /var/serverkit to appuser (latent EACCES on the apps dir for dev/demo container use) + header noting it cannot manage host. - frontend/nginx.conf: document the backend:host-gateway upstream. - docs/DEPLOYMENT.md: add a Deployment model note; fix build/start + data paths. - scripts/test/test_install.sh: T12 guards against re-adding a backend service. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
57 lines
2.1 KiB
YAML
57 lines
2.1 KiB
YAML
# ============================================
|
|
# ServerKit Docker Compose (canonical deployment)
|
|
# ============================================
|
|
# ServerKit's backend manages the HOST it runs on — it creates app directories
|
|
# under /var/serverkit/apps, drives the host Docker daemon (one container per
|
|
# managed app), reloads nginx, and runs systemctl/firewall/PHP-FPM. A backend
|
|
# *inside* a container cannot do any of that, so the backend runs directly on
|
|
# the host (via systemd `serverkit.service`, installed by install.sh) and this
|
|
# compose file builds and serves ONLY the frontend.
|
|
#
|
|
# The frontend's nginx proxies /api and /socket.io to the host backend through
|
|
# the special `backend:host-gateway` alias (see frontend/nginx.conf), so the
|
|
# `backend` upstream resolves to the host regardless of the bridge network.
|
|
#
|
|
# Install (sets up the host backend + this frontend): ./serverkit install
|
|
# Frontend only: docker compose up -d --build
|
|
#
|
|
# Want a quick, throwaway demo with NO host management? Use the single-container
|
|
# image built from ./Dockerfile instead — it bundles both tiers but, as its
|
|
# header notes, cannot manage the host.
|
|
# ============================================
|
|
|
|
services:
|
|
frontend:
|
|
build:
|
|
context: ./frontend
|
|
dockerfile: Dockerfile
|
|
container_name: serverkit-frontend
|
|
ports:
|
|
- "3847:80"
|
|
# Resolve `backend` (used by frontend/nginx.conf) to the host, where the
|
|
# ServerKit backend listens on :5000 under systemd.
|
|
extra_hosts:
|
|
- "backend:host-gateway"
|
|
# install.sh builds the SPA to ./frontend/dist on the host; serve that build
|
|
# directly so a rebuild doesn't require rebuilding the image.
|
|
volumes:
|
|
- ./frontend/dist:/usr/share/nginx/html:ro
|
|
networks:
|
|
- serverkit-network
|
|
restart: unless-stopped
|
|
healthcheck:
|
|
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://127.0.0.1/"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
logging:
|
|
driver: "json-file"
|
|
options:
|
|
max-size: "10m"
|
|
max-file: "3"
|
|
|
|
networks:
|
|
serverkit-network:
|
|
driver: bridge
|
|
name: serverkit-network
|