Switch from hivemind to supervisord.

Hivemind doesn't have auto-restart capability (it quits with code 0,
which just stops the VM).
This commit is contained in:
Catherine
2025-09-18 12:15:22 +00:00
parent b85b762ba9
commit d48c754b9e
2 changed files with 19 additions and 10 deletions

View File

@@ -1,10 +1,11 @@
# syntax = docker/dockerfile:1
# Build hivemind.
FROM golang:1.25-alpine AS hivemind-builder
# Build supervisor.
FROM golang:1.25-alpine AS supervisor-builder
RUN apk --no-cache add git
WORKDIR /build
RUN GOBIN=/usr/bin go install github.com/DarthSim/hivemind@v1.1.0
RUN git clone https://github.com/ochinchina/supervisord --branch v0.7.3 .
RUN GOBIN=/usr/bin go install
# Build Caddy with S3 storage backend.
FROM caddy:2.10.2-builder AS caddy-builder
@@ -23,7 +24,7 @@ RUN go build -a -o git-pages ./src
# Compose git-pages and Caddy.
FROM alpine:latest
RUN apk --no-cache add ca-certificates
COPY --from=hivemind-builder /usr/bin/hivemind /usr/bin/hivemind
COPY --from=supervisor-builder /usr/bin/supervisord /usr/bin/supervisord
COPY --from=caddy-builder /usr/bin/caddy /usr/bin/caddy
COPY --from=git-pages-builder /build/git-pages /usr/bin/git-pages
@@ -44,11 +45,19 @@ EXPOSE 3000 3001 3002
# While the default command is to run git-pages standalone, the intended configuration
# is to use it with Caddy and store both site data and credentials to an S3-compatible
# object store.
# In a combined configuration, the same container may be used twice, launching either
# `git-caddy` or `caddy run` to start both services.
# In a standalone configuration use port 3000 (http) to connect to git-caddy.
COPY <<EOF Procfile
pages: git-pages
caddy: caddy run
COPY <<EOF supervisord.conf
[program-default]
stderr_logfile = /dev/stderr
stopsignal = TERM
autorestart = true
[program:pages]
command = git-pages
[program:caddy]
command = caddy run
EOF
CMD ["hivemind", "-processes=pages"]
# In a standalone configuration (the default) use port 3000 (http) to connect to git-caddy.
CMD ["git-pages"]

View File

@@ -12,7 +12,7 @@ swap_size_mb = 512
dockerfile = "Dockerfile"
[experimental]
cmd = ["hivemind"]
cmd = ["supervisord"]
[[vm]]
cpu-type = "shared"