diff --git a/lxc-apps/crisiscleanup/app b/lxc-apps/crisiscleanup/app new file mode 100644 index 0000000..ec8e297 --- /dev/null +++ b/lxc-apps/crisiscleanup/app @@ -0,0 +1,26 @@ +{ + "version": "2.2.0-200313", + "meta": { + "title": "Crisis Cleanup", + "desc-cs": "Mapování následků katastrof", + "desc-en": "Disaster relief mapping", + "license": "GPL" + }, + "containers": { + "crisiscleanup": { + "image": "crisiscleanup_2.2.0-200313", + "depends": [ + "crisiscleanup-postgres" + ], + "mounts": { + "crisiscleanup/cc_conf": "srv/crisiscleanup/config" + } + }, + "crisiscleanup-postgres": { + "image": "postgres_12.2.0-200313", + "mounts": { + "crisiscleanup/postgres_data": "var/lib/postgresql" + } + } + } +} diff --git a/lxc-apps/crisiscleanup/lxcfile b/lxc-apps/crisiscleanup/image similarity index 85% rename from lxc-apps/crisiscleanup/lxcfile rename to lxc-apps/crisiscleanup/image index cb20a66..cca0d84 100644 --- a/lxc-apps/crisiscleanup/lxcfile +++ b/lxc-apps/crisiscleanup/image @@ -1,5 +1,5 @@ -IMAGE crisiscleanup_2.2.0-190620 -FROM alpine3.8-ruby2.4_2.4.5-190620 +IMAGE crisiscleanup_2.2.0-200313 +FROM alpine3.8-ruby2.4_2.4.9-200313 ENV RAILS_ENV production @@ -11,10 +11,10 @@ RUN EOF apk --no-cache add --virtual .deps build-base git libxml2-dev libxslt-dev linux-headers npm postgresql-dev yarn zlib-dev # Clone CrisisCleanup - git clone --depth 1 https://github.com/CrisisCleanup/crisiscleanup /srv/crisiscleanup + git clone --depth 1 https://github.com/CrisisCleanup/crisiscleanup-2 /srv/crisiscleanup # Hackfix ruby dependency versions - sed -i 's/ruby "2\.4\.4"/ruby "2.4.5"/' /srv/crisiscleanup/Gemfile + sed -i 's/ruby "2\.4\.4"/ruby "2.4.9"/' /srv/crisiscleanup/Gemfile gem install bundler:1.16.6 # Install Ruby and NodeJS dependencies @@ -42,7 +42,7 @@ RUN EOF rm -rf /root/.bundle /root/.config /root/.npm EOF -USER 8080 8080 +USER cc WORKDIR /srv/crisiscleanup -CMD rails server +CMD /usr/local/bin/rails server HALT SIGTERM diff --git a/lxc-apps/crisiscleanup/install.sh b/lxc-apps/crisiscleanup/install.sh index c94929d..7a856a4 100755 --- a/lxc-apps/crisiscleanup/install.sh +++ b/lxc-apps/crisiscleanup/install.sh @@ -1,42 +1,41 @@ #!/bin/sh set -ev +# Volumes +POSTGRES_DATA="${VOLUMES_DIR}/crisiscleanup/postgres_data" +CC_CONF="${VOLUMES_DIR}/crisiscleanup/cc_conf" + # Create Postgres instance -mkdir -p /srv/crisiscleanup/postgres_data -chown -R 105432:105432 /srv/crisiscleanup/postgres_data -chmod 700 /srv/crisiscleanup/postgres_data -lxc-execute -n crisiscleanup-postgres -- initdb -D /var/lib/postgresql +install -o 105432 -g 105432 -m 700 -d ${POSTGRES_DATA} +spoc-container exec crisiscleanup-postgres -- initdb -D /var/lib/postgresql # Configure Postgres -cp postgres_data/postgresql.conf /srv/crisiscleanup/postgres_data/postgresql.conf -cp postgres_data/pg_hba.conf /srv/crisiscleanup/postgres_data/pg_hba.conf +install postgres_data/postgresql.conf ${POSTGRES_DATA}/postgresql.conf +install postgres_data/pg_hba.conf ${POSTGRES_DATA}/pg_hba.conf # Create database export CRISISCLEANUP_PWD=$(head -c 18 /dev/urandom | base64 | tr -d '+/=') -service lxc-crisiscleanup-postgres start -envsubst /srv/crisiscleanup/cc_conf/database.yml -cp cc_conf/boot.rb /srv/crisiscleanup/cc_conf/boot.rb -cp cc_conf/initializers/devise.rb /srv/crisiscleanup/cc_conf/initializers/devise.rb -cp cc_conf/environments/production.rb /srv/crisiscleanup/cc_conf/environments/production.rb +envsubst