Browse Source

deploy gancio

les 3 years ago
parent
commit
6b3c732ec2

+ 20 - 7
infra.yml

@@ -1,13 +1,13 @@
 ---
 
 ## ETHERPAD
-# - name: Etherpad
-#   hosts: paddone
-#   roles:
-#     - role: stable/common
-#     - role: stable/etherpad
-#   vars_files:
-#     - vars/etherpad.yml
+- name: Etherpad
+  hosts: paddone
+  roles:
+    - role: stable/common
+    - role: stable/etherpad
+  vars_files:
+    - vars/etherpad.yml
 
 
 ## CICLES
@@ -16,3 +16,16 @@
   roles:
     - role: stable/common
     - role: stable/goploader
+
+
+## GANCIO
+- name: Gancio
+  hosts: gancio
+  roles:
+    - role: stable/common
+    - role: stable/gancio
+  vars_files:
+    - vars/gancio.yml
+
+
+## MASTODON

+ 3 - 0
inventory.yml

@@ -4,6 +4,9 @@ paddone:
 cicles:
   hosts: 192.168.199.105
 
+gancio:
+  hosts: 192.168.199.106
+
 all:
   vars:
     passwordstore_path: cisti.org/ansible

+ 0 - 2
roles/gancio/defaults/main.yml

@@ -1,2 +0,0 @@
-database_password: "{{lookup('password', './.pass/gancio_db_password')}}"
-

+ 0 - 21
roles/gancio/meta/main.yml

@@ -1,21 +0,0 @@
----
-dependencies:
-
-  # install nodejs
-  - role: nodejs
-
-  # install postgres
-  # and create an etherpad user and db
-  - role: postgresql
-    vars:
-      username: gancio
-      password: "{{ database_password }}"
-      database: gancio
-
-  # install caddy and configure it as reverse proxy
-  - role: caddy
-    vars:
-      caddy_config: |
-        {{hostname}}
-        encode gzip
-        reverse_proxy localhost:31337

+ 7 - 0
roles/stable/gancio/defaults/main.yml

@@ -0,0 +1,7 @@
+---
+title: "Gancio"
+listen_ip: "0.0.0.0"
+listen_port: "13120"
+url: "http://localhost:13120"
+database_password: "{{lookup('community.general.passwordstore', '{{passwordstore_path}}/gancio/db_password create=True nosymbols=true')}}"
+

+ 13 - 0
roles/stable/gancio/meta/main.yml

@@ -0,0 +1,13 @@
+---
+dependencies:
+
+  # install nodejs
+  - role: nodejs
+
+  # install postgres
+  # and create an gancio user and db
+  - role: postgresql
+    vars:
+      username: gancio
+      password: "{{ database_password }}"
+      database: gancio

+ 10 - 1
roles/gancio/tasks/main.yml → roles/stable/gancio/tasks/main.yml

@@ -16,15 +16,24 @@
 
 - name: NODE | Install gancio
   npm:
+    executable: /usr/bin/npm --unsafe-perm=true --allow-root
     name: gancio
     global: yes
     production: yes
     state: present
+  
+- name: Copy settings
+  template:
+    src: config.json.j2
+    dest: /srv/gancio/config.json
+    owner: gancio
+    group: gancio
+    mode: 0660
 
 - name: NODE | Start APP
   become: true
   become_user: gancio
-  shell: pm2 start gancio start --db="postgres"
+  shell: pm2 start gancio -- start --config config.json
   args:
     chdir: /srv/gancio
   ignore_errors: yes

+ 23 - 0
roles/stable/gancio/templates/config.json.j2

@@ -0,0 +1,23 @@
+{
+  "title": "{{title}}",
+  "baseurl": "{{url}}",
+  "server": {
+    "host": "{{listen_ip}}",
+    "port": {{listen_port}}
+  },
+  "db": {
+    "dialect": "postgres",
+    "host": "/var/run/postgresql",
+    "database": "gancio",
+    "username": "gancio",
+    "password": "{{database_password}}",
+    "logging": false
+  },
+  "upload_path": "/srv/gancio/uploads",
+  "smtp": {
+    "sendmail": true,
+    "newline": "unix",
+    "path": "/usr/sbin/sendmail"
+  },
+  "secret": "{{lookup('community.general.passwordstore', '{{passwordstore_path}}/gancio/session_secret create=True nosymbols=true')}}"
+}

+ 2 - 0
vars/gancio.yml

@@ -0,0 +1,2 @@
+---
+url: "https://g.cisti.org"