Unify Motech naming and nginx configuration for spotter-appmgr
This commit is contained in:
parent
9d37aed199
commit
551e2a2938
15
motech.sh
15
motech.sh
@ -22,8 +22,7 @@ cp ${SOURCE_DIR}/srv/motech/conf/config-locations.properties /srv/motech/conf/co
|
||||
cp ${SOURCE_DIR}/srv/motech/conf/config/motech-settings.properties /srv/motech/conf/config/motech-settings.properties
|
||||
cp ${SOURCE_DIR}/srv/motech/conf/config/org.motechproject.motech-platform-email/motech-email.properties /srv/motech/conf/config/org.motechproject.motech-platform-email/motech-email.properties
|
||||
chown -R 8013:8013 /srv/motech/conf
|
||||
cp ${SOURCE_DIR}/srv/motech/update-ip.sh /srv/motech/update-ip.sh
|
||||
/srv/motech/update-ip.sh
|
||||
cp ${SOURCE_DIR}/srv/motech/update-url.sh /srv/motech/update-url.sh
|
||||
|
||||
# Create Motech service
|
||||
cp ${SOURCE_DIR}/etc/init.d/motech /etc/init.d/motech
|
||||
@ -32,17 +31,13 @@ service motech start
|
||||
|
||||
# Configure Motech admin
|
||||
echo `date` '- Waiting for database to be populated. This should take about a minute.'
|
||||
until curl -s http://127.0.0.1:8013/motech/module/server/startup/ | grep -q adminLogin; do
|
||||
until curl -s "http://motech:8080/motech/module/server/startup/" | grep -q adminLogin; do
|
||||
sleep 1
|
||||
done
|
||||
export MOTECH_ADMIN_USER="admin"
|
||||
export MOTECH_ADMIN_EMAIL="admin@example.com"
|
||||
export MOTECH_ADMIN_PWD=$(head -c 12 /dev/urandom | base64)
|
||||
curl -H "Content-Type: application/json" -X POST -d "{\"adminLogin\":\"${MOTECH_ADMIN_USER}\",\"adminEmail\":\"${MOTECH_ADMIN_EMAIL}\",\"adminPassword\":\"${MOTECH_ADMIN_PWD}\",\"adminConfirmPassword\":\"${MOTECH_ADMIN_PWD}\",\"language\":\"cs\",\"providerName\":\"\",\"providerUrl\":\"\",\"schedulerUrl\":\"\"}" http://127.0.0.1:8013/motech/module/server/startup/
|
||||
curl -H "Content-Type: application/json" -X POST -d "{\"adminLogin\":\"${MOTECH_ADMIN_USER}\",\"adminEmail\":\"${MOTECH_ADMIN_EMAIL}\",\"adminPassword\":\"${MOTECH_ADMIN_PWD}\",\"adminConfirmPassword\":\"${MOTECH_ADMIN_PWD}\",\"language\":\"cs\",\"providerName\":\"\",\"providerUrl\":\"\",\"schedulerUrl\":\"\"}" http://motech:8080/motech/module/server/startup/
|
||||
|
||||
# Create nginx app definition
|
||||
cp ${SOURCE_DIR}/etc/nginx/conf.d/motech.conf /etc/nginx/conf.d/motech.conf
|
||||
service nginx reload
|
||||
|
||||
# Add portal application definition
|
||||
portal-app-manager motech "https://{host}:8413/motech/" "${MOTECH_ADMIN_USER}" "${MOTECH_ADMIN_PWD}"
|
||||
# Add application definition
|
||||
spotter-appmgr add-app motech "https://motech.{host}/motech/" "${MOTECH_ADMIN_USER}" "${MOTECH_ADMIN_PWD}"
|
||||
|
@ -10,8 +10,6 @@ RUN \
|
||||
&& rm -f /srv/tomcat/webapps/motech/WEB-INF/lib/postgresql-9.1-901.jdbc4.jar /srv/tomcat/webapps/motech/WEB-INF/bundles/postgresql-9.1-901.jdbc4.jar \
|
||||
&& wget https://jdbc.postgresql.org/download/postgresql-42.2.0.jar -O /srv/tomcat/webapps/motech/WEB-INF/lib/postgresql-42.2.0.jar \
|
||||
&& cp /srv/tomcat/webapps/motech/WEB-INF/lib/postgresql-42.2.0.jar /srv/tomcat/webapps/motech/WEB-INF/bundles/postgresql-42.2.0.jar \
|
||||
# Configure Tomcat port
|
||||
&& sed -i 's/port="8080"/port="8013"/g' /srv/tomcat/conf/server.xml \
|
||||
# Create OS user
|
||||
&& addgroup -S -g 8013 motech \
|
||||
&& adduser -S -u 8013 -h /srv/tomcat -s /bin/false -g motech -G motech motech \
|
||||
@ -20,7 +18,7 @@ RUN \
|
||||
&& rm -f /tmp/motech.war
|
||||
|
||||
VOLUME ["/srv/tomcat/.motech"]
|
||||
EXPOSE 8013
|
||||
EXPOSE 8080
|
||||
|
||||
USER motech
|
||||
WORKDIR /srv/tomcat
|
||||
|
@ -14,11 +14,14 @@ start() {
|
||||
--link activemq \
|
||||
--link postfix \
|
||||
--link postgres \
|
||||
-p 127.0.0.1:8013:8013 \
|
||||
-v /srv/motech/conf:/srv/tomcat/.motech \
|
||||
motech
|
||||
}
|
||||
|
||||
start_post() {
|
||||
/usr/local/bin/spotter-appmgr update-hosts motech
|
||||
}
|
||||
|
||||
stop() {
|
||||
/usr/bin/docker stop motech
|
||||
}
|
||||
|
@ -1,11 +0,0 @@
|
||||
server {
|
||||
listen [::]:8813 ipv6only=off;
|
||||
listen [::]:8413 ssl http2 ipv6only=off;
|
||||
|
||||
access_log /var/log/nginx/motech.access.log;
|
||||
error_log /var/log/nginx/motech.error.log;
|
||||
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:8013;
|
||||
}
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
URL=$(ip route get 1 | awk '{print $NF;exit}')
|
||||
sed -i "s|^server\.url.*|server.url=https://${URL}:8413/motech|" /srv/motech/conf/config/motech-settings.properties
|
6
motech/srv/motech/update-url.sh
Normal file
6
motech/srv/motech/update-url.sh
Normal file
@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
HOST="${1}"
|
||||
[ "${2}" != "443" ] && HOST="${1}:${2}"
|
||||
|
||||
sed -i "s|^server\.url.*|server.url=https://${HOST}/motech|" /srv/motech/conf/config/motech-settings.properties
|
Loading…
Reference in New Issue
Block a user