Move all AzuraCast tasks to run under supervisord in preparation for dockerizing.

This commit is contained in:
Buster Silver 2017-05-30 04:00:41 -05:00
parent a7989671b4
commit ca25ad4c9b
12 changed files with 94 additions and 17 deletions

View File

@ -1,3 +1,5 @@
---
- name: restart influxdb
service: name=influxdb enabled=yes state=restarted
supervisorctl:
name: influxdb
state: restarted

View File

@ -23,12 +23,14 @@
- influxdb
- name: restart influxdb
service: name=influxdb enabled=yes state=restarted
supervisorctl:
name: influxdb
state: restarted
when: influx_installed.changed
- name: Pause to allow InfluxDB to spin up
pause: seconds=15
when: influx_installed.changed
#- name: Pause to allow InfluxDB to spin up
# pause: seconds=15
# when: influx_installed.changed
- name: Create 'stations' database
influxdb_database:
@ -65,4 +67,10 @@
replace: 'bind-address = "localhost:80'
backup: yes
when: app_env == "production"
notify: restart influxdb
- name: Disable service initialization for influxdb
become: true
service: name=influxdb enabled=no state=stopped
when: systemd.stat.exists
notify: restart influxdb

View File

@ -28,4 +28,8 @@
- name: Update pip components
pip: name="{{ item }}" state=latest
with_items:
- pip
- pip
- name: Check if systemd is running
stat: path=/run/systemd/system
register: systemd

View File

@ -1,6 +1,8 @@
---
- name: restart mysql
service: name=mysql enabled=yes state=restarted
supervisorctl:
name: mysql
state: restarted
- name: send mysql notification
debug:

View File

@ -106,4 +106,10 @@
- name: Write DB configuration
become: true
template: src=db.conf.php.j2 dest="{{ www_base }}/app/config/db.conf.php" owner=azuracast group=www-data mode=0644 force=yes
template: src=db.conf.php.j2 dest="{{ www_base }}/app/config/db.conf.php" owner=azuracast group=www-data mode=0644 force=yes
- name: Disable service initialization for mariadb
become: true
service: name=mysql enabled=no state=stopped
when: systemd.stat.exists
notify: restart mysql

View File

@ -1,3 +1,5 @@
---
- name: restart nginx
service: name=nginx enabled=yes state=restarted
supervisorctl:
name: nginx
state: restarted

View File

@ -38,4 +38,10 @@
dest: /etc/nginx/nginx.conf
regexp: 'sendfile on;'
replace: 'sendfile off;'
when: app_env == "development"
when: app_env == "development"
- name: Disable service initialization for nginx
become: true
service: name=nginx enabled=no state=stopped
when: systemd.stat.exists
notify: restart nginx

View File

@ -1,3 +1,5 @@
---
- name: restart php-fpm
service: name=php7.1-fpm enabled=yes state=restarted
supervisorctl:
name: php7-fpm
state: restarted

View File

@ -87,4 +87,10 @@
option: "{{ item.option }}"
value: "{{ item.value }}"
with_items:
- { option: 'short_open_tag', value: "On" }
- { option: 'short_open_tag', value: "On" }
- name: Disable service initialization for php-fpm
become: true
service: name=php7.1-fpm enabled=no state=stopped
when: systemd.stat.exists
notify: restart php-fpm

View File

@ -7,6 +7,12 @@
- name: Change supervisord configuration
become: true
template: src=supervisord.conf.j2 dest=/etc/supervisor/supervisord.conf force=yes
register: supervisord_conf
- name: Add core supervisord configuration
become: true
template: src=core.conf.j2 dest=/etc/supervisor/conf.d/core.conf force=yes
register: supervisord_core
- name: Kill legacy radio processes (if upgrading from older version)
become: true
@ -17,4 +23,6 @@
- name: Trigger manual restart of supervisord (if not already running)
become: true
service: name=supervisor enabled=yes state=restarted
when: supervisord_install.changed
when:
- systemd.stat.exists
- supervisord_install.changed or supervisord_conf.changed or supervisord_core.changed

View File

@ -0,0 +1,31 @@
[group:core]
programs=php7-fpm,mysqld,nginx,influxdb
[program:php7-fpm]
command=/usr/sbin/php-fpm7.1 -F -c /etc/php/7.1/fpm/
autostart=true
autorestart=true
priority=5
[program:mysqld]
command=/usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib/mysql/plugin --user=mysql --log-error=/var/log/mysql/error.log --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/run/mysqld/mysqld.sock --port=3306
autostart=true
autorestart=true
stdout_events_enabled=true
stderr_events_enabled=true
[program:nginx]
command=/usr/sbin/nginx -g 'daemon off;'
autostart=true
autorestart=true
priority=10
stdout_events_enabled=true
stderr_events_enabled=true
[program:influxdb]
command=/usr/bin/influxd -config /etc/influxdb/influxdb.conf
autostart=true
autorestart=true
priority=10
stdout_events_enabled=true
stderr_events_enabled=true

View File

@ -14,9 +14,9 @@
- init
- azuracast-config
- { role: azuracast-radio, when: update_revision|int < 8 }
- { role: nginx, when: update_revision|int < 5 }
- { role: php, when: update_revision|int < 3 }
- { role: influxdb, when: update_revision|int < 2 }
- { role: supervisord, when: update_revision|int < 2 }
- { role: nginx, when: update_revision|int < 9 }
- { role: php, when: update_revision|int < 9 }
- { role: influxdb, when: update_revision|int < 9 }
- { role: supervisord, when: update_revision|int < 9 }
- { role: azuracast-cron, when: update_revision|int < 2 }
- azuracast-update