[irc] gamja + soju
change
commit 87f9389f892f4c38e6065ee0848c563c042f610b
author Alpha Chen <alpha@kejadlen.dev>
date
parent 24b5550a
diff --git a/lotus-land-story/caddy.yml b/lotus-land-story/caddy.yml
index bacb93e..58820f2 100644
--- a/lotus-land-story/caddy.yml
+++ b/lotus-land-story/caddy.yml
@@ -3,6 +3,7 @@
   vars_files:
     - vars.yml
   vars:
+    # don't forget to update docker-caddy-tailscale first!
     version: 2.10.0
   tasks:
 
diff --git a/lotus-land-story/irc.yml b/lotus-land-story/irc.yml
new file mode 100644
index 0000000..351db3a
--- /dev/null
+++ b/lotus-land-story/irc.yml
@@ -0,0 +1,62 @@
+- name: Run IRC
+  hosts: lotus-land-story
+  vars_files:
+    - vars.yml
+  vars:
+    gamja_version: caf6e99
+    # remember to update the docker-soju image to bump this
+    soju_version: 0.9.0
+  tasks:
+
+    - name: Make directories
+      ansible.builtin.file:
+        path: /mnt/lotus-land-story/{{ item }}
+        state: directory
+        mode: "0755"
+      loop:
+        - caddy/data/gamja
+        - soju
+
+    - name: Download Gamja
+      ansible.builtin.unarchive:
+        src: https://github.com/kejadlen/gamja-build/releases/download/gamja-{{ gamja_version }}/gamja.tar.gz
+        dest: /mnt/lotus-land-story/caddy/data/gamja
+        remote_src: true
+
+    - name: Configure Soju
+      ansible.builtin.copy:
+        dest: /mnt/lotus-land-story/soju/soju.conf
+        content: |
+          # listen unix+admin://
+          listen irc+insecure://0.0.0.0:6697
+          listen ws+insecure://0.0.0.0:3030
+          listen http+prometheus://localhost:9090
+
+          db sqlite3 /soju/soju.db
+        mode: "0600"
+
+    - name: Get docker network
+      community.docker.docker_network:
+        name: lotus_land_story
+      register: docker_network
+
+    - name: Run Soju
+      community.docker.docker_container:
+        restart: true
+        name: soju
+        image: ghcr.io/kejadlen/soju:{{ soju_version }}
+        restart_policy: unless-stopped
+        volumes:
+          - /mnt/lotus-land-story/soju:/soju
+        ports:
+          - "6697:6697"
+        networks:
+          - name: lotus_land_story
+        # etc_hosts:
+        #   host.docker.internal: host-gateway
+
+  handlers:
+    - name: Import restarts
+      ansible.builtin.import_tasks: restarts.yml
+
+# vim: ft=yaml.ansible
diff --git a/lotus-land-story/templates/Caddyfile b/lotus-land-story/templates/Caddyfile
index c897ecd..9ff35d5 100644
--- a/lotus-land-story/templates/Caddyfile
+++ b/lotus-land-story/templates/Caddyfile
@@ -77,6 +77,17 @@ prometheus {
 
 ### Services
 
+irc {
+	tls internal
+	bind tailscale/irc
+	tailscale_auth
+
+	file_server
+	root * /data/gamja/dist
+
+	reverse_proxy /socket soju:3030
+}
+
 rss {
 	tls internal
 	bind tailscale/rss