Alpinize OpenMapKit

This commit is contained in:
Disassembler 2017-12-19 20:27:51 +01:00
parent c0198b4dc7
commit 4c8e5452f5
7 changed files with 49 additions and 37 deletions

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh
SOURCE_DIR=$(realpath $(dirname "${0}"))/openmapkit
@ -8,22 +8,22 @@ docker build -t openmapkit ${SOURCE_DIR}
# Configure OpenMapKit
export OMK_ADMIN_USER="admin"
export OMK_ADMIN_PWD=$(head -c 12 /dev/urandom | base64)
mkdir -p /srv/openmapkit/data/{deployments,submissions}
mkdir -p /srv/openmapkit/data/deployments
mkdir /srv/openmapkit/data/submissions
envsubst <${SOURCE_DIR}/srv/openmapkit/settings.js >/srv/openmapkit/settings.js
chown -R 8007:8007 /srv/openmapkit/data
# Configure OpenMapKit service
cp ${SOURCE_DIR}/lib/systemd/system/openmapkit.service /lib/systemd/system/openmapkit.service
systemctl daemon-reload
systemctl enable openmapkit
systemctl start openmapkit
cp ${SOURCE_DIR}/etc/init.d/openmapkit /etc/init.d/openmapkit
rc-update add openmapkit boot
service openmapkit start
# Create nginx site definition
cp ${SOURCE_DIR}/etc/nginx/sites-available/openmapkit /etc/nginx/sites-available/openmapkit
ln -s /etc/nginx/sites-available/openmapkit /etc/nginx/sites-enabled/openmapkit
cp ${SOURCE_DIR}/etc/nginx/apps/openmapkit /etc/nginx/apps/openmapkit
cp ${SOURCE_DIR}/etc/nginx/conf.d/openmapkit.conf /etc/nginx/conf.d/openmapkit.conf
# Restart services
systemctl restart nginx
# Reload nginx configuration
service nginx reload
# Add portal application definition
portal-app-manager openmapkit "https://{host}:8407/" admin "${OMK_ADMIN_PWD}"

View File

@ -3,8 +3,9 @@ MAINTAINER Disassembler <disassembler@dasm.cz>
RUN apk --no-cache add python2
RUN apk --no-cache add --virtual .deps git build-base py2-pip \
&& apk add nodejs git openjdk8-jre-base \
RUN apk --no-cache add --virtual .deps git build-base paxctl py2-pip \
&& apk --no-cache add nodejs git openjdk8-jre-base \
&& paxctl -cm /usr/bin/node \
&& git clone --depth 1 https://github.com/AmericanRedCross/OpenMapKitServer /srv/openmapkit \
&& cd /srv/openmapkit \
&& git submodule update --init \

View File

@ -0,0 +1,16 @@
#!/sbin/openrc-run
description="OpenMapKit docker container"
depend() {
need docker net
use dns logger netmount
}
start() {
/usr/bin/docker run -d --rm --name openmapkit -p 127.0.0.1:9007:8007 -v /srv/openmapkit/settings.js:/srv/openmapkit/settings.js -v /srv/openmapkit/data:/srv/openmapkit/data openmapkit
}
stop() {
/usr/bin/docker kill openmapkit
}

View File

@ -0,0 +1,9 @@
access_log /var/log/nginx/openmapkit.access.log;
error_log /var/log/nginx/openmapkit.error.log;
location / {
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Host $host:$server_port;
proxy_set_header X-Forwarded-Proto https;
proxy_pass http://127.0.0.1:9007;
}

View File

@ -0,0 +1,11 @@
server {
listen 8007;
listen [::]:8007;
include apps/openmapkit;
}
server {
listen 8407 ssl http2;
listen [::]:8407 ssl http2;
include apps/openmapkit;
}

View File

@ -1,14 +0,0 @@
server {
listen 8007 ssl http2;
listen [::]:8007 ssl http2;
access_log /var/log/nginx/openmapkit.access.log;
error_log /var/log/nginx/openmapkit.error.log;
location / {
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Host $host:$server_port;
proxy_set_header X-Forwarded-Proto https;
proxy_pass http://127.0.0.1:8096;
}
}

View File

@ -1,11 +0,0 @@
[Unit]
Description=OpenMapKit Docker container
After=network.target
[Service]
Type=simple
ExecStart=/usr/bin/docker run --rm --name openmapkit -p 127.0.0.1:9007:8007 -v /srv/openmapkit/settings.js:/srv/openmapkit/settings.js -v /srv/openmapkit/data:/srv/openmapkit/data openmapkit
ExecStop=/usr/bin/docker kill openmapkit
[Install]
WantedBy=multi-user.target