Introduce FrontlineSMS Docker image, closes #151

This commit is contained in:
Disassembler 2018-03-30 21:58:44 +02:00
parent f17ea16a7d
commit 3030131322
No known key found for this signature in database
GPG Key ID: 524BD33A0EE29499
11 changed files with 150 additions and 1 deletions

View File

@ -12,6 +12,7 @@ ${SOURCE_DIR}/basic.sh
${SOURCE_DIR}/ckan.sh
# ${SOURCE_DIR}/ccleanup.sh
# ${SOURCE_DIR}/cts.sh
${SOURCE_DIR}/flsms.sh
${SOURCE_DIR}/gnuhealth.sh
${SOURCE_DIR}/kanboard.sh
${SOURCE_DIR}/mifosx.sh

View File

@ -66,6 +66,7 @@ vi 00-install.sh
| CKAN Datapusher | ckandp | 8004 | 8080 (HTTP) |
| Crisis Cleanup | ccleanup | 8005 | 8080 (HTTP) |
| CTS | cts | 8006 | 8080 (HTTP) |
| FrontlineSMS | flsms | 8018 | 8080 (HTTP) |
| GNU Health | gnuhealth | 8008 | 8080 (HTTP) |
| KanBoard | kanboard | 8009 | 8080 (HTTP) |
| MariaDB | mariadb | 3306 | 3306 (MySQL) |

View File

@ -134,7 +134,7 @@
</ul>
</div>
<div class="c" id="frontlinesms">
<div class="c" id="flsms">
<h2><a href="#"><img src="img/FrontlineSMS.png" alt="FrontlineSMS" title="FrontlineSMS">FrontlineSMS</a></h2>
<p><strong>SMS messaging</strong> přes veřejné datové brány</p>
<ul>

26
flsms.sh Executable file
View File

@ -0,0 +1,26 @@
#!/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}
# 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
# Create FrontlineSMS service
cp ${SOURCE_DIR}/etc/init.d/flsms /etc/init.d/flsms
rc-update add flsms
service flsms start
# Add application definition
spotter-appmgr add-app flsms "https://flsms.{host}/" "${FLSMS_ADMIN_USER}" "${FLSMS_ADMIN_PWD}"

25
flsms/Dockerfile Normal file
View File

@ -0,0 +1,25 @@
FROM java
MAINTAINER Disassembler <disassembler@dasm.cz>
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 \
# 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' \
# Replace Jetty port
&& sed -i 's/8130/8080/' /srv/flsms/frontlinesms2/launcher.properties \
# Cleanup
&& rm /tmp/frontlinesms2.sh
COPY docker/ /
VOLUME ["/srv/flsms/.frontlinesms2"]
EXPOSE 8080
CMD ["s6-svscan", "/etc/services.d"]

View File

@ -0,0 +1,53 @@
Section "ServerFlags"
Option "DontVTSwitch" "true"
Option "AllowMouseOpenFail" "true"
Option "PciForceNone" "true"
Option "AutoEnableDevices" "false"
Option "AutoAddDevices" "false"
EndSection
Section "InputDevice"
Identifier "dummy_mouse"
Option "CorePointer" "true"
Driver "void"
EndSection
Section "InputDevice"
Identifier "dummy_keyboard"
Option "CoreKeyboard" "true"
Driver "void"
EndSection
Section "Device"
Identifier "dummy_videocard"
Driver "dummy"
Option "ConstantDPI" "true"
VideoRam 192000
EndSection
Section "Monitor"
Identifier "dummy_monitor"
HorizSync 5.0 - 1000.0
VertRefresh 5.0 - 200.0
Modeline "1280x720" 27.41 1280 1312 1416 1448 720 737 740 757
EndSection
Section "Screen"
Identifier "dummy_screen"
Device "dummy_videocard"
Monitor "dummy_monitor"
DefaultDepth 24
SubSection "Display"
Viewport 0 0
Depth 24
Modes "1280x720"
Virtual 8192 4096
EndSubSection
EndSection
Section "ServerLayout"
Identifier "dummy_layout"
Screen "dummy_screen"
InputDevice "dummy_mouse"
InputDevice "dummy_keyboard"
EndSection

View File

@ -0,0 +1,3 @@
#!/bin/sh
/bin/true

View File

@ -0,0 +1,8 @@
#!/bin/execlineb -P
foreground { s6-svwait -t 3000 -u /etc/services.d/xorg }
cd /srv/flsms
export DISPLAY :10
fdmove -c 2 1
s6-setuidgid 8018:8018
/srv/flsms/frontlinesms2/FrontlineSMS2_Launcher

View File

@ -0,0 +1,5 @@
#!/bin/execlineb -P
fdmove -c 2 1
s6-setuidgid 8018:8018
Xorg -noreset +extension GLX +extension RANDR +extension RENDER -config dummy.conf :10

24
flsms/etc/init.d/flsms Executable file
View File

@ -0,0 +1,24 @@
#!/sbin/openrc-run
description="FrontlineSMS docker container"
depend() {
need docker net
use dns logger netmount
}
start() {
/usr/bin/docker run -d --rm \
--name flsms \
-h flsms \
-v /srv/flsms/data:/srv/flsms/.frontlinesms2 \
flsms
}
start_post() {
/usr/local/bin/spotter-appmgr update-proxy flsms
}
stop() {
/usr/bin/docker stop flsms
}

View File

@ -0,0 +1,3 @@
auth.basic.enabled=on
auth.basic.username=${FLSMS_ADMIN_USER_HASH}
auth.basic.password=${FLSMS_ADMIN_PWD_HASH}