From 91a5a24b1b84d360a841e860f6b34d725ed1b21e Mon Sep 17 00:00:00 2001 From: Disassembler Date: Sat, 7 Dec 2019 15:52:09 +0100 Subject: [PATCH] Use lxchelper extract where appropriate --- apk/vmmgr | 2 +- lxc-apps/ckan/install.sh | 2 +- lxc-apps/crisiscleanup/install.sh | 4 +--- lxc-apps/cts/install.sh | 4 +--- lxc-apps/decidim/install.sh | 4 +--- lxc-apps/openmapkit/install.sh | 8 +++++--- lxc-apps/pandora/install.sh | 7 +------ lxc-apps/sahana-demo/install.sh | 8 ++++---- lxc-apps/sahana/install.sh | 6 +++--- lxc-apps/sambro/install.sh | 8 ++++---- lxc-apps/seeddms/install.sh | 7 ++----- lxc-apps/sigmah/install.sh | 28 ++++++++++++---------------- 12 files changed, 36 insertions(+), 52 deletions(-) diff --git a/apk/vmmgr b/apk/vmmgr index 539a616..7794ada 160000 --- a/apk/vmmgr +++ b/apk/vmmgr @@ -1 +1 @@ -Subproject commit 539a61662de6278f7841c7e9b86d9d17d5e5b492 +Subproject commit 7794ada45e02d5f5ee698765ddb1a1bb6154bee2 diff --git a/lxc-apps/ckan/install.sh b/lxc-apps/ckan/install.sh index d831e6d..ce620bc 100755 --- a/lxc-apps/ckan/install.sh +++ b/lxc-apps/ckan/install.sh @@ -26,7 +26,7 @@ service lxc-ckan-redis start # Configure Solr mkdir -p /srv/ckan/solr_data -lxc-execute ckan-solr -- cat /opt/solr/server/solr/solr.xml >/srv/ckan/solr_data/solr.xml +lxchelper extract ckan-solr /opt/solr/server/solr/solr.xml /srv/ckan/solr_data/solr.xml chown -R 108983:108983 /srv/ckan/solr_data service lxc-ckan-solr start diff --git a/lxc-apps/crisiscleanup/install.sh b/lxc-apps/crisiscleanup/install.sh index 4419f82..c94929d 100755 --- a/lxc-apps/crisiscleanup/install.sh +++ b/lxc-apps/crisiscleanup/install.sh @@ -17,9 +17,7 @@ service lxc-crisiscleanup-postgres start envsubst /srv/openmapkit/omk_conf/settings.js +# Copy existing files into persistent storage +lxchelper extract openmapkit /srv/openmapkit/data /srv/openmapkit/omk_data + # Register application vmmgr register-app openmapkit omk "${OPENMAPKIT_ADMIN_USER}" "${OPENMAPKIT_ADMIN_PWD}" diff --git a/lxc-apps/pandora/install.sh b/lxc-apps/pandora/install.sh index b27dc9c..680a0e1 100755 --- a/lxc-apps/pandora/install.sh +++ b/lxc-apps/pandora/install.sh @@ -30,12 +30,7 @@ lxc-attach pandora-rabbitmq -- rabbitmqctl set_permissions -p /pandora pandora " # Configure Pandora mkdir -p /srv/pandora/pandora_conf /srv/pandora/pandora_data chown 108080:108080 /srv/pandora/pandora_data -# Copy customized configuration if VANILLA environment variable is not set, else use the default pandora config -if [ ${VANILLA:-0} -eq 0 ]; then - cp pandora_conf/config.jsonc /srv/pandora/pandora_conf/config.jsonc -else - lxc-execute pandora -- cat /srv/pandora/pandora/config.pandora.jsonc >/srv/pandora/pandora_conf/config.jsonc -fi +cp pandora_conf/config.jsonc /srv/pandora/pandora_conf/config.jsonc cp pandora_conf/gunicorn_config.py /srv/pandora/pandora_conf/gunicorn_config.py envsubst /srv/pandora/pandora_conf/local_settings.py chown -R 108080:108080 /srv/pandora/pandora_conf diff --git a/lxc-apps/sahana-demo/install.sh b/lxc-apps/sahana-demo/install.sh index 7329cf0..fc53d9e 100755 --- a/lxc-apps/sahana-demo/install.sh +++ b/lxc-apps/sahana-demo/install.sh @@ -17,10 +17,10 @@ service lxc-sahana-demo-postgres start envsubst /srv/seeddms/seeddms_conf/settings.xml diff --git a/lxc-apps/sigmah/install.sh b/lxc-apps/sigmah/install.sh index ac0b029..396d3fc 100755 --- a/lxc-apps/sigmah/install.sh +++ b/lxc-apps/sigmah/install.sh @@ -22,26 +22,24 @@ chown -R 108080:108080 /srv/sigmah/sigmah_data envsubst /srv/sigmah/sigmah_conf/persistence.xml cp sigmah_conf/sigmah.properties /srv/sigmah/sigmah_conf/sigmah.properties chown -R 108080:108080 /srv/sigmah/sigmah_conf -lxc-execute sigmah -- cat /srv/tomcat/webapps/sigmah/sigmah/images/header/org-default-logo.png >/srv/sigmah/sigmah_data/files/logo.png +lxchelper extract sigmah /srv/tomcat/webapps/sigmah/sigmah/images/header/org-default-logo.png /srv/sigmah/sigmah_data/files/logo.png # Populate database -lxc-execute sigmah -- cat /srv/sigmah-MinimumDataKit.sql >/tmp/sigmah-MinimumDataKit.sql -lxc-execute sigmah -- cat /srv/sigmah-newOrganizationLaunchScript.sql >/tmp/sigmah-newOrganizationLaunchScript.sql export SIGMAH_ADMIN_USER=Admin export SIGMAH_ADMIN_EMAIL=admin@example.com export SIGMAH_ADMIN_PWD=$(head -c 12 /dev/urandom | base64 | tr -d '+/=') export SIGMAH_ADMIN_HASH=$(python3 -c "import bcrypt; print(bcrypt.hashpw('${SIGMAH_ADMIN_PWD}'.encode(), bcrypt.gensalt(prefix=b'2a')).decode())") -sed -i "s|§OrganizationName§|Demo organization|g" /tmp/sigmah-newOrganizationLaunchScript.sql -sed -i "s|§OrganizationLogoFilename§|logo.png|g" /tmp/sigmah-newOrganizationLaunchScript.sql -sed -i "s|§HeadquartersCountryCode§|CZ|g" /tmp/sigmah-newOrganizationLaunchScript.sql -sed -i "s|§UserEmail§|${SIGMAH_ADMIN_EMAIL}|g" /tmp/sigmah-newOrganizationLaunchScript.sql -sed -i "s|§UserName§|${SIGMAH_ADMIN_USER}|g" /tmp/sigmah-newOrganizationLaunchScript.sql -sed -i "s|§UserFirstName§|${SIGMAH_ADMIN_USER}|g" /tmp/sigmah-newOrganizationLaunchScript.sql -sed -i "s|§UserLocale§|en|g" /tmp/sigmah-newOrganizationLaunchScript.sql -sed -i "s|\$2a\$10\$pMcTA1p9fefR8U9NoOPei.H0eq/TbbdSF27M0tn9iDWBrA4JHeCDC|${SIGMAH_ADMIN_HASH}|" /tmp/sigmah-newOrganizationLaunchScript.sql -cat /tmp/sigmah-MinimumDataKit.sql | lxc-attach sigmah-postgres -- sh -c "PGPASSWORD=${SIGMAH_PWD} psql -U sigmah sigmah" -cat /tmp/sigmah-newOrganizationLaunchScript.sql | lxc-attach sigmah-postgres -- sh -c "PGPASSWORD=${SIGMAH_PWD} psql -U sigmah sigmah" -rm -f /tmp/sigmah-MinimumDataKit.sql /tmp/sigmah-newOrganizationLaunchScript.sql +lxc-execute sigmah -- cat /srv/sigmah-MinimumDataKit.sql | lxc-attach sigmah-postgres -- sh -c "PGPASSWORD=${SIGMAH_PWD} psql -U sigmah sigmah" +lxc-execute sigmah -- cat /srv/sigmah-newOrganizationLaunchScript.sql | \ + sed -e "s|§OrganizationName§|Demo organization|g" \ + -e "s|§OrganizationLogoFilename§|logo.png|g" \ + -e "s|§HeadquartersCountryCode§|CZ|g" \ + -e "s|§UserEmail§|${SIGMAH_ADMIN_EMAIL}|g" \ + -e "s|§UserName§|${SIGMAH_ADMIN_USER}|g" \ + -e "s|§UserFirstName§|${SIGMAH_ADMIN_USER}|g" \ + -e "s|§UserLocale§|en|g" \ + -e "s|\$2a\$10\$pMcTA1p9fefR8U9NoOPei.H0eq/TbbdSF27M0tn9iDWBrA4JHeCDC|${SIGMAH_ADMIN_HASH}|" \ + | lxc-attach sigmah-postgres -- sh -c "PGPASSWORD=${SIGMAH_PWD} psql -U sigmah sigmah" # Install config update script cp update-conf.sh /srv/sigmah/update-conf.sh @@ -51,5 +49,3 @@ service lxc-sigmah-postgres stop # Register application vmmgr register-app sigmah sigmah "${SIGMAH_ADMIN_EMAIL}" "${SIGMAH_ADMIN_PWD}" - -# TODO: SQL skripty jako soucast installu?