Use lxchelper extract where appropriate

This commit is contained in:
Disassembler 2019-12-07 15:52:09 +01:00
parent d94db19410
commit 91a5a24b1b
No known key found for this signature in database
GPG Key ID: 524BD33A0EE29499
12 changed files with 36 additions and 52 deletions

@ -1 +1 @@
Subproject commit 539a61662de6278f7841c7e9b86d9d17d5e5b492 Subproject commit 7794ada45e02d5f5ee698765ddb1a1bb6154bee2

View File

@ -26,7 +26,7 @@ service lxc-ckan-redis start
# Configure Solr # Configure Solr
mkdir -p /srv/ckan/solr_data 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 chown -R 108983:108983 /srv/ckan/solr_data
service lxc-ckan-solr start service lxc-ckan-solr start

View File

@ -17,9 +17,7 @@ service lxc-crisiscleanup-postgres start
envsubst <createdb.sql | lxc-attach -u 5432 -g 5432 crisiscleanup-postgres -- psql envsubst <createdb.sql | lxc-attach -u 5432 -g 5432 crisiscleanup-postgres -- psql
# Copy existing config files into persistent storage # Copy existing config files into persistent storage
mkdir -p /srv/crisiscleanup/cc_conf lxchelper extract crisiscleanup /srv/crisiscleanup/config /srv/crisiscleanup/cc_conf
chown 108080:108080 /srv/crisiscleanup/cc_conf
lxc-execute crisiscleanup -- tar -cC /srv/crisiscleanup/config . | tar -xC /srv/crisiscleanup/cc_conf
# Configure CrisisCleanup # Configure CrisisCleanup
export CRISISCLEANUP_ADMIN_USER="Admin" export CRISISCLEANUP_ADMIN_USER="Admin"

View File

@ -17,9 +17,7 @@ service lxc-cts-postgres start
envsubst <createdb.sql | lxc-attach -u 5432 -g 5432 cts-postgres -- psql envsubst <createdb.sql | lxc-attach -u 5432 -g 5432 cts-postgres -- psql
# Copy existing config files into persistent storage # Copy existing config files into persistent storage
mkdir -p /srv/cts/cts_conf lxchelper extract cts /srv/cts/cts/settings /srv/cts/cts_conf
chown 108080:108080 /srv/cts/cts_conf
lxc-execute cts -- tar -cC /srv/cts/cts/settings . | tar -xC /srv/cts/cts_conf
# Configure CTS # Configure CTS
export CTS_SECRET=$(head -c 26 /dev/urandom | base64 | tr -d '+/=') export CTS_SECRET=$(head -c 26 /dev/urandom | base64 | tr -d '+/=')

View File

@ -17,9 +17,7 @@ service lxc-decidim-postgres start
envsubst <createdb.sql | lxc-attach -u 5432 -g 5432 decidim-postgres -- psql envsubst <createdb.sql | lxc-attach -u 5432 -g 5432 decidim-postgres -- psql
# Copy existing config files into persistent storage # Copy existing config files into persistent storage
mkdir -p /srv/decidim/decidim_conf lxchelper extract decidim /srv/decidim-app/config /srv/decidim/decidim_conf
chown 108080:108080 /srv/decidim/decidim_conf
lxc-execute decidim -- tar -cC /srv/decidim-app/config . | tar -xC /srv/decidim/decidim_conf
# Configure Decidim # Configure Decidim
export DECIDIM_SECRET=$(lxc-execute decidim -- rake secret) export DECIDIM_SECRET=$(lxc-execute decidim -- rake secret)

View File

@ -4,10 +4,12 @@ set -ev
# Configure OpenMapKit # Configure OpenMapKit
export OPENMAPKIT_ADMIN_USER="admin" export OPENMAPKIT_ADMIN_USER="admin"
export OPENMAPKIT_ADMIN_PWD=$(head -c 12 /dev/urandom | base64 | tr -d '+/=') export OPENMAPKIT_ADMIN_PWD=$(head -c 12 /dev/urandom | base64 | tr -d '+/=')
mkdir -p /srv/openmapkit/omk_conf /srv/openmapkit/omk_data mkdir -p /srv/openmapkit/omk_conf
chown -R 108080:108080 /srv/openmapkit/omk_conf /srv/openmapkit/omk_data chown -R 108080:108080 /srv/openmapkit/omk_conf
lxc-execute openmapkit -- tar -cC /srv/openmapkit/data . | tar -xC /srv/openmapkit/omk_data
envsubst <omk_conf/settings.js >/srv/openmapkit/omk_conf/settings.js envsubst <omk_conf/settings.js >/srv/openmapkit/omk_conf/settings.js
# Copy existing files into persistent storage
lxchelper extract openmapkit /srv/openmapkit/data /srv/openmapkit/omk_data
# Register application # Register application
vmmgr register-app openmapkit omk "${OPENMAPKIT_ADMIN_USER}" "${OPENMAPKIT_ADMIN_PWD}" vmmgr register-app openmapkit omk "${OPENMAPKIT_ADMIN_USER}" "${OPENMAPKIT_ADMIN_PWD}"

View File

@ -30,12 +30,7 @@ lxc-attach pandora-rabbitmq -- rabbitmqctl set_permissions -p /pandora pandora "
# Configure Pandora # Configure Pandora
mkdir -p /srv/pandora/pandora_conf /srv/pandora/pandora_data mkdir -p /srv/pandora/pandora_conf /srv/pandora/pandora_data
chown 108080:108080 /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 cp pandora_conf/config.jsonc /srv/pandora/pandora_conf/config.jsonc
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/gunicorn_config.py /srv/pandora/pandora_conf/gunicorn_config.py cp pandora_conf/gunicorn_config.py /srv/pandora/pandora_conf/gunicorn_config.py
envsubst <pandora_conf/local_settings.py >/srv/pandora/pandora_conf/local_settings.py envsubst <pandora_conf/local_settings.py >/srv/pandora/pandora_conf/local_settings.py
chown -R 108080:108080 /srv/pandora/pandora_conf chown -R 108080:108080 /srv/pandora/pandora_conf

View File

@ -17,10 +17,10 @@ service lxc-sahana-demo-postgres start
envsubst <createdb.sql | lxc-attach -u 5432 -g 5432 sahana-demo-postgres -- psql envsubst <createdb.sql | lxc-attach -u 5432 -g 5432 sahana-demo-postgres -- psql
# Prepare persistent directory structure # Prepare persistent directory structure
mkdir -p /srv/sahana-demo/sahana_conf /srv/sahana-demo/sahana_data/databases /srv/sahana-demo/sahana_data/uploads /srv/sahana-demo/sahana_data/default mkdir -p /srv/sahana-demo/sahana_data/databases /srv/sahana-demo/sahana_data/uploads
chown -R 108080:108080 /srv/sahana-demo/sahana_conf /srv/sahana-demo/sahana_data chown -R 108080:108080 /srv/sahana-demo/sahana_data
lxc-execute sahana-demo -- tar -cC /srv/web2py/applications/eden/models . | tar -xC /srv/sahana-demo/sahana_conf lxchelper extract sahana-demo /srv/web2py/applications/eden/models /srv/sahana-demo/sahana_conf
lxc-execute sahana-demo -- tar -cC /srv/web2py/applications/eden/modules/templates/default . | tar -xC /srv/sahana-demo/sahana_data/default lxchelper extract sahana-demo /srv/web2py/applications/eden/modules/templates/default /srv/sahana-demo/sahana_data/default
# Configure Sahana # Configure Sahana
export SAHANADEMO_HMAC=$(head -c 18 /dev/urandom | base64 | tr -d '+/=') export SAHANADEMO_HMAC=$(head -c 18 /dev/urandom | base64 | tr -d '+/=')

View File

@ -17,9 +17,9 @@ service lxc-sahana-postgres start
envsubst <createdb.sql | lxc-attach -u 5432 -g 5432 sahana-postgres -- psql envsubst <createdb.sql | lxc-attach -u 5432 -g 5432 sahana-postgres -- psql
# Prepare persistent directory structure # Prepare persistent directory structure
mkdir -p /srv/sahana/sahana_conf /srv/sahana/sahana_data/databases /srv/sahana/sahana_data/uploads mkdir -p /srv/sahana/sahana_data/databases /srv/sahana/sahana_data/uploads
chown -R 108080:108080 /srv/sahana/sahana_conf /srv/sahana/sahana_data chown -R 108080:108080 /srv/sahana/sahana_data
lxc-execute sahana -- tar -cC /srv/web2py/applications/eden/models . | tar -xC /srv/sahana/sahana_conf lxchelper extract sahana /srv/web2py/applications/eden/models /srv/sahana/sahana_conf
# Copy Spotter template # Copy Spotter template
cp -r sahana_data/Spotter /srv/sahana/sahana_data/ cp -r sahana_data/Spotter /srv/sahana/sahana_data/

View File

@ -17,10 +17,10 @@ service lxc-sambro-postgres start
envsubst <createdb.sql | lxc-attach -u 5432 -g 5432 sambro-postgres -- psql envsubst <createdb.sql | lxc-attach -u 5432 -g 5432 sambro-postgres -- psql
# Prepare persistent directory structure # Prepare persistent directory structure
mkdir -p /srv/sambro/sahana_conf /srv/sambro/sahana_data/databases /srv/sambro/sahana_data/uploads /srv/sambro/sahana_data/SAMBRO mkdir -p /srv/sambro/sahana_data/databases /srv/sambro/sahana_data/uploads
chown -R 108080:108080 /srv/sambro/sahana_conf /srv/sambro/sahana_data chown -R 108080:108080 /srv/sambro/sahana_data
lxc-execute sambro -- tar -cC /srv/web2py/applications/eden/models . | tar -xC /srv/sambro/sahana_conf lxchelper extract sambro /srv/web2py/applications/eden/models /srv/sambro/sahana_conf
lxc-execute sambro -- tar -cC /srv/web2py/applications/eden/modules/templates/SAMBRO . | tar -xC /srv/sambro/sahana_data/SAMBRO lxchelper extract sambro /srv/web2py/applications/eden/modules/templates/SAMBRO /srv/sambro/sahana_data/SAMBRO
# Configure SAMBRO # Configure SAMBRO
export SAMBRO_HMAC=$(head -c 18 /dev/urandom | base64 | tr -d '+/=') export SAMBRO_HMAC=$(head -c 18 /dev/urandom | base64 | tr -d '+/=')

View File

@ -19,11 +19,8 @@ lxc-execute seeddms -- cat /srv/seeddms/create_tables-postgres.sql | lxc-attach
cat custom.sql | lxc-attach -u 5432 -g 5432 seeddms-postgres -- psql seeddms cat custom.sql | lxc-attach -u 5432 -g 5432 seeddms-postgres -- psql seeddms
# Copy existing files into persistent storage # Copy existing files into persistent storage
mkdir -p /srv/seeddms/seeddms_conf /srv/seeddms/seeddms)data lxchelper extract seeddms /srv/seeddms/conf /srv/seeddms/seeddms_conf
chown 108080:108080 /srv/seeddms/conf lxchelper extract seeddms /srv/seeddms/data /srv/seeddms/seeddms_data
chown 108080:108080 /srv/seeddms/data
lxc-execute seeddms -- tar -cC /srv/seeddms/conf . | tar -xC /srv/seeddms/seeddms_conf
lxc-execute seeddms -- tar -cC /srv/seeddms/data . | tar -xC /srv/seeddms/seeddms_data
# Configure SeedDMS # Configure SeedDMS
envsubst <seeddms_conf/settings.xml >/srv/seeddms/seeddms_conf/settings.xml envsubst <seeddms_conf/settings.xml >/srv/seeddms/seeddms_conf/settings.xml

View File

@ -22,26 +22,24 @@ chown -R 108080:108080 /srv/sigmah/sigmah_data
envsubst <sigmah_conf/persistence.xml >/srv/sigmah/sigmah_conf/persistence.xml envsubst <sigmah_conf/persistence.xml >/srv/sigmah/sigmah_conf/persistence.xml
cp sigmah_conf/sigmah.properties /srv/sigmah/sigmah_conf/sigmah.properties cp sigmah_conf/sigmah.properties /srv/sigmah/sigmah_conf/sigmah.properties
chown -R 108080:108080 /srv/sigmah/sigmah_conf 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 # 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_USER=Admin
export SIGMAH_ADMIN_EMAIL=admin@example.com export SIGMAH_ADMIN_EMAIL=admin@example.com
export SIGMAH_ADMIN_PWD=$(head -c 12 /dev/urandom | base64 | tr -d '+/=') 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())") 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 lxc-execute sigmah -- cat /srv/sigmah-MinimumDataKit.sql | lxc-attach sigmah-postgres -- sh -c "PGPASSWORD=${SIGMAH_PWD} psql -U sigmah sigmah"
sed -i "s|§OrganizationLogoFilename§|logo.png|g" /tmp/sigmah-newOrganizationLaunchScript.sql lxc-execute sigmah -- cat /srv/sigmah-newOrganizationLaunchScript.sql | \
sed -i "s|§HeadquartersCountryCode§|CZ|g" /tmp/sigmah-newOrganizationLaunchScript.sql sed -e "s|§OrganizationName§|Demo organization|g" \
sed -i "s|§UserEmail§|${SIGMAH_ADMIN_EMAIL}|g" /tmp/sigmah-newOrganizationLaunchScript.sql -e "s|§OrganizationLogoFilename§|logo.png|g" \
sed -i "s|§UserName§|${SIGMAH_ADMIN_USER}|g" /tmp/sigmah-newOrganizationLaunchScript.sql -e "s|§HeadquartersCountryCode§|CZ|g" \
sed -i "s|§UserFirstName§|${SIGMAH_ADMIN_USER}|g" /tmp/sigmah-newOrganizationLaunchScript.sql -e "s|§UserEmail§|${SIGMAH_ADMIN_EMAIL}|g" \
sed -i "s|§UserLocale§|en|g" /tmp/sigmah-newOrganizationLaunchScript.sql -e "s|§UserName§|${SIGMAH_ADMIN_USER}|g" \
sed -i "s|\$2a\$10\$pMcTA1p9fefR8U9NoOPei.H0eq/TbbdSF27M0tn9iDWBrA4JHeCDC|${SIGMAH_ADMIN_HASH}|" /tmp/sigmah-newOrganizationLaunchScript.sql -e "s|§UserFirstName§|${SIGMAH_ADMIN_USER}|g" \
cat /tmp/sigmah-MinimumDataKit.sql | lxc-attach sigmah-postgres -- sh -c "PGPASSWORD=${SIGMAH_PWD} psql -U sigmah sigmah" -e "s|§UserLocale§|en|g" \
cat /tmp/sigmah-newOrganizationLaunchScript.sql | lxc-attach sigmah-postgres -- sh -c "PGPASSWORD=${SIGMAH_PWD} psql -U sigmah sigmah" -e "s|\$2a\$10\$pMcTA1p9fefR8U9NoOPei.H0eq/TbbdSF27M0tn9iDWBrA4JHeCDC|${SIGMAH_ADMIN_HASH}|" \
rm -f /tmp/sigmah-MinimumDataKit.sql /tmp/sigmah-newOrganizationLaunchScript.sql | lxc-attach sigmah-postgres -- sh -c "PGPASSWORD=${SIGMAH_PWD} psql -U sigmah sigmah"
# Install config update script # Install config update script
cp update-conf.sh /srv/sigmah/update-conf.sh cp update-conf.sh /srv/sigmah/update-conf.sh
@ -51,5 +49,3 @@ service lxc-sigmah-postgres stop
# Register application # Register application
vmmgr register-app sigmah sigmah "${SIGMAH_ADMIN_EMAIL}" "${SIGMAH_ADMIN_PWD}" vmmgr register-app sigmah sigmah "${SIGMAH_ADMIN_EMAIL}" "${SIGMAH_ADMIN_PWD}"
# TODO: SQL skripty jako soucast installu?