Browse Source

fully working etherpad role with minimal deps

les 3 years ago
parent
commit
17e289641a

+ 7 - 0
etherpad-playbook.yml

@@ -0,0 +1,7 @@
+---
+
+- name: "Testing etherpad role"
+  hosts: localhost
+  become: true
+  roles:
+    - role: etherpad

+ 0 - 5
nodejs.yml

@@ -1,5 +0,0 @@
----
-- name: nodejs test
-  hosts: all
-  roles:
-  - nodejs

+ 1 - 1
roles/caddy/defaults/main.yml

@@ -14,7 +14,7 @@ caddy_http2_enabled: "true"
 # additional cli args to pass to caddy
 caddy_additional_args: ""
 caddy_systemd_network_dependency: true
-caddy_systemd_capabilities_enabled: false
+caddy_systemd_capabilities_enabled: true
 caddy_systemd_capabilities: "CAP_NET_BIND_SERVICE"
 caddy_systemd_restart: "on-failure"   # always, on-success, on-failure, on-abnormal, on-abort, on-watchdog
 caddy_systemd_restart_startlimitinterval: "86400"

+ 2 - 2
roles/etherpad/defaults/main.yml

@@ -1,7 +1,7 @@
 ---
 title: "Etherpad"
 favicon: "favicon.ico"
-hostname: "0.0.0.0"
+hostname: ":80"
 database_password: "{{lookup('password', './database_password')}}"
 pad_options_lang: 'it-it'
 
@@ -11,4 +11,4 @@ pad_default_text: |
   Welcome to Etherpad!
   This pad text is synchronized as you type, so that everyone viewing this page sees the same text. 
   This allows you to collaborate seamlessly on documents!
-  Get involved with Etherpad at"
+  Get involved with Etherpad at

+ 11 - 3
roles/etherpad/meta/main.yml

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

+ 13 - 2
roles/etherpad/tasks/main.yml

@@ -23,15 +23,26 @@
     group: root
     mode: 0644
 
+- name: copy etherpad settings.json
+  template:
+    src: settings.json.j2
+    dest: /srv/etherpad/etherpad/settings.json
+    owner: etherpad
+    group: etherpad
+    mode: 0644
+
+
 - name: ensure etherpad will start after system is booted
   service:
     name: etherpad
     enabled: yes
 
 - name: install etherpad deps
-  shell: installDeps.sh
+  become: true
+  become_user: etherpad
+  shell: /srv/etherpad/etherpad/bin/installDeps.sh
   args:
-    chdir: /srv/etherpad/etherpad/bin
+    chdir: /srv/etherpad/etherpad/
 
 - name: install etherpad plugins
   npm:

+ 10 - 10
roles/etherpad/templates/settings.json.j2

@@ -2,12 +2,12 @@
 {
   "title": "{{ title }}",
   "favicon": "{{ favicon }}",
-  "ip": "",
-  "port" : "/tmp/etherpad.socket",
+  "ip": "127.0.0.1",
+  "port" : "31337",
   "showSettingsInAdminPage": false,
-  "sessionKey": "{{ etherpad.session_key }}",
+  "sessionKey": "oijaoifd",
   "skinName": "colibris",
-  "dbType": "postgresql",
+  "dbType": "postgres",
   "dbSettings" : {
     "user"    : "etherpad",
     "host"    : "/var/run/postgresql",
@@ -15,7 +15,7 @@
     "database": "etherpad",
     "charset" : "utf8mb4"
   },
-  "defaultPadText": "{{ pad_default_text }}",
+  "defaultPadText": "{{ pad_default_text | replace("\n", "\\n")}}",
   "padOptions": {
     "noColors": false,
     "showControls": true,
@@ -51,7 +51,7 @@
     "cmdH":      true,
     "ctrlHome":  true,
     "pageUp":    true,
-    "pageDown":  true}
+    "pageDown":  true
   },
   "suppressErrorsInPadText": false,
   "requireSession": false,
@@ -60,7 +60,7 @@
   "minify": true,
   "maxAge": 21600,
   "abiword": "/usr/bin/abiword",
-  "soffice": "/usr/bin/soffice",
+  "soffice": false,
   "tidyHtml": "/usr/bin/tidy",
   "allowUnknownFileEnds": true,
   "requireAuthentication": false,
@@ -77,7 +77,7 @@
     "scrollWhenCaretIsInTheLastLineOfViewport": false,
     "percentageToScrollWhenUserPressesArrowUp": 0
   },
-  "socketTransportProtocols": : ["xhr-polling", "jsonp-polling", "htmlfile"],
+  "socketTransportProtocols": ["xhr-polling", "jsonp-polling", "htmlfile"],
   "loadTest": false,
   "indentationOnNewLine": false,
   "toolbar": {
@@ -95,7 +95,7 @@
     "timeslider": [
        ["timeslider_export", "timeslider_returnToPad"]
      ]
-  }
+  },
   "exposeVersion": false,
-  "loglevel": "WARN",
+  "loglevel": "WARN"
 }