Shorten ODK Build handle

This commit is contained in:
Disassembler 2018-03-25 14:21:11 +02:00
parent d1a7c4922b
commit 0d8a9634e3
No known key found for this signature in database
GPG Key ID: 524BD33A0EE29499
12 changed files with 55 additions and 55 deletions

View File

@ -16,7 +16,7 @@ ${SOURCE_DIR}/gnuhealth.sh
${SOURCE_DIR}/kanboard.sh
${SOURCE_DIR}/mifosx.sh
${SOURCE_DIR}/motech.sh
${SOURCE_DIR}/opendatakit-build.sh
${SOURCE_DIR}/odkbuild.sh
${SOURCE_DIR}/opendatakit.sh
${SOURCE_DIR}/openmapkit.sh
${SOURCE_DIR}/pandora.sh

View File

@ -74,7 +74,7 @@
</ul>
</div>
<div class="c" id="opendatakit-build">
<div class="c" id="odkbuild">
<h2><a href="#"><img src="img/ODK.png" alt="Open Data Kit" title="Open Data Kit">ODK Build</a></h2>
<p><strong>Sběr dat s pomocí smartphone</strong>.<br>Aplikace pro návrh formulářů<br>
<a href="http://opendatakit.org/xiframe/">XLSForm</a> - online konverter XLS.

28
odkbuild.sh Executable file
View File

@ -0,0 +1,28 @@
#!/bin/sh
SOURCE_DIR=$(realpath $(dirname "${0}"))/odkbuild
# Check prerequisites
docker image ls | grep -q postgres || $(realpath $(dirname "${0}"))/postgres.sh
docker image ls | grep -q ruby || $(realpath $(dirname "${0}"))/ruby.sh
# Build Docker container
docker build -t odkbuild ${SOURCE_DIR}
# Create databases
export ODKBUILD_PWD=$(head -c 18 /dev/urandom | base64)
envsubst <${SOURCE_DIR}/createdb.sql | docker exec -i postgres psql
# Configure OpenDataKit Build
export ODKBUILD_COOKIE_SECRET=$(head -c 8 /dev/urandom | hexdump -e '"%x"')
mkdir -p /srv/odkbuild/conf
envsubst <${SOURCE_DIR}/srv/odkbuild/conf/config.yml >/srv/odkbuild/conf/config.yml
docker run --rm -h odkbuild --link postgres -v /srv/odkbuild/conf/config.yml:/srv/odkbuild/config.yml -w /srv/odkbuild odkbuild rake db:migrate
# Create OpenDataKit service
cp ${SOURCE_DIR}/etc/init.d/odkbuild /etc/init.d/odkbuild
rc-update add odkbuild
service odkbuild start
# Add application definition
spotter-appmgr add-app odkbuild "https://odkbuild.{host}/"

25
odkbuild/etc/init.d/odkbuild Executable file
View File

@ -0,0 +1,25 @@
#!/sbin/openrc-run
description="OpenDataKit Build docker container"
depend() {
need docker net postgres
use dns logger netmount
}
start() {
/usr/bin/docker run -d --rm \
--name odkbuild \
-h odkbuild \
--link postgres \
-v /srv/odkbuild/conf/config.yml:/srv/odkbuild/config.yml \
odkbuild
}
start_post() {
/usr/local/bin/spotter-appmgr update-hosts odkbuild
}
stop() {
/usr/bin/docker stop odkbuild
}

View File

@ -1,28 +0,0 @@
#!/bin/sh
SOURCE_DIR=$(realpath $(dirname "${0}"))/opendatakit-build
# Check prerequisites
docker image ls | grep -q postgres || $(realpath $(dirname "${0}"))/postgres.sh
docker image ls | grep -q ruby || $(realpath $(dirname "${0}"))/ruby.sh
# Build Docker container
docker build -t opendatakit-build ${SOURCE_DIR}
# Create databases
export ODKBUILD_PWD=$(head -c 18 /dev/urandom | base64)
envsubst <${SOURCE_DIR}/createdb.sql | docker exec -i postgres psql
# Configure OpenDataKit Build
export ODKBUILD_COOKIE_SECRET=$(head -c 8 /dev/urandom | hexdump -e '"%x"')
mkdir -p /srv/opendatakit-build/conf
envsubst <${SOURCE_DIR}/srv/opendatakit-build/conf/config.yml >/srv/opendatakit-build/conf/config.yml
docker run --rm -h opendatakit-build --link postgres -v /srv/opendatakit-build/conf/config.yml:/srv/odkbuild/config.yml -w /srv/odkbuild opendatakit-build rake db:migrate
# Create OpenDataKit service
cp ${SOURCE_DIR}/etc/init.d/opendatakit-build /etc/init.d/opendatakit-build
rc-update add opendatakit-build
service opendatakit-build start
# Add application definition
spotter-appmgr add-app opendatakit-build "https://opendatakit-build.{host}/"

View File

@ -1,25 +0,0 @@
#!/sbin/openrc-run
description="OpenDataKit Build docker container"
depend() {
need docker net postgres
use dns logger netmount
}
start() {
/usr/bin/docker run -d --rm \
--name opendatakit-build \
-h opendatakit-build \
--link postgres \
-v /srv/opendatakit-build/conf/config.yml:/srv/odkbuild/config.yml \
opendatakit-build
}
start_post() {
/usr/local/bin/spotter-appmgr update-hosts opendatakit-build
}
stop() {
/usr/bin/docker stop opendatakit-build
}