Răsfoiți Sursa

:bug: fix nginx.conf

China Kassapa 7 luni în urmă
părinte
comite
db9f6b9739

+ 8 - 0
deploy/roles/mint-nginx/tasks/main.yml

@@ -22,6 +22,14 @@
     mode: "0644"
     force: false
 
+- name: Set document root
+  become: true
+  ansible.builtin.shell: sed -i '5s#.*#root {{ app_deploy_target }}/api-v8/public;#' /etc/nginx/sites-enabled/{{ app_domain }}.conf
+
+- name: Set dashboard alias
+  become: true
+  ansible.builtin.shell: sed -i '25s#.*#alias {{ app_deploy_target }}/dashboard-v4/dashboard/dist/#' /etc/nginx/sites-enabled/{{ app_domain }}.conf
+
 - name: Reload nginx.conf
   become: true
   ansible.builtin.shell: nginx -s reload

+ 5 - 3
deploy/roles/mint-nginx/templates/fpm.conf.j2

@@ -1,7 +1,9 @@
 upstream php_fpm_{{ app_php_fpm_port }} {
    # least_conn;
+   
+   {% for host in groups['php_fpm'] %}
+      server {{ host }}:{{ app_php_fpm_port }} weight=10;
+   {% endfor %}
 
-   # server 192.168.0.11:{{ app_php_fpm_port }} weight=10;   
-
-   server 127.0.0.1:{{ app_php_fpm_port }} backup;
+   # server 127.0.0.1:{{ app_php_fpm_port }} backup;
 }

+ 2 - 3
deploy/roles/mint-nginx/templates/nginx.conf.j2

@@ -1,9 +1,8 @@
 # https://laravel.com/docs/12.x/deployment#nginx
 
 server {
-    listen 80;
     server_name {{ app_domain }};
-    root {{ app_deploy_target }}/api-v8/public;
+    root /bla-bla-bla;
  
     add_header X-Frame-Options "SAMEORIGIN";
     add_header X-Content-Type-Options "nosniff";
@@ -23,7 +22,7 @@ server {
     # error_log  syslog:server=unix:/dev/log,tag={{ app_domain }},nohostname,severity=error;
 
     location {{ app_dashboard_base_path }}/ {
-            alias {{ app_deploy_target }}/dashboard-v4/dashboard/dist/;
+            alias /bla-bla-bla;
             try_files $uri $uri/ {{ app_dashboard_base_path }}/index.html;
 
             location ~* \.(css|js|png|jpg|jpeg|gif|gz|svg|mp4|ogg|ogv|webm|htc|xml|woff)$ {

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

@@ -18,10 +18,4 @@
 
 - name: "Setup configuration"
   ansible.builtin.shell:
-    cmd: "docker run --rm -it --hostname=mint --network host -v /srv/{{ app_domain }}/clove:/srv/{{ app_domain }}/clove:z -v {{ app_deploy_target }}/api-v8:{{ app_deploy_target }}/api-v8:z {{ app_docker_image_name }} {{ app_deploy_target }}/scripts/run.sh setup"
-
-- name: Create a current link
-  ansible.builtin.file:
-    src: "{{ app_deploy_target }}"
-    dest: "{{ app_deploy_target | dirname }}/current"
-    state: link
+    cmd: "docker run --rm -it --hostname=mint --network host -v /srv/{{ app_domain }}/clove:/srv/{{ app_domain }}/clove:z -v {{ app_deploy_target }}:{{ app_deploy_target }}:z {{ app_docker_image_name }} {{ app_deploy_target }}/scripts/run.sh setup"

+ 8 - 0
deploy/roles/mint-v2.2/tasks/main.yml

@@ -73,3 +73,11 @@
     src: version.txt.j2
     dest: "{{ app_deploy_target }}/dashboard-v4/dashboard/dist/version.txt"
     mode: "0555"
+
+# -----------------------------------------------------------------------------
+
+- name: Create a current link
+  ansible.builtin.file:
+    src: "{{ app_deploy_target }}"
+    dest: "{{ app_deploy_target | dirname }}/current"
+    state: link

+ 1 - 1
deploy/roles/mint-v2.2/templates/containers/run.sh.j2

@@ -25,7 +25,7 @@ elif [ "$1" = "openai-proxy" ]; then
 elif [ "$1" = "php-fpm" ]; then
     sed -i 's/^listen = .*/listen = 9000/g' /etc/php/{{ app_php_version }}/fpm/pool.d/www.conf
     /usr/sbin/php-fpm{{ app_php_version }} --nodaemonize --fpm-config /etc/php/{{ app_php_version }}/fpm/php-fpm.conf
-elif [ "$1" = "expected_value" ]; then
+elif [ "$1" = "setup" ]; then
     cd $WORK_DIR/api-v8/
     echo "caching configuration "
     php artisan config:cache

+ 1 - 1
deploy/roles/mint-v2.2/templates/containers/shell.sh.j2

@@ -2,5 +2,5 @@
 
 docker run --rm -it --hostname=mint --network host \
     -v /srv/{{ app_deploy_target | dirname }}/clove:/srv/{{ app_deploy_target | dirname }}/clove:z \
-    -v {{ app_deploy_target }}/api-v8:{{ app_deploy_target }}/api-v8:z \
+    -v {{ app_deploy_target }}:{{ app_deploy_target }}:z \
     {{ app_docker_image_name }}