Unify Ushahidi naming and nginx configuration for spotter-appmgr
This commit is contained in:
parent
0255878ced
commit
0d2b1158f2
12
ushahidi.sh
12
ushahidi.sh
@ -18,7 +18,7 @@ mkdir -p /srv/ushahidi/conf /srv/ushahidi/data
|
||||
chown 8014:8014 /srv/ushahidi/data
|
||||
envsubst <${SOURCE_DIR}/srv/ushahidi/conf/env >/srv/ushahidi/conf/env
|
||||
cp ${SOURCE_DIR}/srv/ushahidi/conf/config.json /srv/ushahidi/conf/config.json
|
||||
cp ${SOURCE_DIR}/srv/ushahidi/update-ip.sh /srv/ushahidi/update-ip.sh
|
||||
cp ${SOURCE_DIR}/srv/ushahidi/update-url.sh /srv/ushahidi/update-url.sh
|
||||
|
||||
# Populate database
|
||||
docker run --rm -h ushahidi --link mariadb -v /srv/ushahidi/conf/env:/srv/ushahidi/platform/.env ushahidi /srv/ushahidi/platform/bin/phinx migrate -c /srv/ushahidi/platform/application/phinx.php
|
||||
@ -34,13 +34,9 @@ cp ${SOURCE_DIR}/etc/init.d/ushahidi /etc/init.d/ushahidi
|
||||
rc-update add ushahidi
|
||||
service ushahidi start
|
||||
|
||||
# Create nginx app definition
|
||||
cp ${SOURCE_DIR}/etc/nginx/conf.d/ushahidi.conf /etc/nginx/conf.d/ushahidi.conf
|
||||
service nginx reload
|
||||
|
||||
# Install cron job
|
||||
cp ${SOURCE_DIR}/etc/periodic/15min/ushahidi /etc/periodic/15min/ushahidi
|
||||
|
||||
# Add portal application definition
|
||||
portal-app-manager ushahidi "https://{host}:8414/" "${USHAHIDI_ADMIN_USER}" "${USHAHIDI_ADMIN_PWD}"
|
||||
portal-app-manager ushahidi-mobile -p clienturl "{host}:8814"
|
||||
# Add application definition
|
||||
spotter-appmgr add-app ushahidi "https://ushahidi.{host}/" "${USHAHIDI_ADMIN_USER}" "${USHAHIDI_ADMIN_PWD}"
|
||||
spotter-appmgr add-app ushahidi-mobile -p clienturl "ushahidi.{host}"
|
||||
|
@ -24,6 +24,6 @@ RUN \
|
||||
COPY docker/ /
|
||||
|
||||
VOLUME ["/srv/ushahidi/platform/application/media/uploads"]
|
||||
EXPOSE 8014
|
||||
EXPOSE 8080
|
||||
|
||||
CMD ["s6-svscan", "/etc/services.d"]
|
||||
|
@ -17,7 +17,7 @@ http {
|
||||
sendfile on;
|
||||
|
||||
server {
|
||||
listen 8014;
|
||||
listen 8080;
|
||||
server_name localhost;
|
||||
|
||||
root /srv/ushahidi;
|
||||
|
@ -7,23 +7,22 @@ depend() {
|
||||
use dns logger netmount postfix
|
||||
}
|
||||
|
||||
start_pre() {
|
||||
/srv/ushahidi/update-ip.sh
|
||||
}
|
||||
|
||||
start() {
|
||||
/usr/bin/docker run -d --rm \
|
||||
--name ushahidi \
|
||||
-h ushahidi \
|
||||
--link mariadb \
|
||||
--link postfix \
|
||||
-p 127.0.0.1:8014:8014 \
|
||||
-v /srv/ushahidi/conf/env:/srv/ushahidi/platform/.env \
|
||||
-v /srv/ushahidi/conf/config.json:/srv/ushahidi/config.json \
|
||||
-v /srv/ushahidi/data:/srv/ushahidi/platform/application/media/uploads \
|
||||
ushahidi
|
||||
}
|
||||
|
||||
start_post() {
|
||||
/usr/local/bin/spotter-appmgr update-hosts ushahidi
|
||||
}
|
||||
|
||||
stop() {
|
||||
/usr/bin/docker stop ushahidi
|
||||
}
|
||||
|
@ -1,14 +0,0 @@
|
||||
server {
|
||||
listen [::]:8814 ipv6only=off;
|
||||
listen [::]:8414 ssl http2 ipv6only=off;
|
||||
|
||||
access_log /var/log/nginx/ushahidi.access.log;
|
||||
error_log /var/log/nginx/ushahidi.error.log;
|
||||
|
||||
location / {
|
||||
proxy_set_header X-Forwarded-HTTPS $https;
|
||||
proxy_set_header X-Forwarded-Server-Name $host;
|
||||
proxy_set_header X-Forwarded-Server-Port $server_port;
|
||||
proxy_pass http://127.0.0.1:8014;
|
||||
}
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
URL=$(ip route get 1 | awk '{print $NF;exit}')
|
||||
|
||||
sed -i "s|^ \"backend_url\".*| \"backend_url\": \"http://${URL}:8814/platform\",|" /srv/ushahidi/conf/config.json
|
||||
|
||||
FULL_URL='\\\"https:\\\\/\\\\/'${URL}:8414'\\\\/platform\\\\/api\\\\/v3\\\\/config\\\\/data-provider\\\"'
|
||||
echo 'UPDATE `config` SET `config_value` = "'${FULL_URL}'" WHERE `group_name` LIKE "data-provider" AND `config_key` LIKE "url";' | docker exec -i mariadb mysql ushahidi
|
9
ushahidi/srv/ushahidi/update-url.sh
Normal file
9
ushahidi/srv/ushahidi/update-url.sh
Normal file
@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
|
||||
HOST="${1}"
|
||||
[ "${2}" != "443" ] && HOST="${1}:${2}"
|
||||
|
||||
sed -i "s|^ \"backend_url\".*| \"backend_url\": \"https://${HOST}/platform\",|" /srv/ushahidi/conf/config.json
|
||||
|
||||
API_URL='\\\"https:\\\\/\\\\/'${HOST}'\\\\/platform\\\\/api\\\\/v3\\\\/config\\\\/data-provider\\\"'
|
||||
echo 'UPDATE `config` SET `config_value` = "'${API_URL}'" WHERE `group_name` LIKE "data-provider" AND `config_key` LIKE "url";' | docker exec -i mariadb mysql ushahidi
|
Loading…
Reference in New Issue
Block a user