From 9164ea8111772c162aa63c7057f4cf560e53009f Mon Sep 17 00:00:00 2001 From: Disassembler Date: Sat, 21 Apr 2018 22:43:57 +0200 Subject: [PATCH] Revert long naming for FrontlineSMS --- 00-install.sh | 2 +- flsms.sh | 21 --------------- flsms/etc/init.d/flsms | 27 ------------------- flsms/srv/flsms/data/app-settings.properties | 3 --- frontlinesms.sh | 21 +++++++++++++++ {flsms => frontlinesms}/Dockerfile | 10 +++---- .../docker/etc/X11/dummy.conf | 0 .../docker/etc/services.d/.s6-svscan/finish | 0 .../docker/etc/services.d/frontlinesms/run | 4 +-- .../docker/etc/services.d/xorg/run | 0 frontlinesms/etc/init.d/frontlinesms | 27 +++++++++++++++++++ .../frontlinesms/data/app-settings.properties | 3 +++ 12 files changed, 59 insertions(+), 59 deletions(-) delete mode 100755 flsms.sh delete mode 100755 flsms/etc/init.d/flsms delete mode 100644 flsms/srv/flsms/data/app-settings.properties create mode 100755 frontlinesms.sh rename {flsms => frontlinesms}/Dockerfile (66%) rename {flsms => frontlinesms}/docker/etc/X11/dummy.conf (100%) rename {flsms => frontlinesms}/docker/etc/services.d/.s6-svscan/finish (100%) rename {flsms => frontlinesms}/docker/etc/services.d/frontlinesms/run (63%) rename {flsms => frontlinesms}/docker/etc/services.d/xorg/run (100%) create mode 100755 frontlinesms/etc/init.d/frontlinesms create mode 100644 frontlinesms/srv/frontlinesms/data/app-settings.properties diff --git a/00-install.sh b/00-install.sh index 2136874..7c1f637 100755 --- a/00-install.sh +++ b/00-install.sh @@ -12,7 +12,7 @@ ${SOURCE_DIR}/basic.sh ${SOURCE_DIR}/ckan.sh # ${SOURCE_DIR}/crisiscleanup.sh # ${SOURCE_DIR}/cts.sh -${SOURCE_DIR}/flsms.sh +${SOURCE_DIR}/frontlinesms.sh ${SOURCE_DIR}/gnuhealth.sh ${SOURCE_DIR}/kanboard.sh ${SOURCE_DIR}/mifosx.sh diff --git a/flsms.sh b/flsms.sh deleted file mode 100755 index 771608d..0000000 --- a/flsms.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh - -SOURCE_DIR=$(realpath $(dirname "${0}"))/flsms - -# Check prerequisites -docker image ls | grep -q java || $(realpath $(dirname "${0}"))/java.sh - -# Build Docker container -docker build -t flsms ${SOURCE_DIR} -cp ${SOURCE_DIR}/etc/init.d/flsms /etc/init.d/flsms -rc-update -u - -# Configure FrontlineSMS -mkdir -p /srv/flsms/data -export FLSMS_ADMIN_USER="admin" -export FLSMS_ADMIN_PWD=$(head -c 12 /dev/urandom | base64) -export FLSMS_ADMIN_USER_HASH=$(echo -n "${FLSMS_ADMIN_USER}" | base64) -export FLSMS_ADMIN_PWD_HASH=$(echo -n "${FLSMS_ADMIN_PWD}" | base64) -envsubst <${SOURCE_DIR}/srv/flsms/data/app-settings.properties >/srv/flsms/data/app-settings.properties -chown -R 8018:8018 /srv/flsms/data -spotter-appmgr update-login flsms "${FLSMS_ADMIN_USER}" "${FLSMS_ADMIN_PWD}" diff --git a/flsms/etc/init.d/flsms b/flsms/etc/init.d/flsms deleted file mode 100755 index 93c2185..0000000 --- a/flsms/etc/init.d/flsms +++ /dev/null @@ -1,27 +0,0 @@ -#!/sbin/openrc-run - -description="FrontlineSMS docker container" - -depend() { - need docker -} - -start() { - /usr/bin/docker run -d --rm \ - --name flsms \ - -h flsms \ - -v /srv/flsms/data:/srv/flsms/.frontlinesms2 \ - flsms -} - -start_post() { - /usr/bin/spotter-appmgr register-proxy flsms -} - -stop_pre() { - /usr/bin/spotter-appmgr unregister-proxy flsms -} - -stop() { - /usr/bin/docker stop flsms -} diff --git a/flsms/srv/flsms/data/app-settings.properties b/flsms/srv/flsms/data/app-settings.properties deleted file mode 100644 index 80007e9..0000000 --- a/flsms/srv/flsms/data/app-settings.properties +++ /dev/null @@ -1,3 +0,0 @@ -auth.basic.enabled=on -auth.basic.username=${FLSMS_ADMIN_USER_HASH} -auth.basic.password=${FLSMS_ADMIN_PWD_HASH} diff --git a/frontlinesms.sh b/frontlinesms.sh new file mode 100755 index 0000000..0096754 --- /dev/null +++ b/frontlinesms.sh @@ -0,0 +1,21 @@ +#!/bin/sh + +SOURCE_DIR=$(realpath $(dirname "${0}"))/frontlinesms + +# Check prerequisites +docker image ls | grep -q java || $(realpath $(dirname "${0}"))/java.sh + +# Build Docker container +docker build -t frontlinesms ${SOURCE_DIR} +cp ${SOURCE_DIR}/etc/init.d/frontlinesms /etc/init.d/frontlinesms +rc-update -u + +# Configure FrontlineSMS +mkdir -p /srv/frontlinesms/data +export FRONTLINESMS_ADMIN_USER="admin" +export FRONTLINESMS_ADMIN_PWD=$(head -c 12 /dev/urandom | base64) +export FRONTLINESMS_ADMIN_USER_HASH=$(echo -n "${FRONTLINESMS_ADMIN_USER}" | base64) +export FRONTLINESMS_ADMIN_PWD_HASH=$(echo -n "${FRONTLINESMS_ADMIN_PWD}" | base64) +envsubst <${SOURCE_DIR}/srv/frontlinesms/data/app-settings.properties >/srv/frontlinesms/data/app-settings.properties +chown -R 8018:8018 /srv/frontlinesms/data +spotter-appmgr update-login frontlinesms "${FRONTLINESMS_ADMIN_USER}" "${FRONTLINESMS_ADMIN_PWD}" diff --git a/flsms/Dockerfile b/frontlinesms/Dockerfile similarity index 66% rename from flsms/Dockerfile rename to frontlinesms/Dockerfile index 337cda4..7fed98c 100644 --- a/flsms/Dockerfile +++ b/frontlinesms/Dockerfile @@ -5,21 +5,21 @@ RUN \ # Install runtime dependencies apk --no-cache add openjdk8-jre s6 ttf-dejavu xf86-video-dummy xorg-server \ # Create OS user - && addgroup -S -g 8018 flsms \ - && adduser -S -u 8018 -h /srv/flsms -s /bin/sh -g flsms -G flsms flsms \ + && addgroup -S -g 8018 sms \ + && adduser -S -u 8018 -h /srv/frontlinesms -s /bin/sh -g sms -G sms sms \ # Install FrontlineSMS && wget http://download-frontlinesms.s3.amazonaws.com/frontlinesms2_unix_2.6.5.sh -O /tmp/frontlinesms2.sh \ # Hackfix for Busybox gunzip && sed -i 's/gunzip -V/echo/' /tmp/frontlinesms2.sh \ - && echo -e 'o\n\nn\nSpotter\nSpotter\n11\n45\n\n\nadmin@example.com\n\n\n\n\n\n\n\n\n\n\n' | su - flsms -c 'sh /tmp/frontlinesms2.sh -c' \ + && echo -e 'o\n\nn\nSpotter\nSpotter\n11\n45\n\n\nadmin@example.com\n\n\n\n\n\n\n\n\n\n\n' | su - sms -c 'sh /tmp/frontlinesms2.sh -c' \ # Replace Jetty port - && sed -i 's/8130/8080/' /srv/flsms/frontlinesms2/launcher.properties \ + && sed -i 's/8130/8080/' /srv/frontlinesms/frontlinesms2/launcher.properties \ # Cleanup && rm /tmp/frontlinesms2.sh COPY docker/ / -VOLUME ["/srv/flsms/.frontlinesms2"] +VOLUME ["/srv/frontlinesms/.frontlinesms2"] EXPOSE 8080 CMD ["s6-svscan", "/etc/services.d"] diff --git a/flsms/docker/etc/X11/dummy.conf b/frontlinesms/docker/etc/X11/dummy.conf similarity index 100% rename from flsms/docker/etc/X11/dummy.conf rename to frontlinesms/docker/etc/X11/dummy.conf diff --git a/flsms/docker/etc/services.d/.s6-svscan/finish b/frontlinesms/docker/etc/services.d/.s6-svscan/finish similarity index 100% rename from flsms/docker/etc/services.d/.s6-svscan/finish rename to frontlinesms/docker/etc/services.d/.s6-svscan/finish diff --git a/flsms/docker/etc/services.d/frontlinesms/run b/frontlinesms/docker/etc/services.d/frontlinesms/run similarity index 63% rename from flsms/docker/etc/services.d/frontlinesms/run rename to frontlinesms/docker/etc/services.d/frontlinesms/run index c60a196..0d71114 100755 --- a/flsms/docker/etc/services.d/frontlinesms/run +++ b/frontlinesms/docker/etc/services.d/frontlinesms/run @@ -1,8 +1,8 @@ #!/bin/execlineb -P foreground { s6-svwait -t 3000 -u /etc/services.d/xorg } -cd /srv/flsms +cd /srv/frontlinesms export DISPLAY :10 fdmove -c 2 1 s6-setuidgid 8018:8018 -/srv/flsms/frontlinesms2/FrontlineSMS2_Launcher +/srv/frontlinesms/frontlinesms2/FrontlineSMS2_Launcher diff --git a/flsms/docker/etc/services.d/xorg/run b/frontlinesms/docker/etc/services.d/xorg/run similarity index 100% rename from flsms/docker/etc/services.d/xorg/run rename to frontlinesms/docker/etc/services.d/xorg/run diff --git a/frontlinesms/etc/init.d/frontlinesms b/frontlinesms/etc/init.d/frontlinesms new file mode 100755 index 0000000..dfb314b --- /dev/null +++ b/frontlinesms/etc/init.d/frontlinesms @@ -0,0 +1,27 @@ +#!/sbin/openrc-run + +description="FrontlineSMS docker container" + +depend() { + need docker +} + +start() { + /usr/bin/docker run -d --rm \ + --name frontlinesms \ + -h frontlinesms \ + -v /srv/frontlinesms/data:/srv/frontlinesms/.frontlinesms2 \ + frontlinesms +} + +start_post() { + /usr/bin/spotter-appmgr register-proxy frontlinesms +} + +stop_pre() { + /usr/bin/spotter-appmgr unregister-proxy frontlinesms +} + +stop() { + /usr/bin/docker stop frontlinesms +} diff --git a/frontlinesms/srv/frontlinesms/data/app-settings.properties b/frontlinesms/srv/frontlinesms/data/app-settings.properties new file mode 100644 index 0000000..fddeff0 --- /dev/null +++ b/frontlinesms/srv/frontlinesms/data/app-settings.properties @@ -0,0 +1,3 @@ +auth.basic.enabled=on +auth.basic.username=${FRONTLINESMS_ADMIN_USER_HASH} +auth.basic.password=${FRONTLINESMS_ADMIN_PWD_HASH}