Added Dendrite symlink to port workaround.
authorLuke Hoersten <luke@hoersten.org>
Mon, 08 Aug 2022 21:16:41 -0500
changeset 183 b31ef0e10cad
parent 182 b4ce6f1f15b7
child 184 11466a894f3c
Added Dendrite symlink to port workaround.
dendrite/server/handlers/main.yaml
dendrite/server/tasks/main.yaml
dendrite/server/templates/[email protected]
--- a/dendrite/server/handlers/main.yaml	Mon Aug 08 16:12:44 2022 -0500
+++ b/dendrite/server/handlers/main.yaml	Mon Aug 08 21:16:41 2022 -0500
@@ -2,4 +2,4 @@
 
 - name: restart service
   become: yes
-  systemd: name="dendrite@{{dendrite_instance}}.service" state="restarted" daemon_reload="yes"
+  systemd: name="dendrite@{{dendrite_port}}.service" state="restarted" daemon_reload="yes"
--- a/dendrite/server/tasks/main.yaml	Mon Aug 08 16:12:44 2022 -0500
+++ b/dendrite/server/tasks/main.yaml	Mon Aug 08 21:16:41 2022 -0500
@@ -50,7 +50,6 @@
     - {"src": "dendrite-upgrade-tests"   , "dest": "dendrite-upgrade-tests"}
     - {"src": "generate-config"          , "dest": "dendrite-generate-config"}
     - {"src": "generate-keys"            , "dest": "dendrite-generate-keys"}
-    - {"src": "goose"                    , "dest": "dendrite-goose"}
     - {"src": "resolve-state"            , "dest": "dendrite-resolve-state"}
 
 - name: create instance dir
@@ -66,6 +65,17 @@
     - "{{dendrite_dir}}"
     - "{{dendrite_dir}}/{{dendrite_instance}}"
 
+- name: create instance port symlink
+  become: yes
+  file:
+    src: "{{dendrite_dir}}/{{dendrite_instance}}"
+    dest: "{{dendrite_dir}}/{{dendrite_port}}"
+    state: "link"
+    owner: "{{dendrite_user}}"
+    group: "{{dendrite_user}}"
+    mode: "0755"
+  notify: restart service
+
 - name: install keys
   become: yes
   copy:
@@ -107,6 +117,10 @@
     src: "[email protected]"
     dest: "/lib/systemd/system/[email protected]"
 
+- name: ensure instance service is stopped
+  become: yes
+  systemd: name="dendrite@{{dendrite_instance}}.service" enabled="no" state="stopped" daemon_reload="yes"
+
 - name: ensure service is started
   become: yes
-  systemd: name="dendrite@{{dendrite_instance}}.service" enabled="yes" state="started"
+  systemd: name="dendrite@{{dendrite_port}}.service" enabled="yes" state="started"
--- a/dendrite/server/templates/[email protected]	Mon Aug 08 16:12:44 2022 -0500
+++ b/dendrite/server/templates/[email protected]	Mon Aug 08 21:16:41 2022 -0500
@@ -1,10 +1,10 @@
 [Unit]
-Description=Dendrite %I Instance
+Description=Dendrite instance on port %i
 After=syslog.target network.target postgresql.service
 
 [Service]
 WorkingDirectory={{dendrite_dir}}/%i/
-ExecStart=/usr/local/bin/dendrite-monolith-server -config "{{dendrite_dir}}/%i/dendrite.yaml" -http-bind-address ":{{dendrite_port}}"
+ExecStart=/usr/local/bin/dendrite-monolith-server -config "{{dendrite_dir}}/%i/dendrite.yaml" -http-bind-address ":%i"
 Restart=always
 User={{dendrite_user}}
 LimitNOFILE=65535