docker fixes for salt modules and nats config reload

This commit is contained in:
Josh 2020-11-27 19:31:33 +00:00
parent ae7873a7e3
commit 56fbf8ae0c
3 changed files with 20 additions and 9 deletions

View File

@ -11,6 +11,9 @@ done
mkdir -p /var/log/supervisor
mkdir -p /etc/supervisor/conf.d
# wait for config changes
supervisor_config="$(cat << EOF
[supervisord]
nodaemon=true
@ -18,13 +21,13 @@ nodaemon=true
files = /etc/supervisor/conf.d/*.conf
[program:nats-server]
command=nats-server -DVV --config "${TACTICAL_DIR}/api/nats-rmm.conf"
command=nats-server --config ${TACTICAL_DIR}/api/nats-rmm.conf
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0
redirect_stderr=true
[program:config-watcher]
command="inotifywait -m -e close_write ${TACTICAL_DIR}/api/nats-rmm.conf"; | while read events; do "nats-server --signal reload"; done;
command=/bin/bash -c "inotifywait -mq -e modify "${TACTICAL_DIR}/api/nats-rmm.conf" | while read event; do nats-server --signal reload; done;"
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0
redirect_stderr=true

View File

@ -1,6 +1,7 @@
FROM ubuntu:20.04
ENV TACTICAL_DIR /opt/tactical
ENV TACTICAL_READY_FILE ${TACTICAL_DIR}/tmp/tactical.ready
ENV SALT_USER saltapi
RUN apt-get update && \

View File

@ -4,9 +4,9 @@ set -e
: "${SALT_USER:='saltapi'}"
# wait for salt password to be generated by tactical-init
until [ -f "${TACTICAL_DIR}/tmp/salt_pass" ]; do
echo "waiting for salt password to be generated..."
sleep 15
until [ -f "${TACTICAL_READY_FILE}" ]; do
echo "waiting for init container to finish install or update..."
sleep 10
done
@ -15,7 +15,10 @@ SALT_PASS=$(cat ${TACTICAL_DIR}/tmp/salt_pass)
echo "${SALT_USER}:${SALT_PASS}" | chpasswd
cherrypy_config="$(cat << EOF
module_dirs: ['/opt/tactical/_modules']
file_roots:
base:
- /srv/salt
- ${TACTICAL_DIR}
timeout: 20
gather_job_timeout: 25
max_event_size: 30485760
@ -42,11 +45,15 @@ nodaemon=true
files = /etc/supervisor/conf.d/*.conf
[program:salt-master]
command=/bin/bash -c "salt-master -l debug"
command=/bin/bash -c "salt-master -l info"
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0
redirect_stderr=true
[program:salt-api]
command=/bin/bash -c "salt-api -l debug"
command=/bin/bash -c "salt-api -l info"
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0
redirect_stderr=true
EOF
)"