LXCize ODK Build setup
This commit is contained in:
parent
57ecc71ebe
commit
44546c4816
@ -1,26 +1,24 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
SOURCE_DIR=$(realpath $(dirname "${0}"))/opendatakit-build
|
||||
SOURCE_DIR=$(realpath $(dirname "${0}"))/setup
|
||||
|
||||
# Check prerequisites
|
||||
lxc-ls | grep -q postgres || $(realpath $(dirname "${0}"))/postgres.sh
|
||||
service postgres start
|
||||
|
||||
# Build Docker container
|
||||
docker build -t opendatakit-build ${SOURCE_DIR}
|
||||
cp ${SOURCE_DIR}/etc/init.d/opendatakit-build /etc/init.d/opendatakit-build
|
||||
rc-update -u
|
||||
[ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1
|
||||
|
||||
# Create databases
|
||||
export OPENDATAKITBUILD_PWD=$(head -c 18 /dev/urandom | base64)
|
||||
envsubst <${SOURCE_DIR}/createdb.sql | docker exec -i postgres psql
|
||||
envsubst <${SOURCE_DIR}/createdb.sql | lxc-attach -u 5432 -g 5432 postgres psql
|
||||
|
||||
# Configure OpenDataKit Build
|
||||
export OPENDATAKITBUILD_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/opendatakit-build/config.yml -w /srv/opendatakit-build opendatakit-build rake db:migrate
|
||||
lxc-execute opendatakit-build -- sh -c 'cd /srv/opendatakit-build; rake db:migrate'
|
||||
|
||||
# Install service
|
||||
cp ${SOURCE_DIR}/etc/init.d/opendatakit-build /etc/init.d/opendatakit-build
|
||||
rc-update -u
|
||||
|
||||
# Stop services required for build
|
||||
service postgres stop
|
||||
[ ! -z ${STOP_POSTGRES} ] && service postgres stop
|
||||
|
@ -1,19 +1,13 @@
|
||||
#!/sbin/openrc-run
|
||||
|
||||
description="OpenDataKit Build docker container"
|
||||
description="OpenDataKit Build container"
|
||||
|
||||
depend() {
|
||||
need docker postgres
|
||||
need cgroups postgres
|
||||
}
|
||||
|
||||
start() {
|
||||
/usr/bin/docker run -d --rm \
|
||||
--name opendatakit-build \
|
||||
-h opendatakit-build \
|
||||
--link postgres \
|
||||
-v /etc/ssl/services.pem:/usr/local/share/ca-certificates/services.crt \
|
||||
-v /srv/opendatakit-build/conf/config.yml:/srv/opendatakit-build/config.yml \
|
||||
opendatakit-build
|
||||
lxc-start opendatakit-build
|
||||
}
|
||||
|
||||
start_post() {
|
||||
@ -25,5 +19,5 @@ stop_pre() {
|
||||
}
|
||||
|
||||
stop() {
|
||||
/usr/bin/docker stop opendatakit-build
|
||||
lxc-stop opendatakit-build
|
||||
}
|
||||
|
@ -19,8 +19,8 @@ ${SOURCE_DIR}/cts/setup.sh
|
||||
${SOURCE_DIR}/frontlinesms/setup.sh
|
||||
${SOURCE_DIR}/gnuhealth/setup.sh
|
||||
${SOURCE_DIR}/kanboard/setup.sh
|
||||
#${SOURCE_DIR}/opendatakit/setup.sh
|
||||
#${SOURCE_DIR}/opendatakit-build/setup.sh
|
||||
${SOURCE_DIR}/opendatakit/setup.sh
|
||||
${SOURCE_DIR}/opendatakit-build/setup.sh
|
||||
#${SOURCE_DIR}/openmapkit/setup.sh
|
||||
#${SOURCE_DIR}/pandora/setup.sh
|
||||
#${SOURCE_DIR}/sahana/setup.sh
|
||||
|
Loading…
Reference in New Issue
Block a user