Make EgoGIS SPOC-compatible

This commit is contained in:
Disassembler 2020-03-17 10:43:46 +01:00
parent be4042d7e4
commit 5782083921
No known key found for this signature in database
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 IMAGE ecogis_2.10.1-200313
FROM alpine3.8-php5.6_5.6.40-190620 FROM alpine3.8-php5.6_5.6.40-200313
RUN EOF RUN EOF
# Install runtime dependencies # Install runtime dependencies
@ -30,6 +30,6 @@ RUN EOF
rm -rf /usr/bin/composer /tmp/.composer rm -rf /usr/bin/composer /tmp/.composer
EOF EOF
COPY lxc COPY image.d
CMD /bin/s6-svscan /etc/services.d CMD /bin/s6-svscan /etc/services.d

View File

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