From f77c9df2c2413a48c8ed73d620269c054e486bf8 Mon Sep 17 00:00:00 2001
From: Armin <armin.co@stud.hs-bochum.de>
Date: Tue, 27 Apr 2021 16:22:40 +0200
Subject: [PATCH] Added etherpad option to config

---
 config.py                   | 12 +++++++-----
 etherpad/docker-compose.yml | 14 ++++++++++++++
 setup.py                    | 11 ++++++++++-
 3 files changed, 31 insertions(+), 6 deletions(-)
 create mode 100644 etherpad/docker-compose.yml

diff --git a/config.py b/config.py
index c5f14cb..d571e8a 100644
--- a/config.py
+++ b/config.py
@@ -8,11 +8,8 @@ MAIL_ADDRESS = 'your-mail@address.com'
 use_jitsi = True
 jitsi_subdomain = 'jitsi'
 
-# NoVNC
-use_NoVnc = False
-
-# MumbleWeb
-use_MumbleWeb = False
+# Etherpad
+use_etherpad = True
 
 """ Setting up all envrionment variables """
 BASE_COMPOSE_FILE = '-f docker-compose.base.yml '
@@ -30,6 +27,11 @@ if use_jitsi:
     docker_compose_files += ' -f ' + JITSI_COMPOSE_FILE + ' '
     subdomains += jitsi_subdomain
 
+if use_etherpad and use_jitsi:
+    ETHERPAD_COMPOSE_FILE = 'etherpad/docker-compose.yml'
+    docker_compose_files += ' -f ' + ETHERPAD_COMPOSE_FILE + ' '
+    
+
 if __name__ == '__main__':
     SOURCE_FILE = 'local_source'
     os.system('rm -f ' + SOURCE_FILE)
diff --git a/etherpad/docker-compose.yml b/etherpad/docker-compose.yml
new file mode 100644
index 0000000..7ae42a4
--- /dev/null
+++ b/etherpad/docker-compose.yml
@@ -0,0 +1,14 @@
+version: '3.4'
+services:
+    etherpad:
+        container_name: etherpad
+        image: etherpad/etherpad
+        environment: 
+            - PUID=1000
+            - GUID=1000
+            - TZ=Europe/Berlin
+        ports:
+            - 9001:9001
+        restart: unless-stopped
+        networks:
+            - reverse_proxy
diff --git a/setup.py b/setup.py
index 53ef79b..3489f57 100644
--- a/setup.py
+++ b/setup.py
@@ -31,7 +31,7 @@ def setup_jitsi():
     rc = subprocess.call('./jitsi/gen-passwords.sh .', shell=True)
     os.system('rm -f .env')
     os.system('sudo rm -rf ~/.jitsi-meet-cfg')
-    os.system('mkdir -p ~/.jitsi-meet-cfg/{web/letsencrypt,transcripts,prosody,jicofo,jvb,jigasi,jibri}')
+    os.system('mkdir -p ~/.jitsi-meet-cfg/{web,letsencrypt,transcripts,prosody,jicofo,jvb,jigasi,jibri}')
     
     f = open('jitsi/.env', 'rt')
     data = f.read()
@@ -54,8 +54,17 @@ def setup_jitsi():
     f.close()
     os.system('cp jitsi-auto-config/jitsi.subdomain.conf reverse_proxy/nginx/proxy-confs/'+ jitsi_subdomain + '.subdomain.conf')
 
+def setup_etherpad():
+    f = open('.env')
+    data = f.read()
+    f.close()
+    data.replace('#ETHERPAD_URL_BASE=http://etherpad.meet.jitsi:9001', 'ETHERPAD_URL_BASE=http://etherpad:9001')
+
 if __name__ == '__main__':
     configure_swag()
 
     if use_jitsi:
         setup_jitsi()
+    
+    if use_etherpad:
+        setup_etherpad()
-- 
GitLab