Browse Source

:bug: fix container restarted

Jeremy Zheng 11 months ago
parent
commit
ace8de05b8

+ 1 - 0
deploy/group_vars/all.yml

@@ -4,6 +4,7 @@ ansible_ssh_private_key_file: "{{ inventory_dir }}/.ssh/id_ed25519"
 
 app_deploy_target: "/srv/{{ app_domain }}/mint-{{ mint_version }}"
 app_downloads: "{{ ansible_env.HOME }}/downloads"
+app_debug: false
 
 app_dashboard_base_path: "/pcd"
 app_postgresql_version: "16"

+ 3 - 3
deploy/mint.yml

@@ -65,7 +65,7 @@
       ansible.builtin.systemd_service:
         name: "{{ app_container_prefix }}-{{ app_domain }}-fpm-{{ app_php_fpm_port }}"
         enabled: true
-        state: started
+        state: restarted
         scope: user
 
 - name: Start mint php-fpm
@@ -76,7 +76,7 @@
       ansible.builtin.systemd_service:
         name: "{{ app_container_prefix }}-{{ app_domain }}-worker-mq-ai.translate"
         enabled: true
-        state: started
+        state: restarted
         scope: user
 
 - name: Setup nginx
@@ -92,6 +92,6 @@
     - name: Enable schedule run timer
       ansible.builtin.systemd_service:
         name: "{{ app_domain }}-scheduler.timer"
-        state: started
+        state: restarted
         enabled: true
         scope: user

+ 1 - 1
deploy/roles/mint-v2.1/tasks/laravel.yml

@@ -30,7 +30,7 @@
     volumes:
       - "{{ app_deploy_target }}:{{ app_deploy_target }}:z"
     workdir: "{{ app_deploy_target }}"
-    # auto_remove: true
+    auto_remove: true
 
 - name: Setup background worker
   ansible.builtin.include_tasks: workers.yml

+ 2 - 2
deploy/roles/mint-v2.1/tasks/php-fpm.yml

@@ -19,7 +19,7 @@
     volumes:
       - "{{ app_deploy_target }}:{{ app_deploy_target }}:z"
     workdir: "{{ app_deploy_target }}"
-    # auto_remove: true
+    auto_remove: true
     state: present
     generate_systemd:
       path: "{{ ansible_env.HOME }}/.config/systemd/user"
@@ -27,4 +27,4 @@
       new: true
       names: true
       restart_policy: always
-      stop_timeout: 120
+      stop_timeout: 2

+ 3 - 3
deploy/roles/mint-v2.1/tasks/workers.yml

@@ -18,12 +18,12 @@
       - "{{ app_deploy_target }}:{{ app_deploy_target }}:z"
     workdir: "{{ app_deploy_target }}"
     state: present
-    # auto_remove: true
+    auto_remove: true
     generate_systemd:
       path: "{{ ansible_env.HOME }}/.config/systemd/user"
       container_prefix: "{{ app_container_prefix }}"
       new: true
       names: true
       restart_policy: always
-      restart_sec: 30
-      stop_timeout: 20
+      restart_sec: 10
+      stop_timeout: 5

+ 1 - 1
deploy/roles/mint-v2.1/templates/v2/env.j2

@@ -5,7 +5,7 @@ TMP_DIR="${BASE_DIR}/tmp"
 APP_NAME="wikipali"
 APP_ENV={{ app_env }}
 APP_KEY={{ app_secret_key }}
-APP_DEBUG=false
+APP_DEBUG={{ app_debug }}
 APP_URL="https://{{ app_domain }}"
 
 LOG_CHANNEL=daily