Revert long naming for OpenDataKit Build
This commit is contained in:
parent
e02745c89c
commit
53b470118d
23
odkbuild.sh
23
odkbuild.sh
@ -1,23 +0,0 @@
|
||||
#!/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
|
||||
service postgres start
|
||||
|
||||
# Build Docker container
|
||||
docker build -t odkbuild ${SOURCE_DIR}
|
||||
cp ${SOURCE_DIR}/etc/init.d/odkbuild /etc/init.d/odkbuild
|
||||
rc-update -u
|
||||
|
||||
# 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
|
@ -1,4 +0,0 @@
|
||||
CREATE ROLE odkbuild NOSUPERUSER NOCREATEDB NOCREATEROLE NOINHERIT LOGIN ENCRYPTED PASSWORD '${ODKBUILD_PWD}';
|
||||
CREATE DATABASE odkbuild;
|
||||
REVOKE ALL ON DATABASE odkbuild FROM public;
|
||||
ALTER DATABASE odkbuild OWNER TO odkbuild;
|
@ -1,28 +0,0 @@
|
||||
#!/sbin/openrc-run
|
||||
|
||||
description="OpenDataKit Build docker container"
|
||||
|
||||
depend() {
|
||||
need docker postgres
|
||||
}
|
||||
|
||||
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/bin/spotter-appmgr register-proxy odkbuild
|
||||
}
|
||||
|
||||
stop_pre() {
|
||||
/usr/bin/spotter-appmgr unregister-proxy odkbuild
|
||||
}
|
||||
|
||||
stop() {
|
||||
/usr/bin/docker stop odkbuild
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
development:
|
||||
cookie_secret: ${ODKBUILD_COOKIE_SECRET}
|
||||
cookie_ssl_only: false
|
||||
database:
|
||||
host: postgres
|
||||
database: odkbuild
|
||||
user: odkbuild
|
||||
password: ${ODKBUILD_PWD}
|
23
opendatakit-build.sh
Executable file
23
opendatakit-build.sh
Executable file
@ -0,0 +1,23 @@
|
||||
#!/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
|
||||
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
|
||||
|
||||
# Create databases
|
||||
export OPENDATAKITBUILD_PWD=$(head -c 18 /dev/urandom | base64)
|
||||
envsubst <${SOURCE_DIR}/createdb.sql | docker exec -i 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
|
@ -20,18 +20,18 @@ RUN \
|
||||
&& paxctl -cm /usr/lib/jvm/java-1.8-openjdk/jre/bin/java \
|
||||
&& paxctl -cm /usr/lib/jvm/java-1.8-openjdk/bin/java \
|
||||
# Clone ODK Build
|
||||
&& git clone --depth 1 https://github.com/opendatakit/build /srv/odkbuild \
|
||||
&& git clone --depth 1 https://github.com/opendatakit/build /srv/opendatakit-build \
|
||||
# Install Ruby dependencies
|
||||
&& cd /srv/odkbuild \
|
||||
&& cd /srv/opendatakit-build \
|
||||
&& bundle install --without test \
|
||||
&& rake deploy:build \
|
||||
# Create OS user
|
||||
&& addgroup -S -g 8017 odkbuild \
|
||||
&& adduser -S -u 8017 -h /srv/odkbuild -s /bin/false -g odkbuild -G odkbuild odkbuild \
|
||||
&& chown -R odkbuild:odkbuild /srv/odkbuild \
|
||||
&& adduser -S -u 8017 -h /srv/opendatakit-build -s /bin/false -g odkbuild -G odkbuild odkbuild \
|
||||
&& chown -R odkbuild:odkbuild /srv/opendatakit-build \
|
||||
# Cleanup
|
||||
&& apk --no-cache del .deps \
|
||||
&& find /srv/odkbuild -name '.git*' -exec rm -rf {} + \
|
||||
&& find /srv/opendatakit-build -name '.git*' -exec rm -rf {} + \
|
||||
&& rm -rf /root/.bundle
|
||||
|
||||
RUN \
|
4
opendatakit-build/createdb.sql
Normal file
4
opendatakit-build/createdb.sql
Normal file
@ -0,0 +1,4 @@
|
||||
CREATE ROLE opendatakitbuild NOSUPERUSER NOCREATEDB NOCREATEROLE NOINHERIT LOGIN ENCRYPTED PASSWORD '${OPENDATAKITBUILD_PWD}';
|
||||
CREATE DATABASE opendatakitbuild;
|
||||
REVOKE ALL ON DATABASE opendatakitbuild FROM public;
|
||||
ALTER DATABASE opendatakitbuild OWNER TO opendatakitbuild;
|
@ -1,6 +1,6 @@
|
||||
#!/bin/execlineb -P
|
||||
|
||||
cd /srv/odkbuild
|
||||
cd /srv/opendatakit-build
|
||||
fdmove -c 2 1
|
||||
s6-setuidgid 8017:8017
|
||||
bundle exec rackup config.ru -o 0.0.0.0 -p 8080
|
28
opendatakit-build/etc/init.d/opendatakit-build
Executable file
28
opendatakit-build/etc/init.d/opendatakit-build
Executable file
@ -0,0 +1,28 @@
|
||||
#!/sbin/openrc-run
|
||||
|
||||
description="OpenDataKit Build docker container"
|
||||
|
||||
depend() {
|
||||
need docker postgres
|
||||
}
|
||||
|
||||
start() {
|
||||
/usr/bin/docker run -d --rm \
|
||||
--name opendatakit-build \
|
||||
-h opendatakit-build \
|
||||
--link postgres \
|
||||
-v /srv/opendatakit-build/conf/config.yml:/srv/opendatakit-build/config.yml \
|
||||
opendatakit-build
|
||||
}
|
||||
|
||||
start_post() {
|
||||
/usr/bin/spotter-appmgr register-proxy opendatakit-build
|
||||
}
|
||||
|
||||
stop_pre() {
|
||||
/usr/bin/spotter-appmgr unregister-proxy opendatakit-build
|
||||
}
|
||||
|
||||
stop() {
|
||||
/usr/bin/docker stop opendatakit-build
|
||||
}
|
8
opendatakit-build/srv/opendatakit-build/conf/config.yml
Normal file
8
opendatakit-build/srv/opendatakit-build/conf/config.yml
Normal file
@ -0,0 +1,8 @@
|
||||
development:
|
||||
cookie_secret: ${OPENDATAKITBUILD_COOKIE_SECRET}
|
||||
cookie_ssl_only: false
|
||||
database:
|
||||
host: postgres
|
||||
database: opendatakitbuild
|
||||
user: opendatakitbuild
|
||||
password: ${OPENDATAKITBUILD_PWD}
|
Loading…
Reference in New Issue
Block a user