Revert long naming for OpenDataKit
This commit is contained in:
parent
9164ea8111
commit
e02745c89c
@ -17,8 +17,8 @@ ${SOURCE_DIR}/gnuhealth.sh
|
||||
${SOURCE_DIR}/kanboard.sh
|
||||
${SOURCE_DIR}/mifosx.sh
|
||||
${SOURCE_DIR}/motech.sh
|
||||
${SOURCE_DIR}/odkbuild.sh
|
||||
${SOURCE_DIR}/odk.sh
|
||||
${SOURCE_DIR}/opendatakit-build.sh
|
||||
${SOURCE_DIR}/opendatakit.sh
|
||||
${SOURCE_DIR}/omk.sh
|
||||
${SOURCE_DIR}/pandora.sh
|
||||
${SOURCE_DIR}/sahana.sh
|
||||
|
42
odk.sh
42
odk.sh
@ -1,42 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
SOURCE_DIR=$(realpath $(dirname "${0}"))/odk
|
||||
|
||||
# Check prerequisites
|
||||
docker image ls | grep -q postgres || $(realpath $(dirname "${0}"))/postgres.sh
|
||||
docker image ls | grep -q postfix || $(realpath $(dirname "${0}"))/postfix.sh
|
||||
docker image ls | grep -q tomcat || $(realpath $(dirname "${0}"))/tomcat.sh
|
||||
service postgres start
|
||||
|
||||
# Build Docker container
|
||||
docker build -t odk ${SOURCE_DIR}
|
||||
cp ${SOURCE_DIR}/etc/init.d/odk /etc/init.d/odk
|
||||
rc-update -u
|
||||
|
||||
# Create databases
|
||||
export ODK_PWD=$(head -c 18 /dev/urandom | base64)
|
||||
envsubst <${SOURCE_DIR}/createdb.sql | docker exec -i postgres psql
|
||||
|
||||
# Configure OpenDataKit
|
||||
export ODK_ADMIN_USER=admin
|
||||
export ODK_ADMIN_REALM=spotter
|
||||
mkdir -p /srv/odk/conf
|
||||
envsubst <${SOURCE_DIR}/srv/odk/conf/jdbc.properties >/srv/odk/conf/jdbc.properties
|
||||
envsubst <${SOURCE_DIR}/srv/odk/conf/security.properties >/srv/odk/conf/security.properties
|
||||
cp ${SOURCE_DIR}/srv/odk/conf/server.xml /srv/odk/conf/server.xml
|
||||
cp ${SOURCE_DIR}/srv/odk/update-url.sh /srv/odk/update-url.sh
|
||||
chown -R 8015:8015 /srv/odk/conf
|
||||
|
||||
# Populate database
|
||||
service odk start
|
||||
until docker logs odk 2>&1 | grep -q 'org.apache.catalina.startup.Catalina.start'; do
|
||||
sleep 1
|
||||
done
|
||||
|
||||
# Update admin account
|
||||
export ODK_ADMIN_PWD=$(head -c 12 /dev/urandom | base64)
|
||||
export ODK_ADMIN_SALT=$(head -c 4 /dev/urandom | hexdump -e '"%x"') # Must be 8 characters
|
||||
export ODK_ADMIN_BASIC_HASH=$(echo -n "${ODK_ADMIN_PWD}{${ODK_ADMIN_SALT}}" | sha1sum | tr -d " -")
|
||||
export ODK_ADMIN_DIGEST_HASH=$(echo -n "${ODK_ADMIN_USER}:${ODK_ADMIN_REALM}:${ODK_ADMIN_PWD}" | md5sum | tr -d " -")
|
||||
envsubst <${SOURCE_DIR}/adminpwd.sql | docker exec -i postgres psql odk
|
||||
spotter-appmgr update-login odk "${ODK_ADMIN_USER}" "${ODK_ADMIN_PWD}"
|
@ -1 +0,0 @@
|
||||
UPDATE _registered_users SET "BASIC_AUTH_PASSWORD" = '${ODK_ADMIN_BASIC_HASH}', "BASIC_AUTH_SALT" = '${ODK_ADMIN_SALT}', "DIGEST_AUTH_PASSWORD" = '${ODK_ADMIN_DIGEST_HASH}' WHERE "LOCAL_USERNAME" = '${ODK_ADMIN_USER}';
|
@ -1,4 +0,0 @@
|
||||
CREATE ROLE odk NOSUPERUSER NOCREATEDB NOCREATEROLE NOINHERIT LOGIN ENCRYPTED PASSWORD '${ODK_PWD}';
|
||||
CREATE DATABASE odk;
|
||||
REVOKE ALL ON DATABASE odk FROM public;
|
||||
ALTER DATABASE odk OWNER TO odk;
|
@ -1,31 +0,0 @@
|
||||
#!/sbin/openrc-run
|
||||
|
||||
description="OpenDataKit Aggregate docker container"
|
||||
|
||||
depend() {
|
||||
need docker postfix postgres
|
||||
}
|
||||
|
||||
start() {
|
||||
/usr/bin/docker run -d --rm \
|
||||
--name odk \
|
||||
-h odk \
|
||||
--link postfix \
|
||||
--link postgres \
|
||||
-v /srv/odk/conf/server.xml:/srv/tomcat/conf/server.xml \
|
||||
-v /srv/odk/conf/jdbc.properties:/srv/tomcat/webapps/aggregate/WEB-INF/classes/jdbc.properties \
|
||||
-v /srv/odk/conf/security.properties:/srv/tomcat/webapps/aggregate/WEB-INF/classes/security.properties \
|
||||
odk
|
||||
}
|
||||
|
||||
start_post() {
|
||||
/usr/bin/spotter-appmgr register-proxy odk
|
||||
}
|
||||
|
||||
stop_pre() {
|
||||
/usr/bin/spotter-appmgr unregister-proxy odk
|
||||
}
|
||||
|
||||
stop() {
|
||||
/usr/bin/docker stop odk
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
jdbc.driverClassName=org.postgresql.Driver
|
||||
jdbc.resourceName=jdbc/odk_aggregate
|
||||
jdbc.url=jdbc:postgresql://postgres/odk?autoDeserialize=true
|
||||
jdbc.username=odk
|
||||
jdbc.password=${ODK_PWD}
|
||||
jdbc.schema=public
|
@ -1,5 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
sed -i "s|\(^\s\+proxyName\).*|\1=\"${1}\"|g" /srv/odk/conf/server.xml
|
||||
sed -i "s|\(^\s\+proxyPort\).*|\1=\"${2}\"|g" /srv/odk/conf/server.xml
|
||||
sed -i "s|^security\.server\.securePort.*|security.server.securePort=${2}|" /srv/odk/conf/security.properties
|
42
opendatakit.sh
Executable file
42
opendatakit.sh
Executable file
@ -0,0 +1,42 @@
|
||||
#!/bin/sh
|
||||
|
||||
SOURCE_DIR=$(realpath $(dirname "${0}"))/opendatakit
|
||||
|
||||
# Check prerequisites
|
||||
docker image ls | grep -q postgres || $(realpath $(dirname "${0}"))/postgres.sh
|
||||
docker image ls | grep -q postfix || $(realpath $(dirname "${0}"))/postfix.sh
|
||||
docker image ls | grep -q tomcat || $(realpath $(dirname "${0}"))/tomcat.sh
|
||||
service postgres start
|
||||
|
||||
# Build Docker container
|
||||
docker build -t opendatakit ${SOURCE_DIR}
|
||||
cp ${SOURCE_DIR}/etc/init.d/opendatakit /etc/init.d/opendatakit
|
||||
rc-update -u
|
||||
|
||||
# Create databases
|
||||
export OPENDATAKIT_PWD=$(head -c 18 /dev/urandom | base64)
|
||||
envsubst <${SOURCE_DIR}/createdb.sql | docker exec -i postgres psql
|
||||
|
||||
# Configure OpenDataKit
|
||||
export OPENDATAKIT_ADMIN_USER=admin
|
||||
export OPENDATAKIT_ADMIN_REALM=spotter
|
||||
mkdir -p /srv/opendatakit/conf
|
||||
envsubst <${SOURCE_DIR}/srv/opendatakit/conf/jdbc.properties >/srv/opendatakit/conf/jdbc.properties
|
||||
envsubst <${SOURCE_DIR}/srv/opendatakit/conf/security.properties >/srv/opendatakit/conf/security.properties
|
||||
cp ${SOURCE_DIR}/srv/opendatakit/conf/server.xml /srv/opendatakit/conf/server.xml
|
||||
cp ${SOURCE_DIR}/srv/opendatakit/update-url.sh /srv/opendatakit/update-url.sh
|
||||
chown -R 8015:8015 /srv/opendatakit/conf
|
||||
|
||||
# Populate database
|
||||
service opendatakit start
|
||||
until docker logs opendatakit 2>&1 | grep -q 'org.apache.catalina.startup.Catalina.start'; do
|
||||
sleep 1
|
||||
done
|
||||
|
||||
# Update admin account
|
||||
export OPENDATAKIT_ADMIN_PWD=$(head -c 12 /dev/urandom | base64)
|
||||
export OPENDATAKIT_ADMIN_SALT=$(head -c 4 /dev/urandom | hexdump -e '"%x"') # Must be 8 characters
|
||||
export OPENDATAKIT_ADMIN_BASIC_HASH=$(echo -n "${OPENDATAKIT_ADMIN_PWD}{${OPENDATAKIT_ADMIN_SALT}}" | sha1sum | tr -d " -")
|
||||
export OPENDATAKIT_ADMIN_DIGEST_HASH=$(echo -n "${OPENDATAKIT_ADMIN_USER}:${OPENDATAKIT_ADMIN_REALM}:${OPENDATAKIT_ADMIN_PWD}" | md5sum | tr -d " -")
|
||||
envsubst <${SOURCE_DIR}/adminpwd.sql | docker exec -i postgres psql opendatakit
|
||||
spotter-appmgr update-login opendatakit "${OPENDATAKIT_ADMIN_USER}" "${OPENDATAKIT_ADMIN_PWD}"
|
@ -5,9 +5,9 @@ RUN \
|
||||
# Install build dependencies
|
||||
apk --no-cache add --virtual .deps git git-lfs openjdk8 \
|
||||
# Clone ODK aggregate
|
||||
&& git clone --depth 1 https://github.com/opendatakit/aggregate.git /srv/odk \
|
||||
&& git clone --depth 1 https://github.com/opendatakit/aggregate.git /srv/opendatakit \
|
||||
# Compile Java web archive
|
||||
&& cd /srv/odk \
|
||||
&& cd /srv/opendatakit \
|
||||
&& cp gradle.properties.example gradle.properties \
|
||||
&& ./gradlew war \
|
||||
# Deploy web archive
|
||||
@ -19,7 +19,7 @@ RUN \
|
||||
&& chown -R odk:odk /srv/tomcat/conf /srv/tomcat/logs /srv/tomcat/temp /srv/tomcat/webapps /srv/tomcat/work \
|
||||
# Cleanup
|
||||
&& apk --no-cache del .deps \
|
||||
&& rm -rf /root/.gradle /root/.java /srv/odk
|
||||
&& rm -rf /root/.gradle /root/.java /srv/opendatakit
|
||||
|
||||
EXPOSE 8080
|
||||
|
1
opendatakit/adminpwd.sql
Normal file
1
opendatakit/adminpwd.sql
Normal file
@ -0,0 +1 @@
|
||||
UPDATE _registered_users SET "BASIC_AUTH_PASSWORD" = '${OPENDATAKIT_ADMIN_BASIC_HASH}', "BASIC_AUTH_SALT" = '${OPENDATAKIT_ADMIN_SALT}', "DIGEST_AUTH_PASSWORD" = '${OPENDATAKIT_ADMIN_DIGEST_HASH}' WHERE "LOCAL_USERNAME" = '${OPENDATAKIT_ADMIN_USER}';
|
4
opendatakit/createdb.sql
Normal file
4
opendatakit/createdb.sql
Normal file
@ -0,0 +1,4 @@
|
||||
CREATE ROLE opendatakit NOSUPERUSER NOCREATEDB NOCREATEROLE NOINHERIT LOGIN ENCRYPTED PASSWORD '${OPENDATAKIT_PWD}';
|
||||
CREATE DATABASE opendatakit;
|
||||
REVOKE ALL ON DATABASE opendatakit FROM public;
|
||||
ALTER DATABASE opendatakit OWNER TO opendatakit;
|
31
opendatakit/etc/init.d/opendatakit
Executable file
31
opendatakit/etc/init.d/opendatakit
Executable file
@ -0,0 +1,31 @@
|
||||
#!/sbin/openrc-run
|
||||
|
||||
description="OpenDataKit Aggregate docker container"
|
||||
|
||||
depend() {
|
||||
need docker postfix postgres
|
||||
}
|
||||
|
||||
start() {
|
||||
/usr/bin/docker run -d --rm \
|
||||
--name opendatakit \
|
||||
-h opendatakit \
|
||||
--link postfix \
|
||||
--link postgres \
|
||||
-v /srv/opendatakit/conf/server.xml:/srv/tomcat/conf/server.xml \
|
||||
-v /srv/opendatakit/conf/jdbc.properties:/srv/tomcat/webapps/aggregate/WEB-INF/classes/jdbc.properties \
|
||||
-v /srv/opendatakit/conf/security.properties:/srv/tomcat/webapps/aggregate/WEB-INF/classes/security.properties \
|
||||
opendatakit
|
||||
}
|
||||
|
||||
start_post() {
|
||||
/usr/bin/spotter-appmgr register-proxy opendatakit
|
||||
}
|
||||
|
||||
stop_pre() {
|
||||
/usr/bin/spotter-appmgr unregister-proxy opendatakit
|
||||
}
|
||||
|
||||
stop() {
|
||||
/usr/bin/docker stop opendatakit
|
||||
}
|
6
opendatakit/srv/opendatakit/conf/jdbc.properties
Normal file
6
opendatakit/srv/opendatakit/conf/jdbc.properties
Normal file
@ -0,0 +1,6 @@
|
||||
jdbc.driverClassName=org.postgresql.Driver
|
||||
jdbc.resourceName=jdbc/odk_aggregate
|
||||
jdbc.url=jdbc:postgresql://postgres/opendatakit?autoDeserialize=true
|
||||
jdbc.username=opendatakit
|
||||
jdbc.password=${OPENDATAKIT_PWD}
|
||||
jdbc.schema=public
|
@ -36,10 +36,10 @@ wink.handlersFactoryClass=org.opendatakit.aggregate.odktables.impl.api.wink.AppE
|
||||
# this should be of the form: 'mailto:user@gmail.com'
|
||||
security.server.superUser=
|
||||
|
||||
# Define a superUserUsername to insert an ODK Aggregate username that can
|
||||
# Define a superUserUsername to insert an OPENDATAKIT Aggregate username that can
|
||||
# access the server. The initial password for this username is 'aggregate'
|
||||
security.server.superUserUsername=${ODK_ADMIN_USER}
|
||||
security.server.superUserUsername=${OPENDATAKIT_ADMIN_USER}
|
||||
|
||||
# realm definition
|
||||
# realmString -- what should be sent to users when BasicAuth or DigestAuth is done
|
||||
security.server.realm.realmString=${ODK_ADMIN_REALM}
|
||||
security.server.realm.realmString=${OPENDATAKIT_ADMIN_REALM}
|
5
opendatakit/srv/opendatakit/update-url.sh
Executable file
5
opendatakit/srv/opendatakit/update-url.sh
Executable file
@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
sed -i "s|\(^\s\+proxyName\).*|\1=\"${1}\"|g" /srv/opendatakit/conf/server.xml
|
||||
sed -i "s|\(^\s\+proxyPort\).*|\1=\"${2}\"|g" /srv/opendatakit/conf/server.xml
|
||||
sed -i "s|^security\.server\.securePort.*|security.server.securePort=${2}|" /srv/opendatakit/conf/security.properties
|
Loading…
Reference in New Issue
Block a user