Make EgoGIS SPOC-compatible

This commit is contained in:
Disassembler 2020-03-17 10:43:46 +01:00
parent be4042d7e4
commit 5782083921
Signed by: Disassembler
GPG Key ID: 524BD33A0EE29499
10 changed files with 46 additions and 43 deletions

27
lxc-apps/ecogis/app Normal file
View File

@ -0,0 +1,27 @@
{
"version": "2.10.1-200313",
"meta": {
"title": "EcoGIS",
"desc-cs": "EcoGIS",
"desc-en": "EcoGIS",
"license": "GPL"
},
"containers": {
"ecogis": {
"image": "ecogis_2.10.1-200313",
"depends": [
"ecogis-postgres"
],
"mounts": {
"ecogis/ecogis_data": "srv/ecogis/data/files",
"ecogis/ecogis_conf/config.php": "srv/ecogis/etc/config.php:file"
}
},
"ecogis-postgres": {
"image": "postgres_11.3.0-190620",
"mounts": {
"ecogis/postgres_data": "var/lib/postgresql"
}
}
}
}

View File

@ -1,5 +1,5 @@
IMAGE ecogis_0.0.1-190620
FROM alpine3.8-php5.6_5.6.40-190620
IMAGE ecogis_2.10.1-200313
FROM alpine3.8-php5.6_5.6.40-200313
RUN EOF
# Install runtime dependencies
@ -30,6 +30,6 @@ RUN EOF
rm -rf /usr/bin/composer /tmp/.composer
EOF
COPY lxc
COPY image.d
CMD /bin/s6-svscan /etc/services.d

View File

@ -1,28 +1,31 @@
#!/bin/sh
set -ev
# Volumes
POSTGRES_DATA="${VOLUMES_DIR}/ecogis/postgres_data"
ECOGIS_CONF="${VOLUMES_DIR}/ecogis/ecogis_conf"
ECOGIS_DATA="${VOLUMES_DIR}/ecogis/ecogis_data"
# Create Postgres instance
mkdir -p /srv/ecogis/postgres_data
chown -R 105432:105432 /srv/ecogis/postgres_data
chmod 700 /srv/ecogis/postgres_data
lxc-execute -n ecogis-postgres -- initdb -D /var/lib/postgresql
install -o 105432 -g 105432 -m 700 -d ${POSTGRES_DATA}
spoc-container exec cts-postgres -- initdb -D /var/lib/postgresql
# Configure Postgres
cp postgres_data/postgresql.conf /srv/ecogis/postgres_data/postgresql.conf
cp postgres_data/pg_hba.conf /srv/ecogis/postgres_data/pg_hba.conf
install -o 105432 -g 105432 -m 600 postgres_data/postgresql.conf ${POSTGRES_DATA}/postgresql.conf
install -o 105432 -g 105432 -m 600 postgres_data/pg_hba.conf ${POSTGRES_DATA}/pg_hba.conf
# Populate database
export ECOGIS_PWD=$(head -c 18 /dev/urandom | base64 | tr -d '+/=')
service lxc-ecogis-postgres start
envsubst <createdb.sql | lxc-attach -u 5432 -g 5432 ecogis-postgres -- psql
spoc-container start ecogis-postgres
envsubst <createdb.sql | spoc-container exec ecogis-postgres -- psql
# Configure EcoGIS
mkdir -p /srv/ecogis/ecogis_conf /srv/ecogis/ecogis_data
envsubst <ecogis_conf/config.php >/srv/ecogis/ecogis_conf/config.php
chown -R 108080:108080 /srv/ecogis/ecogis_conf /srv/ecogis/ecogis_data
install -o 108080 -g 108080 -m 750 ${ECOGIS_CONF}
install -o 108080 -g 108080 -m 750 ${ECOGIS_DATA}
envsubst <ecogis_conf/config.php | install -o 108080 -g 108080 -m 640 /dev/stdin ${ECOGIS_CONF}/config.php
# Stop services required for setup
service lxc-ecogis-postgres stop
spoc-container stop ecogis-postgres
# Register application
vmmgr register-app ecogis ecogis

View File

@ -1,27 +0,0 @@
{
"version": "0.0.1-190620",
"meta": {
"title": "EcoGIS",
"desc-cs": "EcoGIS",
"desc-en": "EcoGIS",
"license": "GPL"
},
"containers": {
"ecogis": {
"image": "ecogis_0.0.1-190620",
"depends": [
"ecogis-postgres"
],
"mounts": [
["DIR", "/srv/ecogis/ecogis_data", "/srv/ecogis/data/files"],
["FILE", "/srv/ecogis/ecogis_conf/config.php", "/srv/ecogis/etc/config.php"]
]
},
"ecogis-postgres": {
"image": "postgres_11.3.0-190620",
"mounts": [
["DIR", "/srv/ecogis/postgres_data", "/var/lib/postgresql"]
]
}
}
}

View File

@ -2,7 +2,7 @@
set -ev
# Remove persistent data
rm -rf /srv/ecogis
rm -rf "${VOLUMES_DIR}/ecogis"
# Unregister application
vmmgr unregister-app ecogis