From 03d56ac0c9bc36d2323b559480106312111eb6e0 Mon Sep 17 00:00:00 2001 From: Disassembler Date: Sat, 21 Nov 2020 09:25:40 +0100 Subject: [PATCH] Bump Ruby to 2.7.2, Decidim to 0.23.1 - Split image to nginx and decidim - Make database migrations persistent, resolves #486 --- build/build-all.sh | 5 +- lxc-apps/decidim/app | 5 +- .../decidim/{image => decidim-nginx.image} | 47 +++++-------------- .../etc/nginx/nginx.conf | 0 .../etc/services.d/.s6-svscan/finish | 0 .../etc/services.d/cron/run | 0 .../etc/services.d/nginx/run | 0 lxc-apps/decidim/decidim.image | 47 +++++++++++++++++++ .../etc/crontabs/decidim | 0 .../srv/decidim-app/Gemfile | 11 +++-- lxc-apps/decidim/install.sh | 7 ++- lxc-apps/decidim/update.sh | 12 +++++ .../image | 4 +- 13 files changed, 91 insertions(+), 47 deletions(-) rename lxc-apps/decidim/{image => decidim-nginx.image} (58%) rename lxc-apps/decidim/{image.d => decidim-nginx.image.d}/etc/nginx/nginx.conf (100%) rename lxc-apps/decidim/{image.d => decidim-nginx.image.d}/etc/services.d/.s6-svscan/finish (100%) rename lxc-apps/decidim/{image.d => decidim-nginx.image.d}/etc/services.d/cron/run (100%) rename lxc-apps/decidim/{image.d => decidim-nginx.image.d}/etc/services.d/nginx/run (100%) create mode 100644 lxc-apps/decidim/decidim.image rename lxc-apps/decidim/{image.d => decidim.image.d}/etc/crontabs/decidim (100%) mode change 100644 => 100755 rename lxc-apps/decidim/{image.d => decidim.image.d}/srv/decidim-app/Gemfile (73%) create mode 100755 lxc-apps/decidim/update.sh rename lxc-shared/{alpine3.12-ruby2.6 => alpine3.12-ruby2.7}/image (92%) diff --git a/build/build-all.sh b/build/build-all.sh index f404c20..dc5a4cb 100755 --- a/build/build-all.sh +++ b/build/build-all.sh @@ -36,7 +36,7 @@ spoc-image build -p alpine3.12-java8/image spoc-image build -p alpine3.12-php7.3/image spoc-image build -p alpine3.12-python3.8/image spoc-image build -p alpine3.12-ruby2.4/image -spoc-image build -p alpine3.12-ruby2.6/image +spoc-image build -p alpine3.12-ruby2.7/image spoc-image build -p alpine3.12-tomcat7/image spoc-image build -p alpine3.12-tomcat8.5/image @@ -63,7 +63,8 @@ spoc-app publish crisiscleanup/app spoc-image build -p cts/image spoc-app publish cts/app -spoc-image build -p decidim/image +spoc-image build -p decidim/decidim-nginx.image +spoc-image build -p decidim/decidim.image spoc-app publish decidim/app spoc-image build -p dhis2/image diff --git a/lxc-apps/decidim/app b/lxc-apps/decidim/app index 530aeea..10bf722 100644 --- a/lxc-apps/decidim/app +++ b/lxc-apps/decidim/app @@ -1,5 +1,5 @@ { - "version": "0.22.0-201021", + "version": "0.23.1-201118", "meta": { "title": "Decidim", "desc-cs": "Platforma pro účast občanů", @@ -8,12 +8,13 @@ }, "containers": { "decidim": { - "image": "decidim_0.22.0-201021", + "image": "decidim_0.23.1-201118", "depends": [ "decidim-postgres" ], "mounts": { "decidim/decidim_conf": "srv/decidim-app/config", + "decidim/decidim_data/migrate": "srv/decidim-app/db/migrate", "decidim/decidim_data/storage": "srv/decidim-app/storage", "decidim/decidim_data/uploads": "srv/decidim-app/public/uploads" } diff --git a/lxc-apps/decidim/image b/lxc-apps/decidim/decidim-nginx.image similarity index 58% rename from lxc-apps/decidim/image rename to lxc-apps/decidim/decidim-nginx.image index cc25935..34b053e 100644 --- a/lxc-apps/decidim/image +++ b/lxc-apps/decidim/decidim-nginx.image @@ -1,21 +1,16 @@ -IMAGE decidim_0.22.0-201021 -FROM alpine3.12-ruby2.6_2.6.6-201021 - -# https://github.com/Platoniq/decidim-install/blob/master/decidim-bionic.md -# https://github.com/Platoniq/decidim-install/blob/master/basic-config.md - -ENV RAILS_ENV production +IMAGE decidim-nginx_1.18.0-201118 +FROM alpine3.12-ruby2.7_2.7.2-201118 RUN EOF # Install runtime dependencies - apk --no-cache add curl imagemagick libpq nodejs pcre procps tzdata + apk --no-cache add curl pcre # Install build dependencies - apk --no-cache add --virtual .deps build-base curl-dev icu-dev libxml2-dev libxslt-dev linux-headers pcre-dev postgresql-dev zlib-dev + apk --no-cache add --virtual .deps build-base curl-dev libressl-dev linux-headers pcre-dev # Install passenger gem install passenger --no-document - ln -s /usr/local/lib/ruby/gems/2.6.0/gems/passenger-* /usr/local/lib/passenger + ln -s /usr/local/lib/ruby/gems/2.7.0/gems/passenger-* /usr/local/lib/passenger # Create OS user addgroup -S -g 8080 decidim @@ -44,40 +39,22 @@ RUN EOF --with-http_gzip_static_module \ --with-http_stub_status_module \ --with-http_addition_module \ + --without-http_fastcgi_module \ + --without-http_memcached_module \ + --without-http_scgi_module \ + --without-http_uwsgi_module \ --with-cc-opt=-Wno-error \ --add-module=/usr/local/lib/passenger/src/nginx_module make -j $(getconf _NPROCESSORS_ONLN) make install rm -f /etc/nginx/*.default - # 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 image.d - -RUN EOF - # Install gems required by decidim - cd /srv/decidim-app - bundle update - - # Setup delayed job for mail sending - bin/rails generate delayed_job:active_record - - # Precompile static assets - bin/rails assets:precompile - - # Change ownership - chown -R decidim:decidim /srv/decidim-app - # Cleanup apk --no-cache del .deps rm -rf /tmp/* - rm -rf /.bundle /root/.gem + rm -rf /.gem EOF +COPY decidim-nginx.image.d + CMD /bin/s6-svscan /etc/services.d diff --git a/lxc-apps/decidim/image.d/etc/nginx/nginx.conf b/lxc-apps/decidim/decidim-nginx.image.d/etc/nginx/nginx.conf similarity index 100% rename from lxc-apps/decidim/image.d/etc/nginx/nginx.conf rename to lxc-apps/decidim/decidim-nginx.image.d/etc/nginx/nginx.conf diff --git a/lxc-apps/decidim/image.d/etc/services.d/.s6-svscan/finish b/lxc-apps/decidim/decidim-nginx.image.d/etc/services.d/.s6-svscan/finish similarity index 100% rename from lxc-apps/decidim/image.d/etc/services.d/.s6-svscan/finish rename to lxc-apps/decidim/decidim-nginx.image.d/etc/services.d/.s6-svscan/finish diff --git a/lxc-apps/decidim/image.d/etc/services.d/cron/run b/lxc-apps/decidim/decidim-nginx.image.d/etc/services.d/cron/run similarity index 100% rename from lxc-apps/decidim/image.d/etc/services.d/cron/run rename to lxc-apps/decidim/decidim-nginx.image.d/etc/services.d/cron/run diff --git a/lxc-apps/decidim/image.d/etc/services.d/nginx/run b/lxc-apps/decidim/decidim-nginx.image.d/etc/services.d/nginx/run similarity index 100% rename from lxc-apps/decidim/image.d/etc/services.d/nginx/run rename to lxc-apps/decidim/decidim-nginx.image.d/etc/services.d/nginx/run diff --git a/lxc-apps/decidim/decidim.image b/lxc-apps/decidim/decidim.image new file mode 100644 index 0000000..5f7ec50 --- /dev/null +++ b/lxc-apps/decidim/decidim.image @@ -0,0 +1,47 @@ +IMAGE decidim_0.23.1-201118 +FROM decidim-nginx_1.18.0-201118 + +# https://github.com/Platoniq/decidim-install/blob/master/decidim-bionic.md +# https://github.com/Platoniq/decidim-install/blob/master/basic-config.md + +ENV RAILS_ENV production + +RUN EOF + # Install runtime dependencies + apk --no-cache add imagemagick libpq nodejs procps tzdata + + # Install build dependencies + apk --no-cache add --virtual .deps build-base git libxml2-dev libxslt-dev postgresql-dev zlib-dev + + # Install Decidim + bundle config build.nokogiri --use-system-libraries + gem install decidim + cd /srv + decidim decidim-app +EOF + +COPY decidim.image.d + +RUN EOF + # Install gems required by decidim + cd /srv/decidim-app + bundle install + + # Setup delayed job for mail sending + bin/rails generate delayed_job:active_record + + # Precompile static assets + bin/rails assets:precompile + + # Remove database migrations (will be recreated in install.sh / update.sh) + rm /srv/decidim-app/db/migrate/* + + # Change ownership + chown -R decidim:decidim /srv/decidim-app + + # Cleanup + apk --no-cache del .deps + rm -rf /.bundle /.gem +EOF + +CMD /bin/s6-svscan /etc/services.d diff --git a/lxc-apps/decidim/image.d/etc/crontabs/decidim b/lxc-apps/decidim/decidim.image.d/etc/crontabs/decidim old mode 100644 new mode 100755 similarity index 100% rename from lxc-apps/decidim/image.d/etc/crontabs/decidim rename to lxc-apps/decidim/decidim.image.d/etc/crontabs/decidim diff --git a/lxc-apps/decidim/image.d/srv/decidim-app/Gemfile b/lxc-apps/decidim/decidim.image.d/srv/decidim-app/Gemfile similarity index 73% rename from lxc-apps/decidim/image.d/srv/decidim-app/Gemfile rename to lxc-apps/decidim/decidim.image.d/srv/decidim-app/Gemfile index 48aa8e7..99ffaec 100644 --- a/lxc-apps/decidim/image.d/srv/decidim-app/Gemfile +++ b/lxc-apps/decidim/decidim.image.d/srv/decidim-app/Gemfile @@ -4,9 +4,10 @@ source "https://rubygems.org" ruby RUBY_VERSION -gem "decidim", "0.22.0" -# gem "decidim-consultations", "0.22.0" -# gem "decidim-initiatives", "0.22.0" +gem "decidim", "0.23.1" +# gem "decidim-consultations", "0.23.1" +# gem "decidim-initiatives", "0.23.1" +# gem "decidim-templates", "0.23.1" gem "bootsnap", "~> 1.3" @@ -15,10 +16,12 @@ gem "uglifier", "~> 4.1" gem "faker", "~> 1.9" +gem "wicked_pdf", "~> 1.4" + group :development, :test do gem "byebug", "~> 11.0", platform: :mri - gem "decidim-dev", "0.22.0" + gem "decidim-dev", "0.23.1" end group :development do diff --git a/lxc-apps/decidim/install.sh b/lxc-apps/decidim/install.sh index 49b79f6..79ee057 100755 --- a/lxc-apps/decidim/install.sh +++ b/lxc-apps/decidim/install.sh @@ -5,7 +5,7 @@ set -ev POSTGRES_DATA="${VOLUMES_DIR}/decidim/postgres_data" DECIDIM_CONF="${VOLUMES_DIR}/decidim/decidim_conf" DECIDIM_DATA="${VOLUMES_DIR}/decidim/decidim_data" -DECIDIM_LAYER="${LAYERS_DIR}/decidim_0.22.0-201021" +DECIDIM_LAYER="${LAYERS_DIR}/decidim_0.23.1-201118" # Create Postgres instance install -o 105432 -g 105432 -m 700 -d ${POSTGRES_DATA} @@ -24,14 +24,17 @@ envsubst