Make Sigmah SPOC-compatible, cont'd

This commit is contained in:
Disassembler 2020-03-23 16:08:21 +01:00
parent ecfafd0c4a
commit bd70f07f8b
No known key found for this signature in database
GPG Key ID: 524BD33A0EE29499

View File

@ -22,6 +22,7 @@ envsubst <createdb.sql | spoc-container exec sigmah-postgres -- psql
# Configure Sigmah # Configure Sigmah
install -o 108080 -g 108080 -m 750 -d ${SIGMAH_CONF} install -o 108080 -g 108080 -m 750 -d ${SIGMAH_CONF}
install -o 108080 -g 108080 -m 750 -d ${SIGMAH_DATA}
install -o 108080 -g 108080 -m 750 -d ${SIGMAH_DATA}/files install -o 108080 -g 108080 -m 750 -d ${SIGMAH_DATA}/files
install -o 108080 -g 108080 -m 750 -d ${SIGMAH_DATA}/archives install -o 108080 -g 108080 -m 750 -d ${SIGMAH_DATA}/archives
envsubst <sigmah_conf/persistence.xml | install -o 108080 -g 108080 -m 640 /dev/stdin ${SIGMAH_CONF}/persistence.xml envsubst <sigmah_conf/persistence.xml | install -o 108080 -g 108080 -m 640 /dev/stdin ${SIGMAH_CONF}/persistence.xml
@ -33,9 +34,8 @@ 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())")
spoc-container exec sigmah -- cat /srv/sigmah-MinimumDataKit.sql | spoc-container exec sigmah-postgres -- sh -c "PGPASSWORD=${SIGMAH_PWD} psql -U sigmah sigmah" cat ${SIGMAH_LAYER}/srv/sigmah-MinimumDataKit.sql | spoc-container exec sigmah-postgres -- sh -c "PGPASSWORD=${SIGMAH_PWD} psql -U sigmah sigmah"
spoc-container exec sigmah -- cat /srv/sigmah-newOrganizationLaunchScript.sql | \ sed -e "s|§OrganizationName§|Demo organization|g" \
sed -e "s|§OrganizationName§|Demo organization|g" \
-e "s|§OrganizationLogoFilename§|logo.png|g" \ -e "s|§OrganizationLogoFilename§|logo.png|g" \
-e "s|§HeadquartersCountryCode§|CZ|g" \ -e "s|§HeadquartersCountryCode§|CZ|g" \
-e "s|§UserEmail§|${SIGMAH_ADMIN_EMAIL}|g" \ -e "s|§UserEmail§|${SIGMAH_ADMIN_EMAIL}|g" \
@ -43,7 +43,7 @@ spoc-container exec sigmah -- cat /srv/sigmah-newOrganizationLaunchScript.sql |
-e "s|§UserFirstName§|${SIGMAH_ADMIN_USER}|g" \ -e "s|§UserFirstName§|${SIGMAH_ADMIN_USER}|g" \
-e "s|§UserLocale§|en|g" \ -e "s|§UserLocale§|en|g" \
-e "s|\$2a\$10\$pMcTA1p9fefR8U9NoOPei.H0eq/TbbdSF27M0tn9iDWBrA4JHeCDC|${SIGMAH_ADMIN_HASH}|" \ -e "s|\$2a\$10\$pMcTA1p9fefR8U9NoOPei.H0eq/TbbdSF27M0tn9iDWBrA4JHeCDC|${SIGMAH_ADMIN_HASH}|" \
| spoc-container exec sigmah-postgres -- sh -c "PGPASSWORD=${SIGMAH_PWD} psql -U sigmah sigmah" ${SIGMAH_LAYER}/srv/sigmah-newOrganizationLaunchScript.sql | spoc-container exec sigmah-postgres -- sh -c "PGPASSWORD=${SIGMAH_PWD} psql -U sigmah sigmah"
# Stop services required for setup # Stop services required for setup
spoc-container stop sigmah-postgres spoc-container stop sigmah-postgres