Procházet zdrojové kódy

:bug: fix www deploy

Jeremy Zheng před 4 roky
rodič
revize
984188fbf5

+ 2 - 1
deploy/roles/certbot-nginx/tasks/main.yml

@@ -1,4 +1,5 @@
 - name: Remove file nginx default host
+  become: true
   ansible.builtin.file:
     path: /etc/nginx/sites-enabled/default
     state: absent
@@ -6,7 +7,7 @@
 - name: add Let's Encrypt support
   become: true
   ansible.builtin.shell:
-    cmd: certbot --non-interactive --agree-tos -m {{ app_master_email }}
+    cmd: certbot --nginx --non-interactive --agree-tos -m {{ app_master_email }} --domains {{ inventory_hostname }}
 
 - name: restart nginx
   become: true

+ 5 - 5
deploy/roles/mint-clone/main.yml → deploy/roles/mint-clone/tasks/main.yml

@@ -12,7 +12,7 @@
     version: laravel
 
 - name: Install v2 php dependencies
-  ansible.builtin.shell: composer install
+  ansible.builtin.shell: "{{ ansible_env.HOME }}/.local/bin/composer install"
   args:
     chdir: "{{ app_deploy_target }}"
 
@@ -23,7 +23,7 @@
 
 # TODO will remove in future
 - name: Install v1 php dependencies
-  ansible.builtin.shell: composer install
+  ansible.builtin.shell: "{{ ansible_env.HOME }}/.local/bin/composer install"
   args:
     chdir: "{{ app_deploy_target }}/public"
 
@@ -34,7 +34,7 @@
     chdir: "{{ app_deploy_target }}/public"
 
 - name: .env(v2)
-  bacame: true
+  become: true
   ansible.builtin.template:
     src: env-v2.j2
     dest: "{{ app_deploy_target }}/.env"
@@ -44,7 +44,7 @@
 
 # TODO will remove in future
 - name: config.php(v1)
-  bacame: true
+  become: true
   ansible.builtin.template:
     src: config-v1.php.j2
     dest: "{{ app_deploy_target }}/public/app/config.php"
@@ -54,7 +54,7 @@
 
 # TODO will remove in future
 - name: config.js(v1)
-  bacame: true
+  become: true
   ansible.builtin.template:
     src: config-v1.js.j2
     dest: "{{ app_deploy_target }}/public/app/config.js"

+ 12 - 11
deploy/roles/mint-clone/templates/env-v2.j2

@@ -2,22 +2,22 @@ BASE_DIR="/workspace/.env.global"
 CACHE_DIR="${BASE_DIR}/cache"
 TMP_DIR="${BASE_DIR}/tmp"
 
-APP_NAME={{  }}
-APP_ENV=local
-APP_KEY=
+APP_NAME=mint
+APP_ENV=production
+APP_KEY={{ app_laravel_key }}
 APP_DEBUG=true
-APP_URL=http://localhost
+APP_URL=https://{{ inventory_hostname }}
 
 LOG_CHANNEL=stack
 LOG_DEPRECATIONS_CHANNEL=null
-LOG_LEVEL=debug
+LOG_LEVEL=info
 
-DB_CONNECTION=mysql
-DB_HOST=127.0.0.1
-DB_PORT=3306
+DB_CONNECTION=postgresql
+DB_HOST={{ app_postgresql_host }}
+DB_PORT={{ app_postgresql_port }}
 DB_DATABASE=mint_new
-DB_USERNAME=root
-DB_PASSWORD=
+DB_USERNAME=www
+DB_PASSWORD={{ app_postgresql_password }}
 
 BROADCAST_DRIVER=log
 CACHE_DRIVER=file
@@ -28,7 +28,7 @@ SESSION_LIFETIME=120
 
 MEMCACHED_HOST=127.0.0.1
 
-REDIS_HOST=127.0.0.1
+REDIS_HOST={{ app_redis_host }}
 REDIS_PASSWORD=null
 REDIS_PORT=6379
 
@@ -56,3 +56,4 @@ MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
 MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
 
 ASSETS_SERVER="https://assets-{{ app_cluster_id }}.wikipali.org"
+RPC_SERVER="https://rpc.wikipali.org"

+ 4 - 0
deploy/roles/ubuntu/tasks/main.yml

@@ -79,6 +79,7 @@
       - unzip
       - nginx
       - certbot
+      - python3-certbot-nginx
       - openvpn
       - snmpd
       - systemd-cron
@@ -90,6 +91,9 @@
       - python3-pip
       - python3-distutils
       - python3-dev
+      - nodejs
+      - npm
+      - yarnpkg
       - libssl-dev
       - libpq-dev
       - libmysqlclient-dev

+ 6 - 0
deploy/staging/hosts

@@ -14,4 +14,10 @@
 app_vendor="iapt-platform.mint"
 ; openssl rand -base64 32
 app_secret_key="4i3WKUvKtSGl59htK7XjUNsjalhkG5s7RJCmZruT2m4="
+; php artisan key:generate --show
+app_laravel_key="base64:IQD4vkmAN1oEsc8rVu1nRadQWPUX/LH/jaSbyFbmf/w="
+app_postgresql_host="db-hk-1.wikipali.org"
+app_postgresql_port=5433
+app_postgresql_password=change-me
+app_redis_host="ch-hk-1.wikipali.org"