summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSacha Chua <sacha@sachachua.com>2023-10-17 11:59:43 -0400
committerSacha Chua <sacha@sachachua.com>2023-10-17 11:59:43 -0400
commitbf1abc145015d78610746bf9ce46d3bd93f1fe8d (patch)
tree7356a8f6571fc7ae29a4114e4bf4f5f1df493c8f
parent0963815d6bb6e9cf01b95aa05c3b34a3d6fcaa22 (diff)
downloademacsconf-ansible-bf1abc145015d78610746bf9ce46d3bd93f1fe8d.tar.xz
emacsconf-ansible-bf1abc145015d78610746bf9ce46d3bd93f1fe8d.zip
update upload
-rw-r--r--roles/upload/defaults/main.yml5
-rw-r--r--roles/upload/tasks/main.yml25
-rw-r--r--roles/upload/templates/config.production.js4
3 files changed, 25 insertions, 9 deletions
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