瀏覽代碼

[dendrite] Fix role and upgrade jail

Colin Powell 2 年之前
父節點
當前提交
d98e6f322a

+ 2 - 2
lab/ansible/hosts

@@ -6,7 +6,7 @@ bastion1.local ansible_become=true
 bookwyrm0.local
 bookwyrm1.local
 calibre1.local
-dendrite1.local
+dendrite0.local
 devpi0.local
 elastic1.local
 emus0.local
@@ -117,7 +117,7 @@ bastion1.local ansible_become=true
 bastion1.local ansible_become=true
 
 [matrix]
-dendrite1.local
+dendrite0.local
 
 [recipes]
 tandoor0.local

+ 1 - 0
lab/ansible/playbook.yml

@@ -170,6 +170,7 @@
 - hosts: matrix
   roles:
     - role: nginx
+    - role: immortal
     - role: dendrite
 
 - hosts: reading

+ 54 - 0
lab/ansible/roles/dendrite/files/element-config.json

@@ -0,0 +1,54 @@
+{
+    "default_server_config": {
+        "m.homeserver": {
+            "base_url": "https://matrix.unbl.ink",
+            "server_name": "matrix.org"
+        },
+        "m.identity_server": {
+            "base_url": "https://vector.im"
+        }
+    },
+    "disable_custom_urls": false,
+    "disable_guests": false,
+    "disable_login_language_selector": false,
+    "disable_3pid_login": false,
+    "brand": "Element",
+    "integrations_ui_url": "https://scalar.vector.im/",
+    "integrations_rest_url": "https://scalar.vector.im/api",
+    "integrations_widgets_urls": [
+        "https://scalar.vector.im/_matrix/integrations/v1",
+        "https://scalar.vector.im/api",
+        "https://scalar-staging.vector.im/_matrix/integrations/v1",
+        "https://scalar-staging.vector.im/api",
+        "https://scalar-staging.riot.im/scalar/api"
+    ],
+    "bug_report_endpoint_url": "https://element.io/bugreports/submit",
+    "uisi_autorageshake_app": "element-auto-uisi",
+    "default_country_code": "GB",
+    "show_labs_settings": false,
+    "features": { },
+    "default_federate": true,
+    "default_theme": "light",
+    "room_directory": {
+        "servers": [
+            "matrix.org"
+        ]
+    },
+    "piwik": {
+        "url": "https://piwik.riot.im/",
+        "whitelisted_hs_urls": ["https://matrix.org"],
+        "whitelisted_is_urls": ["https://vector.im", "https://matrix.org"],
+        "siteId": 1
+    },
+    "enable_presence_by_hs_url": {
+        "https://matrix.org": false,
+        "https://matrix-client.matrix.org": false
+    },
+    "setting_defaults": {
+        "breadcrumbs": true
+    },
+    "jitsi": {
+        "preferred_domain": "meet.element.io"
+    },
+    "map_style_url": "https://api.maptiler.com/maps/streets/style.json?key=fU3vlMsMn4Jb6dnEIFsx"
+}

+ 7 - 0
lab/ansible/roles/dendrite/files/immortal-dendrite.yml

@@ -0,0 +1,7 @@
+cmd: /usr/local/dendrite/bin/dendrite-monolith-server -config /usr/local/etc/dendrite/dendrite.yaml
+log:
+  file: /var/log/dendrite.log
+  age: 86400 # log 1 day
+  num: 7 # keep 7 files
+  size: 1 # size of file 1MB
+wait: 1

+ 12 - 5
lab/ansible/roles/dendrite/tasks/main.yml

@@ -1,7 +1,7 @@
 ---
 - name: Dependencies installed
   community.general.pkgng:
-    name: dendrite
+    name: dendrite,element-web
     state: latest
 
 - name: Dendrite enabled
@@ -24,7 +24,14 @@
     mode: 0600
   notify: Dendrite restarted
 
-- name: Ensure dendrite is running
-  service:
-    name: dendrite
-    state: started
+- name: Element config installed
+  copy:
+    src: element-config.json
+    dest: /usr/local/www/element/config.json
+
+- name: Dendrite immortal file installed
+  copy:
+    src: immortal-dendrite.yml
+    dest: /usr/local/etc/immortal/dendrite.yml
+    mode: 0644
+  notify: Immortal restarted

+ 6 - 1
lab/ansible/roles/dendrite/templates/dendrite.yaml.j2

@@ -51,7 +51,7 @@ client_api:
   external_api:
     listen: http://[::]:8071
 
-  registration_disabled: false
+  registration_disabled: true
   registration_shared_secret: ""
   enable_registration_captcha: false
 
@@ -83,6 +83,11 @@ federation_api:
     connect: http://0.0.0.0:7772
   external_api:
     listen: http://[::]:8072
+  database:
+    connection_string: postgresql://dendrite:{{dendrite_db_pass}}@db.service/dendrite?sslmode=disable
+    max_open_conns: 10
+    max_idle_conns: 2
+    conn_max_lifetime: -1
 
   federation_certificates: []
 

+ 1 - 1
lab/ansible/roles/matrix/files/nginx.conf

@@ -1,3 +1,3 @@
 location /element {
-    alias /usr/local/www/element-v1.9.4;
+    alias /usr/local/www/element;
 }

+ 1 - 1
lab/ansible/roles/unbound/files/service.zones

@@ -41,7 +41,7 @@ local-data: "metabase.service   IN      A       192.168.1.228"
 local-data: "wger.service       IN      A       192.168.1.160"
 local-data: "links.service      IN      A       192.168.1.147"
 local-data: "printer.service	IN	    A   	192.168.1.146"
-local-data: "matrix.service     IN      A       192.168.1.106"
+local-data: "matrix.service     IN      A       192.168.1.200"
 local-data: "pleroma.service    IN      A       192.168.1.125"
 local-data: "emus.service       IN      A       192.168.1.162"
 local-data: "bookwyrm.service   IN      A       192.168.1.248"