From d838b832eb08253398a7b27320020a4e3e2ad392 Mon Sep 17 00:00:00 2001 From: dudas Date: Thu, 1 Mar 2018 18:54:01 +0100 Subject: [PATCH 1/4] Added optional external config functionality --- Dockerfile | 7 +++++-- start.sh | 10 ++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) create mode 100755 start.sh diff --git a/Dockerfile b/Dockerfile index c3f3899..dc08dc4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,7 +20,6 @@ RUN apt-get update && apt-get install -y \ pkg-config \ python \ supervisor \ - && rm -rf /var/lib/apt/lists/* @@ -30,9 +29,13 @@ RUN cd /opt && git clone https://github.com/ether/etherpad-lite.git etherpad # Install node dependencies RUN /opt/etherpad/bin/installDeps.sh +#mk dir for settins +RUN mkdir -p /opt/vol/ + # Add conf files ADD settings.json /opt/etherpad/settings.json ADD supervisor.conf /etc/supervisor/supervisor.conf +ADD start.sh /usr/bin/start.sh EXPOSE 9001 -CMD ["supervisord", "-c", "/etc/supervisor/supervisor.conf", "-n"] +CMD ["start.sh"] diff --git a/start.sh b/start.sh new file mode 100755 index 0000000..dee175c --- /dev/null +++ b/start.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +if [ -f /opt/vol/settings.json ]; then + echo "Volume with config was loaded" + echo "Using injected config…" + cp /opt/vol/settings.json /opt/etherpad/settings.json +else + echo "Using default config" +fi +supervisord -c /etc/supervisor/supervisor.conf -n From d42d614091ae01017cbaa7db790a0d7bed57a3d2 Mon Sep 17 00:00:00 2001 From: dudas Date: Thu, 1 Mar 2018 18:59:08 +0100 Subject: [PATCH 2/4] Modified config --- README.md | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index f858c46..82e5b59 100644 --- a/README.md +++ b/README.md @@ -14,12 +14,10 @@ To run Etherpad on port 80, run: `docker run -d -p 80:9001 leibnitius/etherpad-docker` -To edit the Etherpad settings.json, it is necessary to clone the Git repository: +To edit the Etherpad settings.json, run: -`git clone git://github.com/ether/etherpad-docker.git && cd etherpad-docker` +`docker run -d -v /var/config:/opt/vol -p 9001:9001 leibnitius/etherpad-docker` -Then edit the settings.json to your liking and run: - -`docker build -t /etherpad-docker .` +Your Etherpad configutation has to be located at `/var/config/settings.json`. This image could also be used as a base for Docker Etherpad images integrated with MySQL, etc. From 80b465524f0f770ce1c089418955a06aa552aef5 Mon Sep 17 00:00:00 2001 From: dudas Date: Thu, 1 Mar 2018 19:00:53 +0100 Subject: [PATCH 3/4] Improve README.md --- README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 82e5b59..de954e0 100644 --- a/README.md +++ b/README.md @@ -14,10 +14,9 @@ To run Etherpad on port 80, run: `docker run -d -p 80:9001 leibnitius/etherpad-docker` -To edit the Etherpad settings.json, run: +To use your custom Etherpad settings.json, the file has to be located at `/var/config/settings.json`. +Then run: `docker run -d -v /var/config:/opt/vol -p 9001:9001 leibnitius/etherpad-docker` -Your Etherpad configutation has to be located at `/var/config/settings.json`. - This image could also be used as a base for Docker Etherpad images integrated with MySQL, etc. From beaf6e89859eee1c8a2032e7826c4433b2ca96fb Mon Sep 17 00:00:00 2001 From: Sebastian Duda Date: Mon, 5 Mar 2018 21:01:36 +0100 Subject: [PATCH 4/4] add custom apikey feature --- start.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/start.sh b/start.sh index dee175c..8f9b588 100755 --- a/start.sh +++ b/start.sh @@ -7,4 +7,13 @@ if [ -f /opt/vol/settings.json ]; then else echo "Using default config" fi + +if [ -f /opt/vol/APIKEY.txt ]; then + echo "Using custom apikey" + cp /opt/vol/APIKEY.txt /opt/etherpad/APIKEY.txt +else + echo "using generated api key" + cat /opt/etherpad/APIKEY.txt +fi + supervisord -c /etc/supervisor/supervisor.conf -n