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

superviord on entrypoint for misp. filebeat as supervisord's service for all containers

parent 6ee16ffa
No related branches found
No related tags found
No related merge requests found
...@@ -47,7 +47,7 @@ autostart=false ...@@ -47,7 +47,7 @@ autostart=false
autorestart=true autorestart=true
[program:misp-modules] [program:misp-modules]
command=/bin/bash -c "/usr/local/bin/misp-modules -l '0.0.0.0' -s" command=/bin/bash -c "/usr/local/bin/misp-modules -l '0.0.0.0' -s && sleep infinity"
user = apache user = apache
autostart=false autostart=false
autorestart=unexpected autorestart=unexpected
...@@ -59,7 +59,7 @@ stderr_logfile = /var/log/supervisor/misp-modules_stderr.log ...@@ -59,7 +59,7 @@ stderr_logfile = /var/log/supervisor/misp-modules_stderr.log
stdout_logfile = /var/log/supervisor/misp-modules_stdout.log stdout_logfile = /var/log/supervisor/misp-modules_stdout.log
[program:workers] [program:workers]
command=/bin/bash /var/www/MISP/app/Console/worker/start.sh command=/bin/bash -c "cleanup() { /var/www/MISP/app/Console/worker/stop.sh; }; trap 'echo signal received!; kill ${child_pid}; wait ${child_pid}; cleanup' SIGINT SIGTERM; /var/www/MISP/app/Console/worker/start.sh; sleep infinity & child_pid=$!; wait ${child_pid};"
user=apache user=apache
autostart=false autostart=false
autorestart=unexpected autorestart=unexpected
...@@ -68,3 +68,16 @@ stdout_logfile_backups = 0 ...@@ -68,3 +68,16 @@ stdout_logfile_backups = 0
stderr_logfile_backups = 0 stderr_logfile_backups = 0
stderr_logfile = /var/log/supervisor/workers_stderr.log stderr_logfile = /var/log/supervisor/workers_stderr.log
stdout_logfile = /var/log/supervisor/workers_stdout.log stdout_logfile = /var/log/supervisor/workers_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
...@@ -31,3 +31,15 @@ stderr_logfile_backups = 0 ...@@ -31,3 +31,15 @@ stderr_logfile_backups = 0
stderr_logfile = /var/log/supervisor/cron_stderr.log stderr_logfile = /var/log/supervisor/cron_stderr.log
stdout_logfile = /var/log/supervisor/cron_stdout.log stdout_logfile = /var/log/supervisor/cron_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
...@@ -5,11 +5,6 @@ ...@@ -5,11 +5,6 @@
src: misp/Dockerfile.j2 src: misp/Dockerfile.j2
dest: "{{role_path}}/files/mispDockerfile" dest: "{{role_path}}/files/mispDockerfile"
- name: Configure the misp supervisor
template:
src: misp/supervisord.conf.j2
dest: "{{role_path}}/files/mispsupervisord.conf"
- name: Configure the misp worker startscript - name: Configure the misp worker startscript
template: template:
src: misp/start.sh.j2 src: misp/start.sh.j2
......
...@@ -5,11 +5,6 @@ ...@@ -5,11 +5,6 @@
src: mysql/Dockerfile.j2 src: mysql/Dockerfile.j2
dest: "{{role_path}}/files/mysqlDockerfile" dest: "{{role_path}}/files/mysqlDockerfile"
- name: Configure the mysql supervisor
template:
src: mysql/supervisord.conf.j2
dest: "{{role_path}}/files/mysqlsupervisord.conf"
- name: Build mysql image - name: Build mysql image
command: docker build -t {{repo}}/mysql:{{version}}{{suffix}} -f {{role_path}}/files/mysqlDockerfile {{role_path}}/files command: docker build -t {{repo}}/mysql:{{version}}{{suffix}} -f {{role_path}}/files/mysqlDockerfile {{role_path}}/files
...@@ -85,4 +85,3 @@ ENV PATH "$PATH:/opt/rh/rh-php72/root/bin/" ...@@ -85,4 +85,3 @@ ENV PATH "$PATH:/opt/rh/rh-php72/root/bin/"
COPY mispsupervisord.conf /etc/supervisord.conf COPY mispsupervisord.conf /etc/supervisord.conf
ENTRYPOINT ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"] ENTRYPOINT ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"]
#ENTRYPOINT ["/bin/bash"]
...@@ -24,6 +24,11 @@ ...@@ -24,6 +24,11 @@
tags: tags:
- start - start
- name: Set Autostart for supervisord's services
shell: "sed -i 's/autostart=false/autostart=true/g' /etc/supervisord.conf"
tags:
- start
- name: Stop Cassandra - name: Stop Cassandra
remote_user: root remote_user: root
command: "supervisorctl stop cassandra" command: "supervisorctl stop cassandra"
......
...@@ -75,6 +75,11 @@ ...@@ -75,6 +75,11 @@
- start - start
- startcortex - startcortex
- name: Set Autostart for supervisord's services
shell: "sed -i 's/autostart=false/autostart=true/g' /etc/supervisord.conf"
tags:
- start
- name: Stop Elasticsearch - name: Stop Elasticsearch
remote_user: root remote_user: root
command: "supervisorctl stop elasticsearch" command: "supervisorctl stop elasticsearch"
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
image: "{{ misp_img }}" image: "{{ misp_img }}"
networks: networks:
- name: "{{ soctools_netname}}" - name: "{{ soctools_netname}}"
entrypoint: "/bin/bash"
interactive: "yes" interactive: "yes"
networks_cli_compatible: yes networks_cli_compatible: yes
published_ports: published_ports:
......
...@@ -22,8 +22,8 @@ ...@@ -22,8 +22,8 @@
- start - start
- name: Start filebeat - name: Start filebeat
shell: "daemonize -c / -p /filebeat.pid -l /filebeat.lock /opt/filebeat/filebeat -c /opt/filebeat/filebeat.yml" remote_user: root
become: true shell: "supervisorctl restart filebeat"
ignore_errors: yes ignore_errors: yes
tags: tags:
- start - start
......
...@@ -113,6 +113,11 @@ ...@@ -113,6 +113,11 @@
tags: tags:
- start - start
- name: Set Autostart for supervisord's services
shell: "sed -i 's/autostart=false/autostart=true/g' /etc/supervisord.conf"
tags:
- start
- name: Stop Keycloak - name: Stop Keycloak
remote_user: root remote_user: root
command: "supervisorctl stop keycloak" command: "supervisorctl stop keycloak"
......
...@@ -63,3 +63,6 @@ ...@@ -63,3 +63,6 @@
with_items: with_items:
- fetchFeed - fetchFeed
- cacheFeed - cacheFeed
- name: Set Autostart for supervisord's services
shell: "sed -i 's/autostart=false/autostart=true/g' /etc/supervisord.conf"
...@@ -57,8 +57,17 @@ ...@@ -57,8 +57,17 @@
- name: Check if database is initialized - name: Check if database is initialized
command: /var/www/MISP/checkdb.sh command: /var/www/MISP/checkdb.sh
- name: Start supervisord - name: Start php-fpm
shell: "/usr/bin/supervisord -c /etc/supervisord.conf &" command: "supervisorctl start php-fpm"
- name: Start MISP Services - name: Start redis-server
command: "supervisorctl start all" command: "supervisorctl start redis-server"
- name: Start apache2
command: "supervisorctl start apache2"
- name: Start misp-modules
command: "supervisorctl start misp-modules"
- name: Start workers
command: "supervisorctl start workers"
--- ---
- name: Stop php-fpm
command: "supervisorctl stop php-fpm"
- name: Stop redis-server
command: "supervisorctl stop redis-server"
- name: Stop apache2
command: "supervisorctl stop apache2"
- name: Stop misp-modules
command: "supervisorctl stop misp-modules"
- name: Stop workers
#command: "supervisorctl start workers"
command: 'su - -s /bin/bash -c "/var/www/MISP/app/Console/worker/stop.sh" apache'
...@@ -18,6 +18,11 @@ ...@@ -18,6 +18,11 @@
tags: tags:
- start - start
- name: Set Autostart for supervisord's services
shell: "sed -i 's/autostart=false/autostart=true/g' /etc/supervisord.conf"
tags:
- start
# CREATE DATABASE IF NOT EXISTS {{misp_dbname}}; # CREATE DATABASE IF NOT EXISTS {{misp_dbname}};
# {% for misp_host in groups['mispcontainers'] %} # {% for misp_host in groups['mispcontainers'] %}
......
...@@ -24,6 +24,11 @@ ...@@ -24,6 +24,11 @@
tags: tags:
- start - start
- name: Set Autostart for supervisord's services
shell: "sed -i 's/autostart=false/autostart=true/g' /etc/supervisord.conf"
tags:
- start
- name: Stop TheHive - name: Stop TheHive
remote_user: root remote_user: root
command: "supervisorctl stop thehive" command: "supervisorctl stop thehive"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment