Move Ansible core tasks to supervisord.

This commit is contained in:
Buster "Silver Eagle" Neece 2022-05-26 20:07:17 -05:00
parent 9da3a35c20
commit 32136d754b
No known key found for this signature in database
GPG Key ID: F1D2E64A0005E80E
18 changed files with 150 additions and 30 deletions

View File

@ -34,7 +34,7 @@ else
fi
APP_ENV="${APP_ENV:-production}"
UPDATE_REVISION="${UPDATE_REVISION:-82}"
UPDATE_REVISION="${UPDATE_REVISION:-83}"
echo "Updating AzuraCast (Environment: $APP_ENV, Update revision: $UPDATE_REVISION)"

View File

@ -1,3 +0,0 @@
---
- name: restart cron
service: name=cron enabled=yes state=restarted

View File

@ -21,3 +21,17 @@
file:
path: "{{ tmp_base }}/azuracast_cron"
state: absent
- name: Install Cron Supervisord conf
template:
src: supervisor.conf.j2
dest: /etc/supervisor/conf.d/cron.conf
force: true
mode: 0644
- name: Disable Cron service
service:
name: "cron"
enabled: false
state: stopped
ignore_errors: true

View File

@ -1,4 +1,2 @@
* * * * * php {{ www_base }}/bin/console azuracast:sync:run
*/5 * * * * php {{ www_base }}/bin/console azuracast:sync:nowplaying --timeout=300
*/5 * * * * php {{ www_base }}/bin/console queue:process 275
0 */6 * * * tmpreaper 12h /var/azuracast/stations/*/temp

View File

@ -0,0 +1,6 @@
[program:cron]
command=/usr/sbin/cron -f
priority=600
numprocs=1
autostart=true
autorestart=unexpected

View File

@ -9,3 +9,17 @@
dest: /etc/default/beanstalkd
force: true
mode: 0644
- name: Install Beanstalkd Supervisord conf
template:
src: supervisor.conf.j2
dest: /etc/supervisor/conf.d/beanstalkd.conf
force: true
mode: 0644
- name: Disable Beanstalkd service
service:
name: "beanstalkd"
enabled: false
state: stopped
ignore_errors: true

View File

@ -0,0 +1,6 @@
[program:beanstalkd]
command=beanstalkd -p 11300 -z 262140
user=azuracast
numprocs=1
autostart=true
autorestart=unexpected

View File

@ -14,8 +14,16 @@
- mariadb-server
- mariadb-client
- name: Start and enable service
- name: Install MariaDB Supervisord conf
template:
src: supervisor.conf.j2
dest: /etc/supervisor/conf.d/mariadb.conf
force: true
mode: 0644
- name: Disable MariaDB service
service:
name: mysql
state: started
enabled: true
name: "mysql"
enabled: false
state: stopped
ignore_errors: true

View File

@ -0,0 +1,7 @@
[program:mariadb]
command=/usr/sbin/mariadbd
user=mysql
priority=100
numprocs=1
autostart=true
autorestart=unexpected

View File

@ -80,3 +80,17 @@
regexp: 'sendfile on;'
replace: 'sendfile off;'
when: app_env == "development"
- name: Install Nginx Supervisord conf
template:
src: supervisor.conf.j2
dest: /etc/supervisor/conf.d/nginx.conf
force: true
mode: 0644
- name: Disable Nginx service
service:
name: "nginx"
enabled: false
state: stopped
ignore_errors: true

View File

@ -0,0 +1,8 @@
[program:nginx]
command=nginx -g "daemon off;"
priority=100
numprocs=1
autostart=true
autorestart=unexpected
stopasgroup=true
killasgroup=true

View File

@ -73,3 +73,17 @@
option: "short_open_tag"
value: "On"
mode: 0644
- name: Install PHP-FPM Supervisord conf
template:
src: supervisor.conf.j2
dest: /etc/supervisor/conf.d/php-fpm.conf
force: true
mode: 0644
- name: Disable PHP-FPM service
service:
name: "php8.1-fpm"
enabled: false
state: stopped
ignore_errors: true

View File

@ -0,0 +1,28 @@
[program:php-fpm]
command=/usr/sbin/php-fpm8.1 --nodaemonize --fpm-config /etc/php/8.1/fpm/php-fpm.conf
priority=500
numprocs=1
autostart=true
autorestart=unexpected
stopasgroup=true
killasgroup=true
[program:php-nowplaying]
command=php {{ www_base }}/bin/console azuracast:sync:nowplaying
user=azuracast
priority=600
numprocs=1
autostart=true
autorestart=true
stopasgroup=true
killasgroup=true
[program:php-worker]
command=php {{ www_base }}/bin/console queue:process --worker-name=app_worker_0
user=azuracast
priority=600
numprocs=1
autostart=true
autorestart=true
stopasgroup=true
killasgroup=true

View File

@ -8,14 +8,19 @@
apt:
name: redis-server
- name: Install Redis Supervisord conf
template:
src: supervisor.conf.j2
dest: /etc/supervisor/conf.d/redis.conf
force: true
mode: 0644
- name: Enable and restart all core services
service:
name: "{{ redis_service_to_restart }}"
enabled: true
state: restarted
name: "{{ item }}"
enabled: false
state: stopped
ignore_errors: true
loop:
with_items:
- "redis-server"
- "redis"
loop_control:
loop_var: redis_service_to_restart

View File

@ -0,0 +1,6 @@
[program:redis]
command=/usr/bin/redis-server /etc/redis/redis.conf
user=redis
numprocs=1
autostart=true
autorestart=unexpected

View File

@ -6,9 +6,4 @@
state: restarted
ignore_errors: true
with_items:
- "mysql"
- "php8.1-fpm"
- "nginx"
- "redis-server"
- "redis"
- "beanstalkd"
- "supervisord"

View File

@ -38,7 +38,7 @@ minprocs=200 ; (min. avail process descriptors;default 200)
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///tmp/supervisor.sock ; use a unix:// URL for a unix socket
serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket
;serverurl=http://127.0.0.1:9001 ; use an http:// url to specify an inet socket
;username=chris ; should be same as http_username if set
;password=123 ; should be same as http_password if set

View File

@ -23,22 +23,22 @@
when: update_revision|int < 82
- role: "supervisord"
when: update_revision|int < 79
when: update_revision|int < 83
- role: "mariadb"
when: update_revision|int < 63
when: update_revision|int < 83
- role: "nginx"
when: update_revision|int < 81
when: update_revision|int < 83
- role: "redis"
when: update_revision|int < 57
when: update_revision|int < 83
- role: "beanstalkd"
when: update_revision|int < 67
when: update_revision|int < 83
- role: "php"
when: update_revision|int < 78
when: update_revision|int < 83
- role: "composer"
@ -55,7 +55,7 @@
when: update_revision|int < 13
- role: "azuracast-cron"
when: update_revision|int < 72
when: update_revision|int < 83
- role: "azuracast-build"