Alpinize OpenMapKit
This commit is contained in:
parent
c0198b4dc7
commit
4c8e5452f5
@ -1,4 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
|
|
||||||
SOURCE_DIR=$(realpath $(dirname "${0}"))/openmapkit
|
SOURCE_DIR=$(realpath $(dirname "${0}"))/openmapkit
|
||||||
|
|
||||||
@ -8,22 +8,22 @@ docker build -t openmapkit ${SOURCE_DIR}
|
|||||||
# Configure OpenMapKit
|
# Configure OpenMapKit
|
||||||
export OMK_ADMIN_USER="admin"
|
export OMK_ADMIN_USER="admin"
|
||||||
export OMK_ADMIN_PWD=$(head -c 12 /dev/urandom | base64)
|
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
|
envsubst <${SOURCE_DIR}/srv/openmapkit/settings.js >/srv/openmapkit/settings.js
|
||||||
chown -R 8007:8007 /srv/openmapkit/data
|
chown -R 8007:8007 /srv/openmapkit/data
|
||||||
|
|
||||||
# Configure OpenMapKit service
|
# Configure OpenMapKit service
|
||||||
cp ${SOURCE_DIR}/lib/systemd/system/openmapkit.service /lib/systemd/system/openmapkit.service
|
cp ${SOURCE_DIR}/etc/init.d/openmapkit /etc/init.d/openmapkit
|
||||||
systemctl daemon-reload
|
rc-update add openmapkit boot
|
||||||
systemctl enable openmapkit
|
service openmapkit start
|
||||||
systemctl start openmapkit
|
|
||||||
|
|
||||||
# Create nginx site definition
|
# Create nginx site definition
|
||||||
cp ${SOURCE_DIR}/etc/nginx/sites-available/openmapkit /etc/nginx/sites-available/openmapkit
|
cp ${SOURCE_DIR}/etc/nginx/apps/openmapkit /etc/nginx/apps/openmapkit
|
||||||
ln -s /etc/nginx/sites-available/openmapkit /etc/nginx/sites-enabled/openmapkit
|
cp ${SOURCE_DIR}/etc/nginx/conf.d/openmapkit.conf /etc/nginx/conf.d/openmapkit.conf
|
||||||
|
|
||||||
# Restart services
|
# Reload nginx configuration
|
||||||
systemctl restart nginx
|
service nginx reload
|
||||||
|
|
||||||
# Add portal application definition
|
# Add portal application definition
|
||||||
portal-app-manager openmapkit "https://{host}:8407/" admin "${OMK_ADMIN_PWD}"
|
portal-app-manager openmapkit "https://{host}:8407/" admin "${OMK_ADMIN_PWD}"
|
||||||
|
@ -3,8 +3,9 @@ MAINTAINER Disassembler <disassembler@dasm.cz>
|
|||||||
|
|
||||||
RUN apk --no-cache add python2
|
RUN apk --no-cache add python2
|
||||||
|
|
||||||
RUN apk --no-cache add --virtual .deps git build-base py2-pip \
|
RUN apk --no-cache add --virtual .deps git build-base paxctl py2-pip \
|
||||||
&& apk add nodejs git openjdk8-jre-base \
|
&& 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 \
|
&& git clone --depth 1 https://github.com/AmericanRedCross/OpenMapKitServer /srv/openmapkit \
|
||||||
&& cd /srv/openmapkit \
|
&& cd /srv/openmapkit \
|
||||||
&& git submodule update --init \
|
&& git submodule update --init \
|
||||||
|
16
openmapkit/etc/init.d/openmapkit
Executable file
16
openmapkit/etc/init.d/openmapkit
Executable 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
|
||||||
|
}
|
9
openmapkit/etc/nginx/apps/openmapkit
Normal file
9
openmapkit/etc/nginx/apps/openmapkit
Normal 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;
|
||||||
|
}
|
11
openmapkit/etc/nginx/conf.d/openmapkit.conf
Normal file
11
openmapkit/etc/nginx/conf.d/openmapkit.conf
Normal 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;
|
||||||
|
}
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
@ -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
|
|
Loading…
Reference in New Issue
Block a user