Unify ODK Aggregate naming and nginx configuration for spotter-appmgr

This commit is contained in:
Disassembler 2018-03-25 23:14:56 +02:00
parent 551e2a2938
commit 2edd4e19f8
Signed by: Disassembler
GPG Key ID: 524BD33A0EE29499
8 changed files with 18 additions and 49 deletions

View File

@ -21,7 +21,7 @@ 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-ip.sh /srv/opendatakit/update-ip.sh
cp ${SOURCE_DIR}/srv/opendatakit/update-url.sh /srv/opendatakit/update-url.sh
chown -R 8015:8015 /srv/opendatakit/conf
# Create OpenDataKit service
@ -39,10 +39,6 @@ until docker logs opendatakit 2>&1 | grep -q 'org.apache.catalina.startup.Catali
done
envsubst <${SOURCE_DIR}/adminpwd.sql | docker exec -i postgres psql opendatakit
# Create nginx app definition
cp ${SOURCE_DIR}/etc/nginx/conf.d/opendatakit.conf /etc/nginx/conf.d/opendatakit.conf
service nginx reload
# Add portal application definition
portal-app-manager opendatakit "https://{host}:8415/aggregate/" "${OPENDATAKIT_ADMIN_USER}" "${OPENDATAKIT_ADMIN_PWD}"
portal-app-manager opendatakit-clients -p clienturl "http://{host}:8815/aggregate"
# Add application definition
spotter-appmgr add-app opendatakit "https://opendatakit.{host}/aggregate/" "${OPENDATAKIT_ADMIN_USER}" "${OPENDATAKIT_ADMIN_PWD}"
spotter-appmgr add-app opendatakit-clients -p clienturl "https://opendatakit.{host}/aggregate"

View File

@ -21,7 +21,7 @@ RUN \
&& apk --no-cache del .deps \
&& rm -rf /root/.gradle /root/.java /srv/odk
EXPOSE 8015 8016
EXPOSE 8080
USER odk
WORKDIR /srv/tomcat

View File

@ -7,24 +7,22 @@ depend() {
use dns logger netmount postfix
}
start_pre() {
/srv/opendatakit/update-ip.sh
}
start() {
/usr/bin/docker run -d --rm \
--name opendatakit \
-h opendatakit \
--link postfix \
--link postgres \
-p 127.0.0.1:8015:8015 \
-p 127.0.0.1:8016:8016 \
-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/local/bin/spotter-appmgr update-hosts opendatakit
}
stop() {
/usr/bin/docker stop opendatakit
}

View File

@ -1,21 +0,0 @@
server {
listen [::]:8815 ipv6only=off;
access_log /var/log/nginx/opendatakit.access.log;
error_log /var/log/nginx/opendatakit.error.log;
location / {
proxy_pass http://127.0.0.1:8015;
}
}
server {
listen [::]:8415 ssl http2 ipv6only=off;
access_log /var/log/nginx/opendatakit.access.log;
error_log /var/log/nginx/opendatakit.error.log;
location / {
proxy_pass http://127.0.0.1:8016;
}
}

View File

@ -26,8 +26,8 @@ security.server.channelType=ANY_CHANNEL
#
# This is configured during install. If blank, discovers an IP address
security.server.hostname=
security.server.port=8815
security.server.securePort=8415
security.server.port=80
security.server.securePort=443
wink.handlersFactoryClass=org.opendatakit.aggregate.odktables.impl.api.wink.AppEngineHandlersFactory

View File

@ -66,15 +66,10 @@
APR (HTTP/AJP) Connector: /docs/apr.html
Define a non-SSL/TLS HTTP/1.1 Connector on port 8080
-->
<Connector port="8015" protocol="HTTP/1.1"
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
proxyName="127.0.0.1"
proxyPort="8815"
redirectPort="8443" />
<Connector port="8016" protocol="HTTP/1.1"
connectionTimeout="20000"
proxyName="127.0.0.1"
proxyPort="8415"
proxyPort="443"
scheme="https" secure="true"
redirectPort="8443" />
<!-- A "Connector" using the shared thread pool-->

View File

@ -1,4 +0,0 @@
#!/bin/sh
URL=$(ip route get 1 | awk '{print $NF;exit}')
sed -i "s|\(^\s\+proxyName\).*|\1=\"${URL}\"|g" /srv/opendatakit/conf/server.xml

View 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