Просмотр исходного кода

:bug: fix vendors packages setup

Jeremy Zheng 1 год назад
Родитель
Сommit
9684c3468b

+ 37 - 0
deploy/roles/mint-v2.1/files/vendors.sh

@@ -0,0 +1,37 @@
+#!/bin/bash
+
+set -e
+
+export WORK_DIR="/srv"
+
+export NVM_DIR="$HOME/.nvm"
+source "$NVM_DIR/nvm.sh"
+
+cd $WORK_DIR/api-v8/
+echo "install v2 laravel vendors"
+composer update --optimize-autoloader --no-dev
+echo "install v2 nodejs packages"
+npm install --omit=dev
+
+cd $WORK_DIR/api-v8/public/
+echo "install v1 vendors"
+composer update --optimize-autoloader --no-dev
+echo "install v1 nodejs packages"
+npm install --omit=dev
+
+cd $WORK_DIR/api-v8/
+echo "caching configuration "
+php artisan config:cache
+echo "caching events"
+php artisan event:cache
+echo "caching routes"
+php artisan route:cache
+echo "caching views"
+php artisan view:cache
+
+echo "check file permissions"
+cd $WORK_DIR/api-v8/
+chown -R www-data:www-data bootstrap/cache storage
+
+echo 'done.'
+exit 0

+ 16 - 5
deploy/roles/mint-v2.1/tasks/laravel-v8.yml → deploy/roles/mint-v2.1/tasks/laravel.yml

@@ -15,6 +15,21 @@
     src: v1/config.js.j2
     dest: "{{ app_deploy_target }}/api-v8/public/app/config.js"
     mode: "0444"
+
+- name: Upload vendors.sh
+  ansible.builtin.copy:
+    src: vendors.sh
+    dest: "{{ app_deploy_target }}/scripts/"
+    mode: "0555"
+
+- name: Initialize vendors and configuration
+  containers.podman.podman_container:
+    name: mint-initialize-vendors-configs
+    image: "{{ app_mint_image_name }}"
+    command: /srv/scripts/vendors.sh
+    volumes:
+      - "{{ app_deploy_target }}:/srv"
+    auto_remove: true
 # - name: Setup third packages
 #   ansible.builtin.command:
 #     argv:
@@ -23,11 +38,7 @@
 #       - setup
 #     chdir: "{{ app_deploy_target }}/"
 #     creates: "{{ app_deploy_target }}/api-v8/public/node_modules"
-# - name: Upload launch.sh
-#   ansible.builtin.copy:
-#     src: launch.sh
-#     dest: "{{ app_deploy_target }}/scripts/"
-#     mode: "0555"
+
 # # https://laravel.com/docs/10.x/scheduling#running-the-scheduler
 # - name: Upload scheduler service
 #   become: true

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

@@ -17,7 +17,7 @@
     mode: "0555"
 
 - name: Setup laravel
-  ansible.builtin.import_tasks: laravel-v8.yml
+  ansible.builtin.import_tasks: laravel.yml
 
 - name: Force systemd to reread configs
   become: true