separate config generation from process startup in supervisord (#838)

This commit is contained in:
Adil Hafeez 2026-03-19 22:37:56 -07:00 committed by GitHub
parent cdad02c5ee
commit 180a9cb748
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 30 additions and 9 deletions

View file

@ -50,7 +50,7 @@ FROM python:3.14-slim AS arch
RUN set -eux; \ RUN set -eux; \
apt-get update; \ apt-get update; \
apt-get upgrade -y; \ apt-get upgrade -y; \
apt-get install -y --no-install-recommends gettext-base curl; \ apt-get install -y --no-install-recommends gettext-base curl procps; \
apt-get clean; rm -rf /var/lib/apt/lists/* apt-get clean; rm -rf /var/lib/apt/lists/*
RUN pip install --no-cache-dir supervisor RUN pip install --no-cache-dir supervisor

View file

@ -1,14 +1,33 @@
[supervisord] [supervisord]
nodaemon=true nodaemon=true
pidfile=/var/run/supervisord.pid
[program:config_generator]
command=/bin/sh -c "\
uv run python -m planoai.config_generator && \
envsubst < /app/plano_config_rendered.yaml > /app/plano_config_rendered.env_sub.yaml && \
envsubst < /etc/envoy/envoy.yaml > /etc/envoy.env_sub.yaml && \
touch /tmp/config_ready || \
(echo 'Config generation failed, shutting down'; kill -15 $(cat /var/run/supervisord.pid))"
priority=10
autorestart=false
startsecs=0
stdout_logfile=/dev/stdout
redirect_stderr=true
stdout_logfile_maxbytes=0
stderr_logfile_maxbytes=0
[program:brightstaff] [program:brightstaff]
command=sh -c "\ command=sh -c "\
envsubst < /app/plano_config_rendered.yaml > /app/plano_config_rendered.env_sub.yaml && \ while [ ! -f /tmp/config_ready ]; do echo '[brightstaff] Waiting for config generation...'; sleep 0.5; done && \
RUST_LOG=${LOG_LEVEL:-info} \ RUST_LOG=${LOG_LEVEL:-info} \
PLANO_CONFIG_PATH_RENDERED=/app/plano_config_rendered.env_sub.yaml \ PLANO_CONFIG_PATH_RENDERED=/app/plano_config_rendered.env_sub.yaml \
/app/brightstaff 2>&1 | \ /app/brightstaff 2>&1 | \
tee /var/log/brightstaff.log | \ tee /var/log/brightstaff.log | \
while IFS= read -r line; do echo '[brightstaff]' \"$line\"; done" while IFS= read -r line; do echo '[brightstaff]' \"$line\"; done; \
echo '[brightstaff] Process exited, shutting down'; kill -15 $(cat /var/run/supervisord.pid)"
priority=20
autorestart=false
stdout_logfile=/dev/stdout stdout_logfile=/dev/stdout
redirect_stderr=true redirect_stderr=true
stdout_logfile_maxbytes=0 stdout_logfile_maxbytes=0
@ -16,13 +35,15 @@ stderr_logfile_maxbytes=0
[program:envoy] [program:envoy]
command=/bin/sh -c "\ command=/bin/sh -c "\
uv run python -m planoai.config_generator && \ while [ ! -f /tmp/config_ready ]; do echo '[plano_logs] Waiting for config generation...'; sleep 0.5; done && \
envsubst < /etc/envoy/envoy.yaml > /etc/envoy.env_sub.yaml && \ envoy -c /etc/envoy.env_sub.yaml \
envoy -c /etc/envoy.env_sub.yaml \ --component-log-level wasm:${LOG_LEVEL:-info} \
--component-log-level wasm:${LOG_LEVEL:-info} \ --log-format '[%%Y-%%m-%%d %%T.%%e][%%l] %%v' 2>&1 | \
--log-format '[%%Y-%%m-%%d %%T.%%e][%%l] %%v' 2>&1 | \
tee /var/log/envoy.log | \ tee /var/log/envoy.log | \
while IFS= read -r line; do echo '[plano_logs]' \"$line\"; done" while IFS= read -r line; do echo '[plano_logs]' \"$line\"; done; \
echo '[plano_logs] Process exited, shutting down'; kill -15 $(cat /var/run/supervisord.pid)"
priority=20
autorestart=false
stdout_logfile=/dev/stdout stdout_logfile=/dev/stdout
redirect_stderr=true redirect_stderr=true
stdout_logfile_maxbytes=0 stdout_logfile_maxbytes=0