From d8585a8fd214bb2cf0ef2d435fd0df3df52ad68c Mon Sep 17 00:00:00 2001 From: Seongmin Lee Date: Wed, 13 May 2026 19:38:15 +0900 Subject: [PATCH] spindle: accept extra hosts (mostly for local development) Signed-off-by: Seongmin Lee --- spindle/config/config.go | 29 +++++++++++++++-------------- spindle/engines/nixery/engine.go | 7 ++++++- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/spindle/config/config.go b/spindle/config/config.go index 990b2941..3d264cc3 100644 --- a/spindle/config/config.go +++ b/spindle/config/config.go @@ -9,20 +9,21 @@ import ( ) type Server struct { - ListenAddr string `env:"LISTEN_ADDR, default=0.0.0.0:6555"` - DBPath string `env:"DB_PATH, default=spindle.db"` - Hostname string `env:"HOSTNAME, required"` - JetstreamEndpoint string `env:"JETSTREAM_ENDPOINT, default=wss://jetstream1.us-west.bsky.network/subscribe"` - Tap Tap `env:",prefix=TAP_"` - PlcUrl string `env:"PLC_URL, default=https://plc.directory"` - Dev bool `env:"DEV, default=false"` - Owner string `env:"OWNER, required"` - Secrets Secrets `env:",prefix=SECRETS_"` - LogDir string `env:"LOG_DIR, default=/var/log/spindle"` - QueueSize int `env:"QUEUE_SIZE, default=100"` - MaxJobCount int `env:"MAX_JOB_COUNT, default=2"` // max number of pipelines that run at a time - MaxConcurrentWorkflows int `env:"MAX_CONCURRENT_WORKFLOWS, default=8"` // max number of workflow containers running at once (memory cap) - DockerSocket string `env:"DOCKER_SOCKET"` // path to a docker socket to expose to workflow containers + ListenAddr string `env:"LISTEN_ADDR, default=0.0.0.0:6555"` + DBPath string `env:"DB_PATH, default=spindle.db"` + Hostname string `env:"HOSTNAME, required"` + JetstreamEndpoint string `env:"JETSTREAM_ENDPOINT, default=wss://jetstream1.us-west.bsky.network/subscribe"` + Tap Tap `env:",prefix=TAP_"` + PlcUrl string `env:"PLC_URL, default=https://plc.directory"` + Dev bool `env:"DEV, default=false"` + DevExtraHosts []string `env:"DEV_EXTRA_HOSTS"` + Owner string `env:"OWNER, required"` + Secrets Secrets `env:",prefix=SECRETS_"` + LogDir string `env:"LOG_DIR, default=/var/log/spindle"` + QueueSize int `env:"QUEUE_SIZE, default=100"` + MaxJobCount int `env:"MAX_JOB_COUNT, default=2"` // max number of pipelines that run at a time + MaxConcurrentWorkflows int `env:"MAX_CONCURRENT_WORKFLOWS, default=8"` // max number of workflow containers running at once (memory cap) + DockerSocket string `env:"DOCKER_SOCKET"` // path to a docker socket to expose to workflow containers } type Tap struct { diff --git a/spindle/engines/nixery/engine.go b/spindle/engines/nixery/engine.go index 81746504..8e930084 100644 --- a/spindle/engines/nixery/engine.go +++ b/spindle/engines/nixery/engine.go @@ -235,6 +235,11 @@ func (e *Engine) SetupWorkflow(ctx context.Context, wid models.WorkflowId, wf *m l.Info("creating container") wfLogger.DataWriter(setupStepIdx, "stdout").Write([]byte("Creating container...")) + extraHosts := []string{"host.docker.internal:host-gateway"} + for _, h := range e.cfg.Server.DevExtraHosts { + extraHosts = append(extraHosts, h+":host-gateway") + } + resp, err := e.docker.ContainerCreate(ctx, &container.Config{ Image: addl.image, Cmd: []string{"cat"}, @@ -265,7 +270,7 @@ func (e *Engine) SetupWorkflow(ctx context.Context, wid models.WorkflowId, wf *m CapDrop: []string{"ALL"}, CapAdd: []string{"CAP_DAC_OVERRIDE", "CAP_CHOWN", "CAP_FOWNER", "CAP_SETUID", "CAP_SETGID"}, SecurityOpt: []string{"no-new-privileges"}, - ExtraHosts: []string{"host.docker.internal:host-gateway"}, + ExtraHosts: extraHosts, Resources: container.Resources{ Memory: e.cfg.NixeryPipelines.MaxJobMemoryMB * 1024 * 1024, }, -- 2.51.2