Introduce FrontlineSMS Docker image, closes #151
This commit is contained in:
parent
f17ea16a7d
commit
3030131322
@ -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
|
||||
|
@ -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) |
|
||||
|
@ -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
26
flsms.sh
Executable 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
25
flsms/Dockerfile
Normal 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"]
|
53
flsms/docker/etc/X11/dummy.conf
Normal file
53
flsms/docker/etc/X11/dummy.conf
Normal 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
|
3
flsms/docker/etc/services.d/.s6-svscan/finish
Executable file
3
flsms/docker/etc/services.d/.s6-svscan/finish
Executable file
@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
/bin/true
|
8
flsms/docker/etc/services.d/frontlinesms/run
Executable file
8
flsms/docker/etc/services.d/frontlinesms/run
Executable 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
|
5
flsms/docker/etc/services.d/xorg/run
Executable file
5
flsms/docker/etc/services.d/xorg/run
Executable 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
24
flsms/etc/init.d/flsms
Executable 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
|
||||
}
|
3
flsms/srv/flsms/data/app-settings.properties
Normal file
3
flsms/srv/flsms/data/app-settings.properties
Normal file
@ -0,0 +1,3 @@
|
||||
auth.basic.enabled=on
|
||||
auth.basic.username=${FLSMS_ADMIN_USER_HASH}
|
||||
auth.basic.password=${FLSMS_ADMIN_PWD_HASH}
|
Loading…
Reference in New Issue
Block a user