Skip to content
Snippets Groups Projects
Commit 988cb786 authored by Temur Maisuradze's avatar Temur Maisuradze
Browse files

supervisord on entrypoint and filebeat as dupervisord service

parent 2b0b9aad
No related branches found
No related tags found
No related merge requests found
[unix_http_server]
file=/tmp/supervisor.sock
[supervisord]
pidfile=/tmp/supervisord.pid
nodaemon=true
logfile=/var/log/supervisor/supervisord.log
logfile_maxbytes=10MB
logfile_backups=10
loglevel=info
childlogdir=/var/log/supervisor/
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///tmp/supervisor.sock
[program:haproxy]
directory=/root
user=root
group=root
command=/bin/bash -c '/usr/local/sbin/haproxy -f /usr/local/etc/haproxy/haproxy.cfg'
autostart=false
autorestart=true
logfile_maxbytes=10MB
stdout_logfile_backups = 0
stderr_logfile_backups = 0
stderr_logfile = /var/log/supervisor/haproxy_stderr.log
stdout_logfile = /var/log/supervisor/haproxy_stdout.log
[program:filebeat]
directory=/opt/filebeat
user=root
group=root
command=/bin/bash -c '/opt/filebeat/filebeat -c /opt/filebeat/filebeat.yml'
autostart=false
autorestart=true
logfile_maxbytes=10MB
stdout_logfile_backups = 0
stderr_logfile_backups = 0
stderr_logfile = /var/log/supervisor/filebeat_stderr.log
stdout_logfile = /var/log/supervisor/filebeat_stdout.log
FROM {{repo}}/openjdk:{{version}}{{suffix}} FROM {{repo}}/openjdk:{{version}}{{suffix}}
USER root USER root
#COPY thehive.repo /etc/yum.repos.d/thehive.repo
#COPY supervisord.conf /etc/supervisord.conf
#COPY start.sh /start.sh
RUN echo "[thehive-project]" > /etc/yum.repos.d/thehive.repo && \ RUN echo "[thehive-project]" > /etc/yum.repos.d/thehive.repo && \
echo "enabled=1" >> /etc/yum.repos.d/thehive.repo && \ echo "enabled=1" >> /etc/yum.repos.d/thehive.repo && \
echo "priority=1" >> /etc/yum.repos.d/thehive.repo && \ echo "priority=1" >> /etc/yum.repos.d/thehive.repo && \
...@@ -29,5 +26,3 @@ RUN echo "[thehive-project]" > /etc/yum.repos.d/thehive.repo && \ ...@@ -29,5 +26,3 @@ RUN echo "[thehive-project]" > /etc/yum.repos.d/thehive.repo && \
EXPOSE 9001 EXPOSE 9001
COPY cortexsupervisord.conf /etc/supervisord.conf COPY cortexsupervisord.conf /etc/supervisord.conf
ENTRYPOINT ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"] ENTRYPOINT ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"]
#USER cortex
# ENTRYPOINT ["/start.sh"]
...@@ -24,6 +24,7 @@ RUN \ ...@@ -24,6 +24,7 @@ RUN \
iptables \ iptables \
pcre2-devel \ pcre2-devel \
daemonize \ daemonize \
supervisor \
pth-devel && \ pth-devel && \
`# Install newest openssl...` \ `# Install newest openssl...` \
wget -O /tmp/openssl.tgz https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz && \ wget -O /tmp/openssl.tgz https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz && \
...@@ -62,10 +63,5 @@ RUN \ ...@@ -62,10 +63,5 @@ RUN \
&& cp -R /usr/src/haproxy/examples/errorfiles /usr/local/etc/haproxy/errors \ && cp -R /usr/src/haproxy/examples/errorfiles /usr/local/etc/haproxy/errors \
&& rm -rf /usr/src/haproxy && rm -rf /usr/src/haproxy
ENTRYPOINT ["/bin/bash"] COPY haproxysupervisord.conf /etc/supervisord.conf
ENTRYPOINT ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"]
# https://www.haproxy.org/download/1.8/doc/management.txt
# "4. Stopping and restarting HAProxy"
# "when the SIGTERM signal is sent to the haproxy process, it immediately quits and all established connections are closed"
# "graceful stop is triggered when the SIGUSR1 signal is sent to the haproxy process"
STOPSIGNAL SIGUSR1
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
- "6000-6099:6000-6099" - "6000-6099:6000-6099"
- "9000:9000" - "9000:9000"
- "9001:9001" - "9001:9001"
entrypoint: "/bin/bash"
interactive: "yes" interactive: "yes"
tags: tags:
- start - start
......
...@@ -58,12 +58,17 @@ ...@@ -58,12 +58,17 @@
- start - start
- name: Start haproxy - name: Start haproxy
shell: "daemonize -c / -p /haproxy.pid /usr/local/sbin/haproxy -f /usr/local/etc/haproxy/haproxy.cfg" shell: "supervisorctl start haproxy"
tags:
- start
- name: Set Autostart for supervisord's services
shell: "sed -i 's/autostart=false/autostart=true/g' /etc/supervisord.conf"
tags: tags:
- start - start
- name: Stop haproxy - name: Stop haproxy
command: "pkill -SIGTERM -F /haproxy.pid" command: "supervisorctl stop haproxy"
tags: tags:
- stop - stop
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment