From 907dc7da52a973f0b4c7fd6b89418a66c73050d3 Mon Sep 17 00:00:00 2001
From: Christian Heller <c.heller@plomlompom.de>
Date: Mon, 10 Dec 2018 01:45:39 +0100
Subject: [PATCH] Add plomlombot setup.

---
 .../linkable_etc_files/web/etc/nginx/nginx.conf       |  4 ++++
 .../web/etc/systemd/system/plomlombot.service         | 10 ++++++++++
 all_new_2018/setup_plomlombot.sh                      | 11 +++++++++++
 all_new_2018/user_scripts/start_plomlombot.sh         |  4 ++++
 4 files changed, 29 insertions(+)
 create mode 100644 all_new_2018/linkable_etc_files/web/etc/systemd/system/plomlombot.service
 create mode 100755 all_new_2018/setup_plomlombot.sh
 create mode 100755 all_new_2018/user_scripts/start_plomlombot.sh

diff --git a/all_new_2018/linkable_etc_files/web/etc/nginx/nginx.conf b/all_new_2018/linkable_etc_files/web/etc/nginx/nginx.conf
index 5d95d2e..fa1f106 100644
--- a/all_new_2018/linkable_etc_files/web/etc/nginx/nginx.conf
+++ b/all_new_2018/linkable_etc_files/web/etc/nginx/nginx.conf
@@ -63,5 +63,9 @@ http {
             fastcgi_param GITWEB_CONFIG /etc/gitweb.conf;
             fastcgi_pass unix:/var/run/fcgiwrap.socket;
         }
+
+        location /irclogs/plomlompomtest/ {
+            autoindex on;
+        }
     }
 }
diff --git a/all_new_2018/linkable_etc_files/web/etc/systemd/system/plomlombot.service b/all_new_2018/linkable_etc_files/web/etc/systemd/system/plomlombot.service
new file mode 100644
index 0000000..1ee35e8
--- /dev/null
+++ b/all_new_2018/linkable_etc_files/web/etc/systemd/system/plomlombot.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=plomlombot screen
+
+[Service]
+Type=forking
+User=plom
+ExecStart=/bin/sh -c 'screen -d -m ~/start.sh plomlombob "#plomlompomtest"'
+
+[Install]
+WantedBy=multi-user.target
diff --git a/all_new_2018/setup_plomlombot.sh b/all_new_2018/setup_plomlombot.sh
new file mode 100755
index 0000000..9304394
--- /dev/null
+++ b/all_new_2018/setup_plomlombot.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+set -e
+
+config_tree_prefix="${HOME}/config/all_new_2018//"
+cp "${config_tree_prefix}"/user_scripts/start_plomlombot.sh /home/plom/
+chown plom:plom /home/plom/start_plomlombot.sh
+apt -y install screen python3-venv
+systemctl enable /etc/systemd/system/plomlombot.service
+service start plomlombot
+mkdir -p /var/www/html/irclogs
+ln /home/plom/plomlombot_db/6f322d574618816aa2d6d1ceb4fd2551/789a38c5af11bb71833d89cd74387fcb/logs /var/www/html/irclogs/plomlompomtest
diff --git a/all_new_2018/user_scripts/start_plomlombot.sh b/all_new_2018/user_scripts/start_plomlombot.sh
new file mode 100755
index 0000000..8a368bc
--- /dev/null
+++ b/all_new_2018/user_scripts/start_plomlombot.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+set -e
+cd ~/plomlombot-irc
+./run.sh -r 604800 -n "$1" "$2"
-- 
2.30.2