From 189b1568548e7bf5b28fa174e7022beec5d61c6a Mon Sep 17 00:00:00 2001 From: Disassembler Date: Mon, 26 Mar 2018 13:36:48 +0200 Subject: [PATCH] Unify MifosX naming and nginx configuration for spotter-appmgr --- mifosx.sh | 12 +-- mifosx/Dockerfile | 6 +- mifosx/etc/init.d/mifosx | 6 +- mifosx/etc/nginx/conf.d/mifosx.conf | 11 --- mifosx/srv/mifosx/conf/server.xml | 145 ++++++++++++++++++++++++++++ mifosx/srv/mifosx/update-url.sh | 4 + 6 files changed, 160 insertions(+), 24 deletions(-) delete mode 100644 mifosx/etc/nginx/conf.d/mifosx.conf create mode 100644 mifosx/srv/mifosx/conf/server.xml create mode 100644 mifosx/srv/mifosx/update-url.sh diff --git a/mifosx.sh b/mifosx.sh index 0414290..ff4a33c 100755 --- a/mifosx.sh +++ b/mifosx.sh @@ -21,6 +21,8 @@ envsubst <${SOURCE_DIR}/schemapwd.sql | docker exec -i mariadb mysql mifosplatfo # Configure Mifos X mkdir -p /srv/mifosx/conf envsubst <${SOURCE_DIR}/srv/mifosx/conf/context.xml >/srv/mifosx/conf/context.xml +cp ${SOURCE_DIR}/srv/mifosx/conf/server.xml /srv/mifosx/conf/server.xml +cp ${SOURCE_DIR}/srv/mifosx/update-url.sh /srv/mifosx/update-url.sh # Create Mifos X service cp ${SOURCE_DIR}/etc/init.d/mifosx /etc/init.d/mifosx @@ -38,10 +40,6 @@ export MIFOSX_ADMIN_PWD=$(head -c 12 /dev/urandom | base64 | tr -d "+") export MIFOSX_ADMIN_HASH=$(echo -n "${MIFOSX_ADMIN_PWD}{1}" | sha256sum | awk '{print $1}') envsubst <${SOURCE_DIR}/adminpwd.sql | docker exec -i mariadb mysql mifostenant-default -# Create nginx app definition -cp ${SOURCE_DIR}/etc/nginx/conf.d/mifosx.conf /etc/nginx/conf.d/mifosx.conf -service nginx reload - -# Add portal application definition -portal-app-manager mifosx "https://{host}:8412/community-app/" "${MIFOSX_ADMIN_USER}" "${MIFOSX_ADMIN_PWD}" -portal-app-manager mifosx-mobile -p clienturl "{host}:8412" +# Add application definition +spotter-appmgr add-app mifosx "https://mifosx.{host}/community-app/" "${MIFOSX_ADMIN_USER}" "${MIFOSX_ADMIN_PWD}" +spotter-appmgr add-app mifosx-mobile -p clienturl "mifosx.{host}" diff --git a/mifosx/Dockerfile b/mifosx/Dockerfile index d2bf7e4..8ef055a 100644 --- a/mifosx/Dockerfile +++ b/mifosx/Dockerfile @@ -13,10 +13,6 @@ RUN \ && mv /tmp/fineractplatform-17.07.01.RELEASE/database/mifospltaform-tenants-first-time-install.sql /tmp/mifospltaform-tenants-first-time-install.sql \ # Download Java library dependencies && wget http://central.maven.org/maven2/org/drizzle/jdbc/drizzle-jdbc/1.3/drizzle-jdbc-1.3.jar -O /srv/tomcat/lib/drizzle-jdbc-1.3.jar \ - # Configure Tomcat port + Spring - && sed -i 's/port="8080"/port="8012"/g' /srv/tomcat/conf/server.xml \ - && echo -e '\r\nserver.port=8012' >> /srv/tomcat/webapps/fineract-provider/WEB-INF/classes/application.properties \ - && sed -i 's/requires-channel="https" //g' /srv/tomcat/webapps/fineract-provider/WEB-INF/classes/META-INF/spring/securityContext.xml \ # Create OS user && addgroup -S -g 8012 mifosx \ && adduser -S -u 8012 -h /srv/tomcat -s /bin/false -g mifosx -G mifosx mifosx \ @@ -25,7 +21,7 @@ RUN \ && apk --no-cache del wget \ && rm -rf /tmp/fineractplatform-17.07.01.RELEASE /tmp/mifosx.zip -EXPOSE 8012 +EXPOSE 8080 USER mifosx WORKDIR /srv/tomcat diff --git a/mifosx/etc/init.d/mifosx b/mifosx/etc/init.d/mifosx index dd1c1e2..6005bfd 100755 --- a/mifosx/etc/init.d/mifosx +++ b/mifosx/etc/init.d/mifosx @@ -13,11 +13,15 @@ start() { -h mifosx \ --link mariadb \ --link postfix \ - -p 127.0.0.1:8012:8012 \ + -v /srv/mifosx/conf/server.xml:/srv/tomcat/conf/server.xml \ -v /srv/mifosx/conf/context.xml:/srv/tomcat/webapps/fineract-provider/META-INF/context.xml \ mifosx } +start_post() { + /usr/local/bin/spotter-appmgr update-hosts mifosx +} + stop() { /usr/bin/docker stop mifosx } diff --git a/mifosx/etc/nginx/conf.d/mifosx.conf b/mifosx/etc/nginx/conf.d/mifosx.conf deleted file mode 100644 index 923fda0..0000000 --- a/mifosx/etc/nginx/conf.d/mifosx.conf +++ /dev/null @@ -1,11 +0,0 @@ -server { - listen [::]:8812 ipv6only=off; - listen [::]:8412 ssl http2 ipv6only=off; - - access_log /var/log/nginx/mifosx.access.log; - error_log /var/log/nginx/mifosx.error.log; - - location / { - proxy_pass http://127.0.0.1:8012; - } -} diff --git a/mifosx/srv/mifosx/conf/server.xml b/mifosx/srv/mifosx/conf/server.xml new file mode 100644 index 0000000..2d8e62a --- /dev/null +++ b/mifosx/srv/mifosx/conf/server.xml @@ -0,0 +1,145 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mifosx/srv/mifosx/update-url.sh b/mifosx/srv/mifosx/update-url.sh new file mode 100644 index 0000000..76e6aa7 --- /dev/null +++ b/mifosx/srv/mifosx/update-url.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +sed -i "s|\(^\s\+proxyName\).*|\1=\"${1}\"|g" /srv/mifosx/conf/server.xml +sed -i "s|\(^\s\+proxyPort\).*|\1=\"${2}\"|g" /srv/mifosx/conf/server.xml