Skip to content

Commit

Permalink
Upgrade 27 (#75)
Browse files Browse the repository at this point in the history
* upgrade 27

* fix files

* fix locales

* fix tests

* upgrade awesome

* update awesome

* update webpack conf

* update compose

---------

Co-authored-by: Ivan Vergés <[email protected]>
  • Loading branch information
antopalidi and microstudi authored Dec 4, 2023
1 parent 7356297 commit 2a59d67
Show file tree
Hide file tree
Showing 1,531 changed files with 462,379 additions and 28,003 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
pull_request:

env:
RUBY_VERSION: 2.7.7
RUBY_VERSION: 3.0.6
NODE_VERSION: 16.19.1

jobs:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
pull_request:

env:
RUBY_VERSION: 2.7.7
RUBY_VERSION: 3.0.6
NODE_VERSION: 16.19.1

jobs:
Expand Down
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@
/storage/*
!/storage/.keep

/node_modules
/yarn-error.log

/public/assets
.byebug_history

Expand Down Expand Up @@ -54,3 +51,6 @@ spec/decidim_dummy_app
/yarn-error.log
yarn-debug.log*
.yarn-integrity

/public/sw.js*
coverage/
8 changes: 1 addition & 7 deletions .rubocop_ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,7 @@ AllCops:
# If a value is specified for TargetRubyVersion then it is used.
# Else if .ruby-version exists and it contains an MRI version it is used.
# Otherwise we fallback to the oldest officially supported Ruby version (2.0).
TargetRubyVersion: 2.7

RSpec:
Patterns:
- "(?:^|/)spec/"
- "(?:^|/)test/"
TargetRubyVersion: 3.0

# Indent private/protected/public as deep as method definitions
Layout/AccessModifierIndentation:
Expand Down Expand Up @@ -1751,4 +1746,3 @@ Faker/DeprecatedArguments:
questions:
- number
- supplemental

2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.7.7
3.0.6
123 changes: 122 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1 +1,122 @@
FROM decidim/decidim:0.21.0
FROM ruby:3.0 AS builder

RUN NODE_MAJOR=16 && \
apt-get update && apt-get upgrade -y && apt-get install -y ca-certificates curl gnupg && \
mkdir -p /etc/apt/keyrings && \
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && \
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list && \
curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \
apt-get update && apt-get install -y nodejs yarn \
build-essential \
postgresql-client \
libpq-dev && \
apt-get clean

# throw errors if Gemfile has been modified since Gemfile.lock
RUN bundle config --global frozen 1

WORKDIR /app

# Copy package dependencies files only to ensure maximum cache hit
COPY ./package-lock.json /app/package-lock.json
COPY ./package.json /app/package.json
COPY ./Gemfile /app/Gemfile
COPY ./Gemfile.lock /app/Gemfile.lock

RUN gem install bundler:$(grep -A 1 'BUNDLED WITH' Gemfile.lock | tail -n 1 | xargs) && \
bundle config --local without 'development test' && \
bundle install -j4 --retry 3 && \
# Remove unneeded gems
bundle clean --force && \
# Remove unneeded files from installed gems (cache, *.o, *.c)
rm -rf /usr/local/bundle/cache && \
find /usr/local/bundle/ -name "*.c" -delete && \
find /usr/local/bundle/ -name "*.o" -delete && \
find /usr/local/bundle/ -name ".git" -exec rm -rf {} + && \
find /usr/local/bundle/ -name ".github" -exec rm -rf {} + && \
# whkhtmltopdf has binaries for all platforms, we don't need them once uncompressed
rm -rf /usr/local/bundle/gems/wkhtmltopdf-binary-*/bin/*.gz && \
# Remove additional unneded decidim files
find /usr/local/bundle/ -name "decidim_app-design" -exec rm -rf {} + && \
find /usr/local/bundle/ -name "spec" -exec rm -rf {} +

RUN npm ci

# copy the rest of files
COPY ./app /app/app
COPY ./bin /app/bin
COPY ./config /app/config
COPY ./db /app/db
COPY ./lib /app/lib
COPY ./packages /app/packages
COPY ./public/*.* /app/public/
COPY ./config.ru /app/config.ru
COPY ./Rakefile /app/Rakefile
COPY ./babel.config.json /app/babel.config.json
COPY ./postcss.config.js /app/postcss.config.js

# Compile assets with Webpacker or Sprockets
#
# Notes:
# 1. Executing "assets:precompile" runs "webpacker:compile", too
# 2. For an app using encrypted credentials, Rails raises a `MissingKeyError`
# if the master key is missing. Because on CI there is no master key,
# we hide the credentials while compiling assets (by renaming them before and after)
#
RUN mv config/credentials.yml.enc config/credentials.yml.enc.bak 2>/dev/null || true
RUN mv config/credentials config/credentials.bak 2>/dev/null || true

RUN RAILS_ENV=production \
SECRET_KEY_BASE=dummy \
RAILS_MASTER_KEY=dummy \
DB_ADAPTER=nulldb \
bundle exec rails assets:precompile

RUN mv config/credentials.yml.enc.bak config/credentials.yml.enc 2>/dev/null || true
RUN mv config/credentials.bak config/credentials 2>/dev/null || true

RUN rm -rf node_modules tmp/cache vendor/bundle test spec app/packs .git

# This image is for production env only
FROM ruby:3.0-slim AS final

RUN apt-get update && \
apt-get install -y postgresql-client \
imagemagick \
curl \
supervisor && \
apt-get clean

EXPOSE 3000

ENV RAILS_LOG_TO_STDOUT true
ENV RAILS_SERVE_STATIC_FILES true
ENV RAILS_ENV production

ARG RUN_RAILS
ARG RUN_SIDEKIQ
ARG COMMIT_SHA
ARG COMMIT_TIME
ARG COMMIT_VERSION

ENV COMMIT_SHA ${COMMIT_SHA}
ENV COMMIT_TIME ${COMMIT_TIME}
ENV COMMIT_VERSION ${COMMIT_VERSION}

# Add user
RUN addgroup --system --gid 1000 app && \
adduser --system --uid 1000 --home /app --group app

WORKDIR /app
COPY ./entrypoint.sh /app/entrypoint.sh
COPY ./supervisord.conf /etc/supervisord.conf
COPY --from=builder --chown=app:app /usr/local/bundle/ /usr/local/bundle/
COPY --from=builder --chown=app:app /app /app

USER app
HEALTHCHECK --interval=1m --timeout=5s --start-period=30s \
CMD (curl -sSH "Content-Type: application/json" -d '{"query": "{ decidim { version } }"}' http://localhost:3000/api) || exit 1

ENTRYPOINT ["/app/entrypoint.sh"]
CMD ["/usr/bin/supervisord"]
22 changes: 5 additions & 17 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,27 @@ source "https://rubygems.org"

ruby RUBY_VERSION

DECIDIM_VERSION = { git: "https://github.com/decidim/decidim", branch: "release/0.26-stable" }.freeze
DECIDIM_VERSION = { git: "https://github.com/decidim/decidim", branch: "release/0.27-stable" }.freeze
gem "decidim", DECIDIM_VERSION
gem "decidim-consultations", DECIDIM_VERSION
# gem "decidim-initiatives", DECIDIM_VERSION
gem "decidim-decidim_awesome", git: "https://github.com/decidim-ice/decidim-module-decidim_awesome"
gem "decidim-friendly_signup"
gem "decidim-term_customizer", git: "https://github.com/openpoke/decidim-module-term_customizer"
gem "decidim-friendly_signup", git: "https://github.com/OpenSourcePolitics/decidim-module-friendly_signup.git"
gem "decidim-term_customizer", github: "mainio/decidim-module-term_customizer", branch: "master"
gem "decidim-verifications", DECIDIM_VERSION

gem "bootsnap", "~> 1.7"
gem "deface"

gem "puma", ">= 5.3.1"

gem "virtus-multiparams"

gem "faker", "~> 2.14"
gem "ruby-ntlm"
gem "sentry-rails"
gem "sentry-ruby"

group :development, :test do
gem "byebug", "~> 11.0", platform: :mri
gem "faker", "~> 2.14"

gem "decidim-dev", DECIDIM_VERSION
end
Expand All @@ -35,23 +33,13 @@ group :development do
gem "letter_opener_web", "~> 2.0"
gem "listen", "~> 3.1"
gem "rubocop-faker"
gem "spring", "~> 2.1"
gem "spring", "~> 4.1.1"
gem "spring-watcher-listen", "~> 2.0"
gem "web-console", "~> 4.2"
gem "xliffle"

gem "capistrano", "~> 3.17", require: false
gem "capistrano-bundler", require: false
gem "capistrano-passenger", require: false
gem "capistrano-rails", require: false
gem "capistrano-rails-console", require: false
gem "capistrano-rbenv", require: false
gem "capistrano-sidekiq", require: false
end

group :production do
gem "figaro", "~> 1.2"
gem "passenger", "~> 6.0"
gem "sidekiq", "<7"
gem "sidekiq-cron"
end
Loading

0 comments on commit 2a59d67

Please sign in to comment.