Include DOMAIN directly in HOST envvar for update-conf.sh, update add-ca-cert
This commit is contained in:
parent
6bab2bda8d
commit
867997b588
@ -1 +1 @@
|
|||||||
Subproject commit 67f71697fb817348c40e0bebe1434db898dd6d0a
|
Subproject commit 4989d2f87f148594896a0f9dde2de8844d774efa
|
@ -5,7 +5,7 @@ import ssl
|
|||||||
with open('/etc/ckan-datapusher/add-ca-cert.env') as f:
|
with open('/etc/ckan-datapusher/add-ca-cert.env') as f:
|
||||||
env = dict(tuple(line.split('=')) for line in f.read().splitlines())
|
env = dict(tuple(line.split('=')) for line in f.read().splitlines())
|
||||||
|
|
||||||
cert = ssl.get_server_certificate((env['DOMAIN'], env['PORT']))
|
cert = ssl.get_server_certificate((env['HOST'], env['PORT']))
|
||||||
with open('/usr/lib/python2.7/site-packages/requests/cacert.pem', 'a') as f:
|
with open('/usr/lib/python2.7/site-packages/requests/cacert.pem', 'a') as f:
|
||||||
f.write(cert)
|
f.write(cert)
|
||||||
|
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
DOMAIN=ckan.spotter.vm
|
HOST=ckan.spotter.vm
|
||||||
PORT=443
|
PORT=443
|
||||||
|
@ -5,13 +5,16 @@ DATAPUSHER_CONF="${VOLUMES_DIR}/ckan/datapusher_conf"
|
|||||||
CKAN_CONF="${VOLUMES_DIR}/ckan/ckan_conf"
|
CKAN_CONF="${VOLUMES_DIR}/ckan/ckan_conf"
|
||||||
|
|
||||||
# Variables
|
# Variables
|
||||||
HOST="${HOST}.${DOMAIN}"
|
HTTP_HOST="${HOST}"
|
||||||
[ "${PORT}" != "443" ] && HOST="${HOST}:${PORT}"
|
[ "${PORT}" != "443" ] && HTTP_HOST="${HTTP_HOST}:${PORT}"
|
||||||
|
|
||||||
# Replacements
|
# Replacements
|
||||||
sed -i "s|\(^ckan\.site_url = \).*|\1https://${HOST}|" ${CKAN_CONF}/ckan.ini
|
sed -i "s|\(^ckan\.site_url = \).*|\1https://${HTTP_HOST}|" ${CKAN_CONF}/ckan.ini
|
||||||
|
|
||||||
sed -i "s|\(^smtp\.mail_from = \).*|\1${EMAIL}|" ${CKAN_CONF}/ckan.ini
|
sed -i "s|\(^smtp\.mail_from = \).*|\1${EMAIL}|" ${CKAN_CONF}/ckan.ini
|
||||||
sed -i "s|\(^ckanext\.geoview\.gapi_key = \).*|\1${GMAPS_API_KEY}|" ${CKAN_CONF}/ckan.ini
|
sed -i "s|\(^ckanext\.geoview\.gapi_key = \).*|\1${GMAPS_API_KEY}|" ${CKAN_CONF}/ckan.ini
|
||||||
|
|
||||||
|
cat <<EOF >${DATAPUSHER_CONF}/add-ca-cert.env
|
||||||
|
HOST=${HOST}
|
||||||
|
PORT=${PORT}
|
||||||
|
EOF
|
||||||
sed -i "s|\(^FROM_EMAIL = \).*|\1'${EMAIL}'|" ${DATAPUSHER_CONF}/datapusher_settings.py
|
sed -i "s|\(^FROM_EMAIL = \).*|\1'${EMAIL}'|" ${DATAPUSHER_CONF}/datapusher_settings.py
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
MIFOSX_CONF="${VOLUMES_DIR}/mifosx/mifosx_conf"
|
MIFOSX_CONF="${VOLUMES_DIR}/mifosx/mifosx_conf"
|
||||||
|
|
||||||
# Replacements
|
# Replacements
|
||||||
sed -i "s|\(^\s\+proxyName=\).*|\1\"${HOST}.${DOMAIN}\"|" ${MIFOSX_CONF}/server.xml
|
sed -i "s|\(^\s\+proxyName=\).*|\1\"${HOST}\"|" ${MIFOSX_CONF}/server.xml
|
||||||
sed -i "s|\(^\s\+proxyPort=\).*|\1\"${PORT}\"|" ${MIFOSX_CONF}/server.xml
|
sed -i "s|\(^\s\+proxyPort=\).*|\1\"${PORT}\"|" ${MIFOSX_CONF}/server.xml
|
||||||
|
|
||||||
QUERY="UPDATE \`c_external_service_properties\` SET \`value\` = '${EMAIL}' WHERE \`external_service_id\` = 2 and \`name\` LIKE 'username'"
|
QUERY="UPDATE \`c_external_service_properties\` SET \`value\` = '${EMAIL}' WHERE \`external_service_id\` = 2 and \`name\` LIKE 'username'"
|
||||||
|
@ -4,8 +4,8 @@
|
|||||||
MOTECH_CONF="${VOLUMES_DIR}/motech/motech_conf"
|
MOTECH_CONF="${VOLUMES_DIR}/motech/motech_conf"
|
||||||
|
|
||||||
# Variables
|
# Variables
|
||||||
HOST="${HOST}.${DOMAIN}"
|
HTTP_HOST="${HOST}"
|
||||||
[ "${PORT}" != "443" ] && HOST="${HOST}:${PORT}"
|
[ "${PORT}" != "443" ] && HTTP_HOST="${HTTP_HOST}:${PORT}"
|
||||||
|
|
||||||
# Replacements
|
# Replacements
|
||||||
sed -i "s|\(^server\.url=\).*|\1https://${HOST}|" ${MOTECH_CONF}/config/motech-settings.properties
|
sed -i "s|\(^server\.url=\).*|\1https://${HTTP_HOST}|" ${MOTECH_CONF}/config/motech-settings.properties
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
DOMAIN=odk.spotter.vm
|
HOST=odk.spotter.vm
|
||||||
PORT=443
|
PORT=443
|
||||||
|
@ -2,8 +2,14 @@
|
|||||||
|
|
||||||
# Volumes
|
# Volumes
|
||||||
ODK_CONF="${VOLUMES_DIR}/opendatakit/odk_conf"
|
ODK_CONF="${VOLUMES_DIR}/opendatakit/odk_conf"
|
||||||
|
ODKBUILD_CONF="${VOLUMES_DIR}/opendatakit/odkbuild_conf"
|
||||||
|
|
||||||
# Replacements
|
# Replacements
|
||||||
sed -i "s|\(^\s\+proxyName=\).*|\1\"${HOST}.${DOMAIN}\"|" ${ODK_CONF}/server.xml
|
sed -i "s|\(^\s\+proxyName=\).*|\1\"${HOST}\"|" ${ODK_CONF}/server.xml
|
||||||
sed -i "s|\(^\s\+proxyPort=\).*|\1\"${PORT}\"|" ${ODK_CONF}/server.xml
|
sed -i "s|\(^\s\+proxyPort=\).*|\1\"${PORT}\"|" ${ODK_CONF}/server.xml
|
||||||
sed -i "s|\(^security\.server\.securePort=\).*|\1${PORT}|" ${ODK_CONF}/security.properties
|
sed -i "s|\(^security\.server\.securePort=\).*|\1${PORT}|" ${ODK_CONF}/security.properties
|
||||||
|
|
||||||
|
cat <<EOF >${ODKBUILD_CONF}/add-ca-cert.env
|
||||||
|
HOST=${HOST}
|
||||||
|
PORT=${PORT}
|
||||||
|
EOF
|
||||||
|
@ -2,5 +2,5 @@
|
|||||||
|
|
||||||
. /srv/opendatakit-build/add-ca-cert.env
|
. /srv/opendatakit-build/add-ca-cert.env
|
||||||
|
|
||||||
true | openssl s_client -connect ${DOMAIN}:${PORT} | openssl x509 -out /usr/local/share/ca-certificates/opendatakit.crt
|
true | openssl s_client -connect ${HOST}:${PORT} | openssl x509 -out /usr/local/share/ca-certificates/opendatakit.crt
|
||||||
update-ca-certificates
|
update-ca-certificates
|
||||||
|
@ -4,9 +4,9 @@
|
|||||||
PANDORA_CONF="${VOLUMES_DIR}/pandora/pandora_conf"
|
PANDORA_CONF="${VOLUMES_DIR}/pandora/pandora_conf"
|
||||||
|
|
||||||
# Variables
|
# Variables
|
||||||
HOST="${HOST}.${DOMAIN}"
|
HTTP_HOST="${HOST}"
|
||||||
[ "${PORT}" != "443" ] && HOST="${HOST}:${PORT}"
|
[ "${PORT}" != "443" ] && HTTP_HOST="${HTTP_HOST}:${PORT}"
|
||||||
|
|
||||||
# Replacements
|
# Replacements
|
||||||
sed -i "s|\(^\s\+\"url\": \).*|\1\"${HOST}\"|" ${PANDORA_CONF}/config.jsonc
|
sed -i "s|\(^\s\+\"url\": \).*|\1\"${HTTP_HOST}\"|" ${PANDORA_CONF}/config.jsonc
|
||||||
sed -i "s|\(^GOOGLE_API_KEY = \).*|\1'${GMAPS_API_KEY}'|" ${PANDORA_CONF}/local_settings.py
|
sed -i "s|\(^GOOGLE_API_KEY = \).*|\1'${GMAPS_API_KEY}'|" ${PANDORA_CONF}/local_settings.py
|
||||||
|
@ -4,11 +4,11 @@
|
|||||||
SAHANA_CONF="${VOLUMES_DIR}/sahana-demo/sahana_conf"
|
SAHANA_CONF="${VOLUMES_DIR}/sahana-demo/sahana_conf"
|
||||||
|
|
||||||
# Variables
|
# Variables
|
||||||
HOST="${HOST}.${DOMAIN}"
|
HTTP_HOST="${HOST}"
|
||||||
[ "${PORT}" != "443" ] && HOST="${HOST}:${PORT}"
|
[ "${PORT}" != "443" ] && HTTP_HOST="${HTTP_HOST}:${PORT}"
|
||||||
|
|
||||||
# Replacements
|
# Replacements
|
||||||
sed -i "s|\(^settings\.base\.public_url = \).*|\1\"https://${HOST}\"|" ${SAHANA_CONF}/000_config.py
|
sed -i "s|\(^settings\.base\.public_url = \).*|\1\"https://${HTTP_HOST}\"|" ${SAHANA_CONF}/000_config.py
|
||||||
sed -i "s|\(^settings\.mail\.sender = \).*|\1\"${EMAIL}\"|" ${SAHANA_CONF}/000_config.py
|
sed -i "s|\(^settings\.mail\.sender = \).*|\1\"${EMAIL}\"|" ${SAHANA_CONF}/000_config.py
|
||||||
sed -i "s|\(^settings\.mail\.approver = \).*|\1\"${EMAIL}\"|" ${SAHANA_CONF}/000_config.py
|
sed -i "s|\(^settings\.mail\.approver = \).*|\1\"${EMAIL}\"|" ${SAHANA_CONF}/000_config.py
|
||||||
sed -i "s|\(^settings\.gis\.api_google = \).*|\1\"${GMAPS_API_KEY}\"|" ${SAHANA_CONF}/000_config.py
|
sed -i "s|\(^settings\.gis\.api_google = \).*|\1\"${GMAPS_API_KEY}\"|" ${SAHANA_CONF}/000_config.py
|
||||||
|
@ -4,11 +4,11 @@
|
|||||||
SAHANA_CONF="${VOLUMES_DIR}/sahana/sahana_conf"
|
SAHANA_CONF="${VOLUMES_DIR}/sahana/sahana_conf"
|
||||||
|
|
||||||
# Variables
|
# Variables
|
||||||
HOST="${HOST}.${DOMAIN}"
|
HTTP_HOST="${HOST}"
|
||||||
[ "${PORT}" != "443" ] && HOST="${HOST}:${PORT}"
|
[ "${PORT}" != "443" ] && HTTP_HOST="${HTTP_HOST}:${PORT}"
|
||||||
|
|
||||||
# Replacements
|
# Replacements
|
||||||
sed -i "s|\(^settings\.base\.public_url = \).*|\1\"https://${HOST}\"|" ${SAHANA_CONF}/000_config.py
|
sed -i "s|\(^settings\.base\.public_url = \).*|\1\"https://${HTTP_HOST}\"|" ${SAHANA_CONF}/000_config.py
|
||||||
sed -i "s|\(^settings\.mail\.sender = \).*|\1\"${EMAIL}\"|" ${SAHANA_CONF}/000_config.py
|
sed -i "s|\(^settings\.mail\.sender = \).*|\1\"${EMAIL}\"|" ${SAHANA_CONF}/000_config.py
|
||||||
sed -i "s|\(^settings\.mail\.approver = \).*|\1\"${EMAIL}\"|" ${SAHANA_CONF}/000_config.py
|
sed -i "s|\(^settings\.mail\.approver = \).*|\1\"${EMAIL}\"|" ${SAHANA_CONF}/000_config.py
|
||||||
sed -i "s|\(^settings\.gis\.api_google = \).*|\1\"${GMAPS_API_KEY}\"|" ${SAHANA_CONF}/000_config.py
|
sed -i "s|\(^settings\.gis\.api_google = \).*|\1\"${GMAPS_API_KEY}\"|" ${SAHANA_CONF}/000_config.py
|
||||||
|
@ -4,11 +4,11 @@
|
|||||||
SAHANA_CONF="${VOLUMES_DIR}/sambro/sahana_conf"
|
SAHANA_CONF="${VOLUMES_DIR}/sambro/sahana_conf"
|
||||||
|
|
||||||
# Variables
|
# Variables
|
||||||
HOST="${HOST}.${DOMAIN}"
|
HTTP_HOST="${HOST}"
|
||||||
[ "${PORT}" != "443" ] && HOST="${HOST}:${PORT}"
|
[ "${PORT}" != "443" ] && HTTP_HOST="${HTTP_HOST}:${PORT}"
|
||||||
|
|
||||||
# Replacements
|
# Replacements
|
||||||
sed -i "s|\(^settings\.base\.public_url = \).*|\1\"https://${HOST}\"|" ${SAHANA_CONF}/000_config.py
|
sed -i "s|\(^settings\.base\.public_url = \).*|\1\"https://${HTTP_HOST}\"|" ${SAHANA_CONF}/000_config.py
|
||||||
sed -i "s|\(^settings\.mail\.sender = \).*|\1\"${EMAIL}\"|" ${SAHANA_CONF}/000_config.py
|
sed -i "s|\(^settings\.mail\.sender = \).*|\1\"${EMAIL}\"|" ${SAHANA_CONF}/000_config.py
|
||||||
sed -i "s|\(^settings\.mail\.approver = \).*|\1\"${EMAIL}\"|" ${SAHANA_CONF}/000_config.py
|
sed -i "s|\(^settings\.mail\.approver = \).*|\1\"${EMAIL}\"|" ${SAHANA_CONF}/000_config.py
|
||||||
sed -i "s|\(^settings\.gis\.api_google = \).*|\1\"${GMAPS_API_KEY}\"|" ${SAHANA_CONF}/000_config.py
|
sed -i "s|\(^settings\.gis\.api_google = \).*|\1\"${GMAPS_API_KEY}\"|" ${SAHANA_CONF}/000_config.py
|
||||||
|
@ -4,12 +4,12 @@
|
|||||||
USHAHIDI_CONF="${VOLUMES_DIR}/ushahidi/ushahidi_conf"
|
USHAHIDI_CONF="${VOLUMES_DIR}/ushahidi/ushahidi_conf"
|
||||||
|
|
||||||
# Variables
|
# Variables
|
||||||
HOST="${HOST}.${DOMAIN}"
|
HTTP_HOST="${HOST}"
|
||||||
[ "${PORT}" != "443" ] && HOST="${HOST}:${PORT}"
|
[ "${PORT}" != "443" ] && HTTP_HOST="${HTTP_HOST}:${PORT}"
|
||||||
|
|
||||||
# Replacements
|
# Replacements
|
||||||
sed -i "s|\(^\s\+\"backend_url\": \).*|\1\"https://${HOST}/platform\",|" ${USHAHIDI_CONF}/config.json
|
sed -i "s|\(^\s\+\"backend_url\": \).*|\1\"https://${HTTP_HOST}/platform\",|" ${USHAHIDI_CONF}/config.json
|
||||||
API_URL="\"https:\\\/\\\/${HOST}\\\/platform\\\/api\\\/v3\\\/config\\\/data-provider\""
|
API_URL="\"https:\\\/\\\/${HTTP_HOST}\\\/platform\\\/api\\\/v3\\\/config\\\/data-provider\""
|
||||||
QUERY="UPDATE \`config\` SET \`config_value\` = '${API_URL}' WHERE \`group_name\` LIKE 'data-provider' AND \`config_key\` LIKE 'url'"
|
QUERY="UPDATE \`config\` SET \`config_value\` = '${API_URL}' WHERE \`group_name\` LIKE 'data-provider' AND \`config_key\` LIKE 'url'"
|
||||||
spoc-container exec ushahidi-mariadb -- mysql -e "${QUERY}" ushahidi
|
spoc-container exec ushahidi-mariadb -- mysql -e "${QUERY}" ushahidi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user