feat: Ajoute script d'update et config supervisor
This commit is contained in:
@@ -55,3 +55,37 @@
|
|||||||
- ffmpeg # Outil en ligne de commande pour la manipulation audio/vidéo
|
- ffmpeg # Outil en ligne de commande pour la manipulation audio/vidéo
|
||||||
state: present
|
state: present
|
||||||
when: ansible_os_family == "Debian"
|
when: ansible_os_family == "Debian"
|
||||||
|
- name: Creates directory
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "{{path}}/var"
|
||||||
|
owner: www-data
|
||||||
|
group: www-data
|
||||||
|
mode: 0777
|
||||||
|
state: directory
|
||||||
|
- name: Créer le fichier .env.local avec les secrets de production
|
||||||
|
# Crée le fichier .env.local avec les variables d'environnement pour la production.
|
||||||
|
ansible.builtin.copy:
|
||||||
|
content: |
|
||||||
|
APP_ENV=prod
|
||||||
|
VITE_LOAD=1
|
||||||
|
DATABASE_URL="postgresql://{{ db_user }}:{{ db_password }}@127.0.0.1:5432/{{ db_name }}?serverVersion=16&charset=utf8"
|
||||||
|
REDIS_DSN="redis://{{ redis_password }}@127.0.0.1:{{ redis_port }}"
|
||||||
|
dest: "{{ path }}/.env.local"
|
||||||
|
when: ansible_os_family == "Debian"
|
||||||
|
- name: Creates directory log
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "{{path}}/var/log"
|
||||||
|
owner: www-data
|
||||||
|
group: www-data
|
||||||
|
mode: 0777
|
||||||
|
state: directory
|
||||||
|
- name: Supervisor config
|
||||||
|
ansible.builtin.template:
|
||||||
|
src: supervisor.j2
|
||||||
|
dest: "/etc/supervisor/conf.d/mainframe.conf"
|
||||||
|
mode: '0644'
|
||||||
|
- name: Reread Supervisor configuration
|
||||||
|
command: supervisorctl reread
|
||||||
|
|
||||||
|
- name: Update Supervisor (add/remove updated programs)
|
||||||
|
command: supervisorctl update
|
||||||
|
|||||||
17
ansible/templates/supervisor.j2
Normal file
17
ansible/templates/supervisor.j2
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
[program:redis_mainframe]
|
||||||
|
command=redis-server --port {{ redis_port }} --requirepass {{ redis_password }}
|
||||||
|
autostart=true
|
||||||
|
autorestart=true
|
||||||
|
user=root
|
||||||
|
stdout_logfile=/var/www/mainframe/app/var/log/redis_stdout.log
|
||||||
|
stderr_logfile=/var/www/mainframe/app/var/log/redis_stderr.log
|
||||||
|
|
||||||
|
[program:messenger_redis_mainframe]
|
||||||
|
command=php {{path}}/console messenger:consume async --time-limit=3600
|
||||||
|
autostart=true
|
||||||
|
autorestart=true
|
||||||
|
user=root
|
||||||
|
startsecs=0
|
||||||
|
startretries=10
|
||||||
|
stdout_logfile=/var/www/mainframe/app/var/log/messenger_stderr.log
|
||||||
|
stderr_logfile=/var/www/mainframe/app/var/log/messenger_stdout.log
|
||||||
14
update.sh
Normal file
14
update.sh
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
RED='\033[0;31m'
|
||||||
|
ORANGE='\033[0;33m'
|
||||||
|
GREEN='\033[0;32m'
|
||||||
|
CYAN='\033[0;36m'
|
||||||
|
RESET='\033[0m' # Reset color to default
|
||||||
|
|
||||||
|
echo "${CYAN}##########################${RESET}"
|
||||||
|
echo "${CYAN}# MAINFRAME UPDATE START #${RESET}"
|
||||||
|
echo "${CYAN}##########################${RESET}"
|
||||||
|
ansible-playbook -i ansible/hosts.ini ansible/playbook.yml
|
||||||
|
echo "${CYAN}##############${RESET}"
|
||||||
|
echo "${CYAN}# END UPDATE #${RESET}"
|
||||||
|
echo "${CYAN}##############${RESET}"
|
||||||
Reference in New Issue
Block a user