Introduce install script for OpenMapKit, closes #149

This commit is contained in:
Disassembler 2017-12-12 05:48:36 +01:00
parent 32550c1517
commit 0f228fb1fe
7 changed files with 125 additions and 5 deletions

View File

@ -16,6 +16,7 @@ ${SOURCE_DIR}/gnuhealth.sh
${SOURCE_DIR}/kanboard.sh ${SOURCE_DIR}/kanboard.sh
${SOURCE_DIR}/mifosx.sh ${SOURCE_DIR}/mifosx.sh
${SOURCE_DIR}/motech.sh ${SOURCE_DIR}/motech.sh
${SOURCE_DIR}/openmapkit.sh
${SOURCE_DIR}/pandora.sh ${SOURCE_DIR}/pandora.sh
${SOURCE_DIR}/sahana.sh ${SOURCE_DIR}/sahana.sh
${SOURCE_DIR}/sambro.sh ${SOURCE_DIR}/sambro.sh

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

View File

@ -49,7 +49,7 @@
<h2><a href="#"><img src="img/EDEN.png" alt="SAMBRO Mobile" title="SAMBRO Mobile">SAMBRO Mobile</a></h2> <h2><a href="#"><img src="img/EDEN.png" alt="SAMBRO Mobile" title="SAMBRO Mobile">SAMBRO Mobile</a></h2>
<p>Mobilní klient k aplikaci Sahana EDEN. Po stažení se zaregistrujte a pro přístup k serveru zadejte IP vaší instalace Sahana EDEN.<br> <p>Mobilní klient k aplikaci Sahana EDEN. Po stažení se zaregistrujte a pro přístup k serveru zadejte IP vaší instalace Sahana EDEN.<br>
<a href="https://itunes.apple.com/us/app/sambro-mobile/id1127251669"><img src="img/ios.png" class="ico" alt="IOS">IOS 6.0 a vyšší</a><br> <a href="https://itunes.apple.com/us/app/sambro-mobile/id1127251669"><img src="img/ios.png" class="ico" alt="IOS">IOS 6.0 a vyšší</a><br>
<a href="https://play.google.com/store/apps/details?id=io.sahana.sambro.mobile&amp;hl=cs"><img src="img/android.png" class="ico" alt="Android">Android 4.0 a vyšší</a> <a href="https://play.google.com/store/apps/details?id=io.sahana.sambro.mobile"><img src="img/android.png" class="ico" alt="Android">Android 4.0 a vyšší</a>
</p> </p>
</div> </div>
@ -71,7 +71,7 @@
</ul> </ul>
</div> </div>
<div class="c" id="open-data-kit"> <div class="c" id="opendatakit">
<h2><a href="#"><img src="img/ODK.png" alt="Open Data Kit" title="Open Data Kit">Open Data Kit</a></h2> <h2><a href="#"><img src="img/ODK.png" alt="Open Data Kit" title="Open Data Kit">Open Data Kit</a></h2>
<p><strong>Sběr dat s pomocí smartphone</strong>.<br> <p><strong>Sběr dat s pomocí smartphone</strong>.<br>
<a href="http://geoodk.com/xlsform_converter.html">XLSForm</a> - online konverter XLS.<br> <a href="http://geoodk.com/xlsform_converter.html">XLSForm</a> - online konverter XLS.<br>
@ -83,6 +83,26 @@
</ul> </ul>
</div> </div>
<div class="c" id="openmapkit">
<h2><a href="#"><img src="img/OMK.png" alt="Open Map Kit" title="Open Map Kit">Open Data Kit</a></h2>
<p><strong>Sběr dat s pomocí smartphone</strong>.<br>
<ul>
<li><strong>Login:</strong> <span class="login"></span></li>
<li><strong>Heslo:</strong> <span class="password"></span></li>
</ul>
</div>
<div class="c" id="openmapkit-clients">
<h2><a href="#"><img src="img/OMK.png" alt="Open Map Kit" title="Open Map Kit">Open Map Kit</a></h2>
<p>Mobilní aplikace<br>
<a href="https://play.google.com/store/apps/details?id=org.odk.collect.android"><img src="img/android.png" class="ico" alt="ODK Collect">ODK Collect pro Android</a><br>
<a href="https://play.google.com/store/apps/details?id=org.redcross.openmapkit"><img src="img/android.png" class="ico" alt="Android">OpenMapKit pro Android 4.1 a vyšší</a>
</p>
<ul>
<li><strong>URL:</strong> <span class="clienturl"></span></li>
</ul>
</div>
<div class="c" id="frontlinesms"> <div class="c" id="frontlinesms">
<h2><a href="#"><img src="img/FrontlineSMS.png" alt="FrontlineSMS" title="FrontlineSMS">FrontlineSMS</a></h2> <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> <p><strong>SMS messaging</strong> přes veřejné datové brány</p>
@ -132,14 +152,14 @@
<h2><a href="#"><img src="img/Ushahidi_mobile.png" alt="Ushahidi" title="Ushahidi">Ushahidi Mobile</a></h2> <h2><a href="#"><img src="img/Ushahidi_mobile.png" alt="Ushahidi" title="Ushahidi">Ushahidi Mobile</a></h2>
<p>Mobilní aplikace Ushahidi pro<br> <p>Mobilní aplikace Ushahidi pro<br>
<a href="https://itunes.apple.com/us/app/ushahidi-mobile/id1205994516?mt=8"><img src="img/ios.png" class="ico" alt="IOS">IOS 9.0 a vyšší</a><br> <a href="https://itunes.apple.com/us/app/ushahidi-mobile/id1205994516?mt=8"><img src="img/ios.png" class="ico" alt="IOS">IOS 9.0 a vyšší</a><br>
<a href="https://play.google.com/store/apps/details?id=com.ushahidi.mobile&amp;hl=cs"><img src="img/android.png" class="ico" alt="Android">Android 4.4 a vyšší</a> <a href="https://play.google.com/store/apps/details?id=com.ushahidi.mobile"><img src="img/android.png" class="ico" alt="Android">Android 4.4 a vyšší</a>
</p> </p>
</div> </div>
<div class="c" id="sms-sync-gateway"> <div class="c" id="sms-sync-gateway">
<h2><a href="#"><img src="img/SMS_Sync.png" alt="SMS Sync Gateway" title="SMS Sync Gateway">SMS Sync Gateway</a></h2> <h2><a href="#"><img src="img/SMS_Sync.png" alt="SMS Sync Gateway" title="SMS Sync Gateway">SMS Sync Gateway</a></h2>
<p>Mobilní aplikace pro<br> <p>Mobilní aplikace pro<br>
<a href="https://play.google.com/store/apps/details?id=org.addhen.smssync&amp;hl=cs"><img src="img/android.png" class="ico" alt="Android">Android 2.3 a vyšší</a> <a href="https://play.google.com/store/apps/details?id=org.addhen.smssync"><img src="img/android.png" class="ico" alt="Android">Android 2.3 a vyšší</a>
</p> </p>
</div> </div>
@ -155,7 +175,7 @@
<div class="c" id="kanboard-mobile"> <div class="c" id="kanboard-mobile">
<h2><a href="#"><img src="img/Kanboard.png" alt="Kanboard" title="Kanboard">Kanboard Mobile</a></h2> <h2><a href="#"><img src="img/Kanboard.png" alt="Kanboard" title="Kanboard">Kanboard Mobile</a></h2>
<p>Mobilní aplikace<br> <p>Mobilní aplikace<br>
<a href="https://play.google.com/store/apps/details?id=eu.it_quality.kanboard&amp;hl=cs"><img src="img/android.png" class="ico" alt="KanBoard">KanBoard client pro Android 4.1 a vyšší</a><br> <a href="https://play.google.com/store/apps/details?id=eu.it_quality.kanboard"><img src="img/android.png" class="ico" alt="KanBoard">KanBoard client pro Android 4.1 a vyšší</a><br>
<a href="https://f-droid.org/packages/in.andres.kandroid/"><img src="img/android.png" class="ico" alt="Android">Kandroid pro Android 4.2 a vyšší</a> <a href="https://f-droid.org/packages/in.andres.kandroid/"><img src="img/android.png" class="ico" alt="Android">Kandroid pro Android 4.2 a vyšší</a>
</p> </p>
</div> </div>

50
openmapkit.sh Executable file
View File

@ -0,0 +1,50 @@
#!/bin/bash
SOURCE_DIR=$(realpath $(dirname "${0}"))/openmapkit
# Add NodeJS repository
wget https://deb.nodesource.com/gpgkey/nodesource.gpg.key -O - | apt-key add -
echo 'deb https://deb.nodesource.com/node_8.x stretch main' > /etc/apt/sources.list.d/nodejs.list
apt-get -y update
# Install OpenMapKit dependencies
apt-get install --no-install-recommends -y build-essential nodejs python-dev python-virtualenv virtualenv
# Clone repositories
git clone --depth 1 https://github.com/AmericanRedCross/OpenMapKitServer /srv/omk
git -C /srv/omk submodule update --init
# Install OpenMapKit python virtual environment
virtualenv --no-site-packages --python=/usr/bin/python2.7 /srv/omk
/srv/omk/bin/pip install -r /srv/omk/requirements.txt
# Create OpenMapKit OS user
adduser --system --group --home /srv/omk --shell /bin/bash omk
chown -R omk:omk /srv/omk
# Install NodeJS dependencies
sudo -u omk -i npm install yarn
sudo -u omk -i npm install libxmljs
sudo -u omk -i /srv/omk/node_modules/yarn/bin/yarn
# Configure OpenMapKit
export OMK_ADMIN_USER="admin"
export OMK_ADMIN_PWD=$(head -c 12 /dev/urandom | base64)
envsubst <${SOURCE_DIR}/srv/omk/settings.js >/srv/omk/settings.js
# 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
# 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
# Restart services
systemctl restart nginx
# Add portal application definition
portal-app-manager openmapkit "https://{host}:8007/" admin "${OMK_ADMIN_PWD}"
portal-app-manager openmapkit-clients -p clienturl "http://{host}:8096"

View File

@ -0,0 +1,14 @@
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

@ -0,0 +1,15 @@
[Unit]
Description=OpenMapKit Server
After=network.target
[Service]
Type=simple
User=omk
Environment=NODE_ENV=production
Environment=VIRTUAL_ENV=/srv/omk
Environment=PATH=/srv/omk/bin:/usr/local/bin:/usr/bin:/bin
WorkingDirectory=/srv/omk
ExecStart=/usr/bin/node server.js
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,20 @@
module.exports = {
name: 'OpenMapKit Server',
description: 'OpenMapKit Server is the lightweight server component of OpenMapKit that handles the collection and aggregation of OpenStreetMap and OpenDataKit data.',
port: 8096,
dataDir: __dirname + '/data',
pagesDir: __dirname + '/pages',
hostUrl: 'http://posm.io',
osmApi: {
server: 'http://osm.posm.io',
user: 'POSM',
pass: ''
},
// To do simple authentication, you can have an object like so:
auth: {
user: '${OMK_ADMIN_USER}',
pass: '${OMK_ADMIN_PWD}'
}
};