From bf1abc145015d78610746bf9ce46d3bd93f1fe8d Mon Sep 17 00:00:00 2001 From: Sacha Chua Date: Tue, 17 Oct 2023 11:59:43 -0400 Subject: update upload --- roles/upload/defaults/main.yml | 5 +++-- roles/upload/tasks/main.yml | 25 ++++++++++++++++++++----- roles/upload/templates/config.production.js | 4 ++-- 3 files changed, 25 insertions(+), 9 deletions(-) (limited to 'roles/upload') diff --git a/roles/upload/defaults/main.yml b/roles/upload/defaults/main.yml index e814b25..b09f476 100644 --- a/roles/upload/defaults/main.yml +++ b/roles/upload/defaults/main.yml @@ -1,3 +1,4 @@ -upload_user: upload -upload_dir: /home/upload/files +upload_user: emacsconf-upload +upload_group: emacsconf-upload +upload_dir: /home/emacsconf-upload/files diff --git a/roles/upload/tasks/main.yml b/roles/upload/tasks/main.yml index 57d21a2..3e7e615 100644 --- a/roles/upload/tasks/main.yml +++ b/roles/upload/tasks/main.yml @@ -4,15 +4,16 @@ apt: update_cache: yes name: - - gpg + - gnupg - sudo - - name: Add nodesource key + state: present + - name: Import the NodeSource GPG key into apt apt_key: url: https://deb.nodesource.com/gpgkey/nodesource.gpg.key state: present - name: Add nodesource repository ansible.builtin.apt_repository: - repo: deb https://deb.nodesource.com/node_13.x buster main + repo: deb https://deb.nodesource.com/node_20.x nodistro main update_cache: yes - name: Install packages apt: @@ -33,12 +34,12 @@ state: directory - name: Install precompiled version unarchive: - src: https://github.com/psi-4ward/psitransfer/releases/download/v2.1.1/psitransfer-v2.1.1.tar.gz + src: https://github.com/psi-4ward/psitransfer/releases/download/v2.1.2/psitransfer-v2.1.2.tar.gz dest: "/home/{{ upload_user }}" remote_src: yes - name: Create link file: - src: "/home/{{ upload_user }}/psitransfer-v2.1.1" + src: "/home/{{ upload_user }}/psitransfer-v2.1.2" dest: "/home/{{ upload_user }}/psitransfer" state: link - name: Upload production config @@ -46,6 +47,20 @@ template: src: config.production.js dest: "/home/{{ upload_user }}/psitransfer/config.production.js" +- name: Copy the SSL key + become: true + copy: + remote_src: yes + src: "{{ upload_ssl_key }}" + dest: "/home/{{ upload_user }}/privkey.pem" +- name: Copy the SSL cert + become: true + copy: + remote_src: yes + src: "{{ upload_ssl_cert }}" + dest: "/home/{{ upload_user }}/fullchain.pem" + owner: "{{ upload_user }}" + group: "{{ upload_group }}" - name: Install dependencies npm: path: "/home/{{ upload_user }}/psitransfer" diff --git a/roles/upload/templates/config.production.js b/roles/upload/templates/config.production.js index b3b1e4b..052d1ef 100644 --- a/roles/upload/templates/config.production.js +++ b/roles/upload/templates/config.production.js @@ -16,8 +16,8 @@ const config = { "port": 3000, // HTTPS, set all 3 values to enable "sslPort": "{{ upload_ssl_port }}", - "sslKeyFile": "{{ upload_ssl_key }}", - "sslCertFile": "{{ upload_ssl_cert }}", + "sslKeyFile": "/home/{{ upload_user }}/privkey.pem", + "sslCertFile": "/home/{{ upload_user }}/fullchain.pem", // Force redirect to https // can be true or a specific url like https://example.com:8443 // keep empty to disable -- cgit v1.2.3