Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions deploy/compose.remote.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,19 @@
x-drukbox: &drukbox
image: ${DRUKS_SANDBOX_SERVICE_IMAGE:-ghcr.io/czpython/drukbox:latest}
network_mode: host
# Cloud VMs are the sandbox home; the mounted socket serves the docker
# provider that browser-session containers run on. install.sh records the
# socket's gid so drukbox's non-root appuser may use it.
group_add:
- "${DRUKS_DOCKER_GID:-0}"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
env_file:
- ./.env
environment:
DATABASE_URL: postgresql+psycopg://${DRUKS_POSTGRES_USER:-druks}:${DRUKS_POSTGRES_PASSWORD}@127.0.0.1:5432/drukbox
# Browser containers run sshd for the druks user, not root.
DOCKER_SSH_USERNAME: druks
depends_on:
postgres:
condition: service_healthy
Expand Down
20 changes: 11 additions & 9 deletions scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -124,17 +124,19 @@ main() {

# COMPOSE_FILE → .env, so plain `docker compose` in this dir loads the right
# overlay. `local` drives sandboxes on the host Docker daemon (dashboard on
# :8001, no Caddy); `remote` runs the cloud provider + Caddy. For local, the
# socket's gid rides along so drukbox's non-root appuser may use it — on
# macOS the host path is a user-owned symlink, but the socket Docker Desktop
# mounts into containers is group root, so the host gid would grant nothing.
# :8001, no Caddy); `remote` runs the cloud provider + Caddy. Both shapes
# mount the Docker socket — sandboxes on local, browser-session containers
# on remote — so the socket's gid rides along and drukbox's non-root appuser
# may use it. On macOS the host path is a user-owned symlink, but the socket
# Docker Desktop mounts into containers is group root, so the host gid would
# grant nothing.
if [ "$(uname -s)" = "Darwin" ]; then
set_env_var DRUKS_DOCKER_GID "0"
else
set_env_var DRUKS_DOCKER_GID "$(stat -c '%g' /var/run/docker.sock)"
fi
if [ "$PROVIDER" = "docker" ]; then
set_env_var COMPOSE_FILE "compose.yaml:compose.local.yaml"
if [ "$(uname -s)" = "Darwin" ]; then
set_env_var DRUKS_DOCKER_GID "0"
else
set_env_var DRUKS_DOCKER_GID "$(stat -c '%g' /var/run/docker.sock)"
fi
else
set_env_var COMPOSE_FILE "compose.yaml:compose.remote.yaml"
fi
Expand Down