Make Sigmah SPOC-compatible
This commit is contained in:
parent
236c15dbac
commit
ecfafd0c4a
27
lxc-apps/sigmah/app
Normal file
27
lxc-apps/sigmah/app
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
{
|
||||||
|
"version": "2.0.2-200313",
|
||||||
|
"meta": {
|
||||||
|
"title": "Sigmah",
|
||||||
|
"desc-cs": "Finanční řízení sbírek",
|
||||||
|
"desc-en": "Donation management",
|
||||||
|
"license": "GPL"
|
||||||
|
},
|
||||||
|
"containers": {
|
||||||
|
"sigmah": {
|
||||||
|
"image": "sigmah_2.0.2-200313",
|
||||||
|
"depends": [
|
||||||
|
"sigmah-postgres"
|
||||||
|
],
|
||||||
|
"mounts": {
|
||||||
|
"sigmah/sigmah_conf": "srv/sigmah/conf",
|
||||||
|
"sigmah/sigmah_data": "srv/sigmah/data"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sigmah-postgres": {
|
||||||
|
"image": "postgres_12.2.0-200313",
|
||||||
|
"mounts": {
|
||||||
|
"sigmah/postgres_data": "var/lib/postgresql"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,5 +1,5 @@
|
|||||||
IMAGE sigmah_2.0.2-190620
|
IMAGE sigmah_2.0.2-200313
|
||||||
FROM alpine3.9-tomcat8.5_8.5.41-190620
|
FROM alpine3.11-tomcat8.5_8.5.51-200313
|
||||||
|
|
||||||
RUN EOF
|
RUN EOF
|
||||||
# Download Sigmah
|
# Download Sigmah
|
||||||
@ -25,8 +25,8 @@ RUN EOF
|
|||||||
rm /tmp/sigmah.war
|
rm /tmp/sigmah.war
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
COPY lxc
|
COPY image.d
|
||||||
|
|
||||||
USER 8080 8080
|
USER tomcat
|
||||||
WORKDIR /srv/tomcat
|
WORKDIR /srv/tomcat
|
||||||
CMD /usr/bin/catalina.sh run
|
CMD /usr/bin/catalina.sh run
|
@ -1,36 +1,40 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
set -ev
|
set -ev
|
||||||
|
|
||||||
|
# Volumes
|
||||||
|
POSTGRES_DATA="${VOLUMES_DIR}/sigmah/postgres_data"
|
||||||
|
SIGMAH_DATA="${VOLUMES_DIR}/sigmah/sigmah_data"
|
||||||
|
SIGMAH_CONF="${VOLUMES_DIR}/sigmah/sigmah_conf"
|
||||||
|
SIGMAH_LAYER="${LAYERS_DIR}/sigmah_2.0.2-200313"
|
||||||
|
|
||||||
# Create Postgres instance
|
# Create Postgres instance
|
||||||
mkdir -p /srv/sigmah/postgres_data
|
install -o 105432 -g 105432 -m 700 -d ${POSTGRES_DATA}
|
||||||
chown -R 105432:105432 /srv/sigmah/postgres_data
|
spoc-container exec sigmah-postgres -- initdb -D /var/lib/postgresql
|
||||||
chmod 700 /srv/sigmah/postgres_data
|
|
||||||
lxc-execute -n sigmah-postgres -- initdb -D /var/lib/postgresql
|
|
||||||
|
|
||||||
# Configure Postgres
|
# Configure Postgres
|
||||||
cp postgres_data/postgresql.conf /srv/sigmah/postgres_data/postgresql.conf
|
install -o 105432 -g 105432 -m 600 postgres_data/postgresql.conf ${POSTGRES_DATA}/postgresql.conf
|
||||||
cp postgres_data/pg_hba.conf /srv/sigmah/postgres_data/pg_hba.conf
|
install -o 105432 -g 105432 -m 600 postgres_data/pg_hba.conf ${POSTGRES_DATA}/pg_hba.conf
|
||||||
|
|
||||||
# Create database
|
# Create database
|
||||||
export SIGMAH_PWD=$(head -c 18 /dev/urandom | base64 | tr -d '+/=')
|
export SIGMAH_PWD=$(head -c 18 /dev/urandom | base64 | tr -d '+/=')
|
||||||
service lxc-sigmah-postgres start
|
spoc-container start sigmah-postgres
|
||||||
envsubst <createdb.sql | lxc-attach -u 5432 -g 5432 sigmah-postgres -- psql
|
envsubst <createdb.sql | spoc-container exec sigmah-postgres -- psql
|
||||||
|
|
||||||
# Configure Sigmah
|
# Configure Sigmah
|
||||||
mkdir -p /srv/sigmah/sigmah_conf /srv/sigmah/sigmah_data/files /srv/sigmah/sigmah_data/archives
|
install -o 108080 -g 108080 -m 750 -d ${SIGMAH_CONF}
|
||||||
chown -R 108080:108080 /srv/sigmah/sigmah_data
|
install -o 108080 -g 108080 -m 750 -d ${SIGMAH_DATA}/files
|
||||||
envsubst <sigmah_conf/persistence.xml >/srv/sigmah/sigmah_conf/persistence.xml
|
install -o 108080 -g 108080 -m 750 -d ${SIGMAH_DATA}/archives
|
||||||
cp sigmah_conf/sigmah.properties /srv/sigmah/sigmah_conf/sigmah.properties
|
envsubst <sigmah_conf/persistence.xml | install -o 108080 -g 108080 -m 640 /dev/stdin ${SIGMAH_CONF}/persistence.xml
|
||||||
chown -R 108080:108080 /srv/sigmah/sigmah_conf
|
install -o 108080 -g 108080 -m 640 sigmah_conf/sigmah.properties ${SIGMAH_CONF}/sigmah.properties
|
||||||
lxchelper extract sigmah /srv/tomcat/webapps/sigmah/sigmah/images/header/org-default-logo.png /srv/sigmah/sigmah_data/files/logo.png
|
cp -p ${SIGMAH_LAYER}/srv/tomcat/webapps/sigmah/sigmah/images/header/org-default-logo.png ${SIGMAH_DATA}/files/logo.png
|
||||||
|
|
||||||
# Populate database
|
# Populate database
|
||||||
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())")
|
||||||
lxc-execute sigmah -- cat /srv/sigmah-MinimumDataKit.sql | lxc-attach sigmah-postgres -- sh -c "PGPASSWORD=${SIGMAH_PWD} psql -U sigmah sigmah"
|
spoc-container exec sigmah -- cat /srv/sigmah-MinimumDataKit.sql | spoc-container exec sigmah-postgres -- sh -c "PGPASSWORD=${SIGMAH_PWD} psql -U sigmah sigmah"
|
||||||
lxc-execute sigmah -- cat /srv/sigmah-newOrganizationLaunchScript.sql | \
|
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" \
|
||||||
@ -39,13 +43,10 @@ lxc-execute 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}|" \
|
||||||
| lxc-attach sigmah-postgres -- sh -c "PGPASSWORD=${SIGMAH_PWD} psql -U sigmah sigmah"
|
| spoc-container exec sigmah-postgres -- sh -c "PGPASSWORD=${SIGMAH_PWD} psql -U sigmah sigmah"
|
||||||
|
|
||||||
# Install config update script
|
|
||||||
cp update-conf.sh /srv/sigmah/update-conf.sh
|
|
||||||
|
|
||||||
# Stop services required for setup
|
# Stop services required for setup
|
||||||
service lxc-sigmah-postgres stop
|
spoc-container stop sigmah-postgres
|
||||||
|
|
||||||
# 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}"
|
||||||
|
@ -1,27 +0,0 @@
|
|||||||
{
|
|
||||||
"version": "2.0.2-190620",
|
|
||||||
"meta": {
|
|
||||||
"title": "Sigmah",
|
|
||||||
"desc-cs": "Finanční řízení sbírek",
|
|
||||||
"desc-en": "Donation management",
|
|
||||||
"license": "GPL"
|
|
||||||
},
|
|
||||||
"containers": {
|
|
||||||
"sigmah": {
|
|
||||||
"image": "sigmah_2.0.2-190620",
|
|
||||||
"depends": [
|
|
||||||
"sigmah-postgres"
|
|
||||||
],
|
|
||||||
"mounts": [
|
|
||||||
["DIR", "/srv/sigmah/sigmah_conf", "/srv/sigmah/conf"],
|
|
||||||
["DIR", "/srv/sigmah/sigmah_data", "/srv/sigmah/data"]
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"sigmah-postgres": {
|
|
||||||
"image": "postgres_11.3.0-190620",
|
|
||||||
"mounts": [
|
|
||||||
["DIR", "/srv/sigmah/postgres_data", "/var/lib/postgresql"]
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -2,7 +2,7 @@
|
|||||||
set -ev
|
set -ev
|
||||||
|
|
||||||
# Remove persistent data
|
# Remove persistent data
|
||||||
rm -rf /srv/sigmah
|
rm -rf "${VOLUMES_DIR}/sigmah"
|
||||||
|
|
||||||
# Unregister application
|
# Unregister application
|
||||||
vmmgr unregister-app sigmah
|
vmmgr unregister-app sigmah
|
||||||
|
Loading…
Reference in New Issue
Block a user