diff options
author | Lila Yasin <lyasin@redhat.com> | 2023-01-04 20:29:40 +0100 |
---|---|---|
committer | Hao Liu <haoli@redhat.com> | 2023-03-30 04:04:43 +0200 |
commit | 65b3e0226d1d4bd725f4752218b9170634d381a6 (patch) | |
tree | 4b95b55881edf8546ef8535225ecfe8143cfbc63 | |
parent | AWX code changes for rsyslog decoupling (#13222) (diff) | |
download | awx-65b3e0226d1d4bd725f4752218b9170634d381a6.tar.xz awx-65b3e0226d1d4bd725f4752218b9170634d381a6.zip |
Created new rsyslog launch file. (#13327)
* Created new rsyslog launch file.
* Rsyslog conf work.
* Refining how we're calling rsyslog conf.
* Removed rsyslog so it no longer launches in the web container.
* Added the new launch_awx_rsyslog.sh to the /usr/bin
5 files changed, 91 insertions, 14 deletions
diff --git a/tools/ansible/roles/dockerfile/files/launch_awx_rsyslog.sh b/tools/ansible/roles/dockerfile/files/launch_awx_rsyslog.sh new file mode 100644 index 0000000000..53ef60f544 --- /dev/null +++ b/tools/ansible/roles/dockerfile/files/launch_awx_rsyslog.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash +if [ `id -u` -ge 500 ]; then + echo "awx:x:`id -u`:`id -g`:,,,:/var/lib/awx:/bin/bash" >> /tmp/passwd + cat /tmp/passwd > /etc/passwd + rm /tmp/passwd +fi + +if [ -n "${AWX_KUBE_DEVEL}" ]; then + pushd /awx_devel + make awx-link + popd + + export SDB_NOTIFY_HOST=$MY_POD_IP +fi + +set -e + +wait-for-migrations + +# This file will be re-written when the dispatcher calls reconfigure_rsyslog(), +# but it needs to exist when supervisor initially starts rsyslog to prevent the +# container from crashing. This was the most minimal config I could get working. +cat << EOF > /var/lib/awx/rsyslog/rsyslog.conf +action(type="omfile" file="/dev/null") +EOF + +exec supervisord -c /etc/supervisor_rsyslog.conf + diff --git a/tools/ansible/roles/dockerfile/tasks/main.yml b/tools/ansible/roles/dockerfile/tasks/main.yml index 1f2a2bac73..7a3953e7ed 100644 --- a/tools/ansible/roles/dockerfile/tasks/main.yml +++ b/tools/ansible/roles/dockerfile/tasks/main.yml @@ -11,6 +11,7 @@ with_items: - "supervisor.conf" - "supervisor_task.conf" + - "supervisor_rsyslog.conf" - name: Render Dockerfile template: diff --git a/tools/ansible/roles/dockerfile/templates/Dockerfile.j2 b/tools/ansible/roles/dockerfile/templates/Dockerfile.j2 index 2477153678..a74129905b 100644 --- a/tools/ansible/roles/dockerfile/templates/Dockerfile.j2 +++ b/tools/ansible/roles/dockerfile/templates/Dockerfile.j2 @@ -194,8 +194,6 @@ ENV _CONTAINERS_USERNS_CONFIGURED="" RUN mkdir -p /etc/containers/registries.conf.d/ && echo "unqualified-search-registries = []" >> /etc/containers/registries.conf.d/force-fully-qualified-images.conf && chmod 644 /etc/containers/registries.conf.d/force-fully-qualified-images.conf {% endif %} -# Create default awx rsyslog config -ADD tools/ansible/roles/dockerfile/files/rsyslog.conf /var/lib/awx/rsyslog/rsyslog.conf ADD tools/ansible/roles/dockerfile/files/wait-for-migrations /usr/local/bin/wait-for-migrations ADD tools/ansible/roles/dockerfile/files/stop-supervisor /usr/local/bin/stop-supervisor @@ -213,8 +211,10 @@ ADD tools/docker-compose/podman-containers.conf /var/lib/awx/.config/containers/ {% else %} ADD tools/ansible/roles/dockerfile/files/launch_awx.sh /usr/bin/launch_awx.sh ADD tools/ansible/roles/dockerfile/files/launch_awx_task.sh /usr/bin/launch_awx_task.sh +ADD tools/ansible/roles/dockerfile/files/launch_awx_rsyslog.sh /usr/bin/launch_awx_rsyslog.sh ADD {{ template_dest }}/supervisor.conf /etc/supervisord.conf ADD {{ template_dest }}/supervisor_task.conf /etc/supervisord_task.conf +ADD {{ template_dest }}/supervisor_rsyslog.conf /etc/supervisor_rsyslog.conf {% endif %} {% if (build_dev|bool) or (kube_dev|bool) %} ADD tools/docker-compose/awx.egg-link /tmp/awx.egg-link diff --git a/tools/ansible/roles/dockerfile/templates/supervisor.conf.j2 b/tools/ansible/roles/dockerfile/templates/supervisor.conf.j2 index 6cd821b9d0..f72b4a6c26 100644 --- a/tools/ansible/roles/dockerfile/templates/supervisor.conf.j2 +++ b/tools/ansible/roles/dockerfile/templates/supervisor.conf.j2 @@ -75,19 +75,8 @@ stdout_logfile_maxbytes=0 stderr_logfile=/dev/stderr stderr_logfile_maxbytes=0 -[program:awx-rsyslogd] -command = rsyslogd -n -i /var/run/awx-rsyslog/rsyslog.pid -f /var/lib/awx/rsyslog/rsyslog.conf -autorestart = true -startsecs = 30 -stopasgroup=true -killasgroup=true -stdout_logfile=/dev/stdout -stdout_logfile_maxbytes=0 -stderr_logfile=/dev/stderr -stderr_logfile_maxbytes=0 - [group:tower-processes] -programs=nginx,uwsgi,daphne,wsbroadcast,awx-rsyslogd +programs=nginx,uwsgi,daphne,wsbroadcast priority=5 [eventlistener:superwatcher] diff --git a/tools/ansible/roles/dockerfile/templates/supervisor_rsyslog.conf.j2 b/tools/ansible/roles/dockerfile/templates/supervisor_rsyslog.conf.j2 new file mode 100644 index 0000000000..8f689e91a0 --- /dev/null +++ b/tools/ansible/roles/dockerfile/templates/supervisor_rsyslog.conf.j2 @@ -0,0 +1,59 @@ +; needs to launch rsyslog +; needs to launch rsyslog-configurer + +[supervisord] +nodaemon = True +umask = 022 +logfile = /dev/stdout +logfile_maxbytes = 0 +pidfile = /var/run/supervisor/supervisor.rsyslog.pid + +[program:awx-rsyslogd] +command = rsyslogd -n -i /var/run/awx-rsyslog/rsyslog.pid -f /var/lib/awx/rsyslog/rsyslog.conf +autorestart = true +startsecs = 30 +stopasgroup=true +killasgroup=true +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 + +[program:awx-rsyslog-configurer] +{% if kube_dev | bool %} +command = make rsyslog-configurer +directory = /awx_devel +{% else %} +command = awx-manage run_rsyslog_configurer +directory = /var/lib/awx +{% endif %} +autorestart = true +startsecs = 30 +stopasgroup=true +killasgroup=true +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 + +[group:tower-processes] +programs=awx-rsyslog-configurer,awx-rsyslogd +priority=5 + +[eventlistener:superwatcher] +command=stop-supervisor +events=PROCESS_STATE_FATAL +autorestart = true +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 + +[unix_http_server] +file=/var/run/supervisor/supervisor.rsyslog.sock + +[supervisorctl] +serverurl=unix:///var/run/supervisor/supervisor.rsyslog.sock ; use a unix:// URL for a unix socket + +[rpcinterface:supervisor] +supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface |