diff --git a/opendatakit.sh b/opendatakit.sh index d9ce270..cb375be 100755 --- a/opendatakit.sh +++ b/opendatakit.sh @@ -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" diff --git a/opendatakit/Dockerfile b/opendatakit/Dockerfile index 5723f28..3d1e166 100644 --- a/opendatakit/Dockerfile +++ b/opendatakit/Dockerfile @@ -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 diff --git a/opendatakit/etc/init.d/opendatakit b/opendatakit/etc/init.d/opendatakit index 16cfc51..fa33ca6 100755 --- a/opendatakit/etc/init.d/opendatakit +++ b/opendatakit/etc/init.d/opendatakit @@ -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 } diff --git a/opendatakit/etc/nginx/conf.d/opendatakit.conf b/opendatakit/etc/nginx/conf.d/opendatakit.conf deleted file mode 100644 index a6d0f32..0000000 --- a/opendatakit/etc/nginx/conf.d/opendatakit.conf +++ /dev/null @@ -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; - } -} diff --git a/opendatakit/srv/opendatakit/conf/security.properties b/opendatakit/srv/opendatakit/conf/security.properties index fd21061..948da2f 100644 --- a/opendatakit/srv/opendatakit/conf/security.properties +++ b/opendatakit/srv/opendatakit/conf/security.properties @@ -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 diff --git a/opendatakit/srv/opendatakit/conf/server.xml b/opendatakit/srv/opendatakit/conf/server.xml index a6eca42..2d8e62a 100644 --- a/opendatakit/srv/opendatakit/conf/server.xml +++ b/opendatakit/srv/opendatakit/conf/server.xml @@ -66,15 +66,10 @@ APR (HTTP/AJP) Connector: /docs/apr.html Define a non-SSL/TLS HTTP/1.1 Connector on port 8080 --> - - diff --git a/opendatakit/srv/opendatakit/update-ip.sh b/opendatakit/srv/opendatakit/update-ip.sh deleted file mode 100755 index 98438e4..0000000 --- a/opendatakit/srv/opendatakit/update-ip.sh +++ /dev/null @@ -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 diff --git a/opendatakit/srv/opendatakit/update-url.sh b/opendatakit/srv/opendatakit/update-url.sh new file mode 100644 index 0000000..76e59e9 --- /dev/null +++ b/opendatakit/srv/opendatakit/update-url.sh @@ -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