From f32b719630776d97aa82b3046cc320bdd6d9e910 Mon Sep 17 00:00:00 2001 From: Disassembler Date: Tue, 17 Mar 2020 09:18:13 +0100 Subject: [PATCH] Make Decidim SPOC-compatible --- lxc-apps/decidim/{meta => app} | 0 lxc-apps/decidim/{lxcfile => image} | 7 ++-- .../{lxc => image.d}/etc/crontabs/decidim | 0 .../{lxc => image.d}/etc/nginx/nginx.conf | 0 .../etc/services.d/.s6-svscan/finish | 0 .../{lxc => image.d}/etc/services.d/cron/run | 0 .../{lxc => image.d}/etc/services.d/nginx/run | 0 .../{lxc => image.d}/srv/decidim-app/Gemfile | 0 lxc-apps/decidim/install.sh | 42 +++++++++---------- lxc-apps/decidim/uninstall.sh | 2 +- 10 files changed, 26 insertions(+), 25 deletions(-) rename lxc-apps/decidim/{meta => app} (100%) rename lxc-apps/decidim/{lxcfile => image} (95%) rename lxc-apps/decidim/{lxc => image.d}/etc/crontabs/decidim (100%) rename lxc-apps/decidim/{lxc => image.d}/etc/nginx/nginx.conf (100%) rename lxc-apps/decidim/{lxc => image.d}/etc/services.d/.s6-svscan/finish (100%) rename lxc-apps/decidim/{lxc => image.d}/etc/services.d/cron/run (100%) rename lxc-apps/decidim/{lxc => image.d}/etc/services.d/nginx/run (100%) rename lxc-apps/decidim/{lxc => image.d}/srv/decidim-app/Gemfile (100%) diff --git a/lxc-apps/decidim/meta b/lxc-apps/decidim/app similarity index 100% rename from lxc-apps/decidim/meta rename to lxc-apps/decidim/app diff --git a/lxc-apps/decidim/lxcfile b/lxc-apps/decidim/image similarity index 95% rename from lxc-apps/decidim/lxcfile rename to lxc-apps/decidim/image index 3c312d7..370fbb0 100644 --- a/lxc-apps/decidim/lxcfile +++ b/lxc-apps/decidim/image @@ -1,5 +1,5 @@ -IMAGE decidim_0.20.0-191113 -FROM alpine3.9-ruby2.6_2.6.3-190620 +IMAGE decidim_0.20.0-200313 +FROM alpine3.11-ruby2.6_2.6.5-200313 # https://github.com/Platoniq/decidim-install/blob/master/decidim-bionic.md # https://github.com/Platoniq/decidim-install/blob/master/basic-config.md @@ -50,12 +50,13 @@ RUN EOF # Install Decidim bundle config build.nokogiri --use-system-libraries + gem install bundler:1.17.3 gem install decidim cd /srv decidim decidim-app EOF -COPY lxc +COPY image.d RUN EOF # Install gems required by decidim diff --git a/lxc-apps/decidim/lxc/etc/crontabs/decidim b/lxc-apps/decidim/image.d/etc/crontabs/decidim similarity index 100% rename from lxc-apps/decidim/lxc/etc/crontabs/decidim rename to lxc-apps/decidim/image.d/etc/crontabs/decidim diff --git a/lxc-apps/decidim/lxc/etc/nginx/nginx.conf b/lxc-apps/decidim/image.d/etc/nginx/nginx.conf similarity index 100% rename from lxc-apps/decidim/lxc/etc/nginx/nginx.conf rename to lxc-apps/decidim/image.d/etc/nginx/nginx.conf diff --git a/lxc-apps/decidim/lxc/etc/services.d/.s6-svscan/finish b/lxc-apps/decidim/image.d/etc/services.d/.s6-svscan/finish similarity index 100% rename from lxc-apps/decidim/lxc/etc/services.d/.s6-svscan/finish rename to lxc-apps/decidim/image.d/etc/services.d/.s6-svscan/finish diff --git a/lxc-apps/decidim/lxc/etc/services.d/cron/run b/lxc-apps/decidim/image.d/etc/services.d/cron/run similarity index 100% rename from lxc-apps/decidim/lxc/etc/services.d/cron/run rename to lxc-apps/decidim/image.d/etc/services.d/cron/run diff --git a/lxc-apps/decidim/lxc/etc/services.d/nginx/run b/lxc-apps/decidim/image.d/etc/services.d/nginx/run similarity index 100% rename from lxc-apps/decidim/lxc/etc/services.d/nginx/run rename to lxc-apps/decidim/image.d/etc/services.d/nginx/run diff --git a/lxc-apps/decidim/lxc/srv/decidim-app/Gemfile b/lxc-apps/decidim/image.d/srv/decidim-app/Gemfile similarity index 100% rename from lxc-apps/decidim/lxc/srv/decidim-app/Gemfile rename to lxc-apps/decidim/image.d/srv/decidim-app/Gemfile diff --git a/lxc-apps/decidim/install.sh b/lxc-apps/decidim/install.sh index 58362b2..143967a 100755 --- a/lxc-apps/decidim/install.sh +++ b/lxc-apps/decidim/install.sh @@ -1,45 +1,45 @@ #!/bin/sh set -ev +# Volumes +POSTGRES_DATA="${VOLUMES_DIR}/decidim/postgres_data" +DECIDIM_CONF="${VOLUMES_DIR}/decidim/decidim_conf" +DECIDIM_DATA="${VOLUMES_DIR}/decidim/decidim_data" + # Create Postgres instance -mkdir -p /srv/decidim/postgres_data -chown -R 105432:105432 /srv/decidim/postgres_data -chmod 700 /srv/decidim/postgres_data -lxc-execute -n decidim-postgres -- initdb -D /var/lib/postgresql +install -o 105432 -g 105432 -m 700 -d ${POSTGRES_DATA} +spoc-container exec decidim-postgres -- initdb -D /var/lib/postgresql # Configure Postgres -cp postgres_data/postgresql.conf /srv/decidim/postgres_data/postgresql.conf -cp postgres_data/pg_hba.conf /srv/decidim/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 # Create database export DECIDIM_PWD=$(head -c 18 /dev/urandom | base64 | tr -d '+/=') -service lxc-decidim-postgres start -envsubst /srv/decidim/decidim_conf/application.yml +install -o 108080 -g 108080 -m 700 ${DECIDIM_DATA}/storage +install -o 108080 -g 108080 -m 700 ${DECIDIM_DATA}/uploads +export DECIDIM_SECRET=$(spoc-container exec -u 8080 -g 8080 decidim -- sh -c 'cd /srv/decidim-app; rake secret') +install -o 108080 -g 108080 -m 640 decidim_conf/environments/production.rb ${DECIDIM_CONF}/environments/production.rb +install -o 108080 -g 108080 -m 640 decidim_conf/initializers/decidim.rb ${DECIDIM_CONF}/initializers/decidim.rb +envsubst