diff --git a/.ruby-version b/.ruby-version index 944880f..15a2799 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -3.2.0 +3.3.0 diff --git a/Dockerfile b/Dockerfile deleted file mode 100755 index 539184b..0000000 --- a/Dockerfile +++ /dev/null @@ -1,94 +0,0 @@ -# syntax = docker/dockerfile:experimental - -ARG RUBY_VERSION=3.2.0 -ARG VARIANT=jemalloc-bullseye-slim -FROM quay.io/evl.ms/fullstaq-ruby:${RUBY_VERSION}-${VARIANT} as base - -LABEL fly_launch_runtime="rails" - -ARG BUNDLER_VERSION=2.3.26 - -ARG RAILS_ENV=production -ENV RAILS_ENV=${RAILS_ENV} - -ENV RAILS_SERVE_STATIC_FILES true -ENV RAILS_LOG_TO_STDOUT true - -ARG BUNDLE_WITHOUT=development:test -ARG BUNDLE_PATH=vendor/bundle -ENV BUNDLE_PATH ${BUNDLE_PATH} -ENV BUNDLE_WITHOUT ${BUNDLE_WITHOUT} - -ARG REVISION -ENV REVISION=$REVISION - -RUN mkdir /app -WORKDIR /app -RUN mkdir -p tmp/pids - -RUN gem update --system --no-document && \ - gem install -N bundler -v ${BUNDLER_VERSION} - -####################################################################### - -# install packages only needed at build time - -FROM base as build_deps - -ARG BUILD_PACKAGES="git build-essential libpq-dev wget vim curl gzip xz-utils libsqlite3-dev libyaml-dev" -ENV BUILD_PACKAGES ${BUILD_PACKAGES} - -RUN --mount=type=cache,id=dev-apt-cache,sharing=locked,target=/var/cache/apt \ - --mount=type=cache,id=dev-apt-lib,sharing=locked,target=/var/lib/apt \ - apt-get update -qq && \ - apt-get install --no-install-recommends -y ${BUILD_PACKAGES} && \ - rm -rf /var/lib/apt/lists /var/cache/apt/archives - -####################################################################### - -# install gems - -FROM build_deps as gems - -COPY Gemfile* ./ -COPY .ruby-version ./ -RUN bundle install && rm -rf vendor/bundle/ruby/*/cache - -####################################################################### - -# install deployment packages - -FROM base - -ARG DEPLOY_PACKAGES="git postgresql-client file vim curl gzip libsqlite3-0" -ENV DEPLOY_PACKAGES=${DEPLOY_PACKAGES} - -RUN --mount=type=cache,id=prod-apt-cache,sharing=locked,target=/var/cache/apt \ - --mount=type=cache,id=prod-apt-lib,sharing=locked,target=/var/lib/apt \ - apt-get update -qq && \ - apt-get install --no-install-recommends -y ${DEPLOY_PACKAGES} && \ - rm -rf /var/lib/apt/lists /var/cache/apt/archives - -COPY --from=gems /app /app -COPY --from=gems /usr/lib/fullstaq-ruby/versions /usr/lib/fullstaq-ruby/versions -COPY --from=gems /usr/local/bundle /usr/local/bundle - -####################################################################### - -# Deploy your application -COPY . . - -# Adjust binstubs to run on Linux and set current working directory -RUN chmod +x /app/bin/* && \ - sed -i 's/ruby.exe\r*/ruby/' /app/bin/* && \ - sed -i '/^#!/aDir.chdir File.expand_path("..", __dir__)' /app/bin/* - -# Run build task defined in lib/tasks/fly.rake -ARG BUILD_COMMAND="bin/rails fly:build" -RUN ${BUILD_COMMAND} - -# Default server start instructions. Generally Overridden by fly.toml. -ENV PORT 8080 -ARG SERVER_COMMAND="bin/rails fly:server" -ENV SERVER_COMMAND ${SERVER_COMMAND} -CMD ${SERVER_COMMAND} diff --git a/Gemfile b/Gemfile index 0b9fcab..0541d4a 100644 --- a/Gemfile +++ b/Gemfile @@ -1,49 +1,40 @@ -# frozen_string_literal: true - source "https://rubygems.org" -ruby File.read(".ruby-version").strip +ruby file: ".ruby-version" -gem "active_record_extended", "~> 3.0" -gem "amazing_print", "~> 1.4", require: false -gem "aws-sdk-s3", "~> 1.8" +gem "activerecord-enhancedsqlite3-adapter", "~> 0.5" +gem "amazing_print", "~> 1.5" +gem "aws-sdk-s3", "~> 1.8", require: false gem "baseline", github: "manuelmeurer/baseline" -gem "bootsnap", "~> 1.13", require: false -gem "bootstrap", "~> 5.2" -gem "cloudflare", "~> 4.3" +gem "bootsnap", "~> 1.17", require: false +gem "bootstrap", github: "twbs/bootstrap-rubygem" # TODO: use released version when > 5.3.2 is released +gem "dartsass-rails", "~> 0.5" gem "envkey", "~> 2.0" gem "friendly_id", "~> 5.5" -gem "git", "~> 1.12" gem "haml", "~> 6.0" -gem "hiredis", "~> 0.6" -gem "importmap-rails", "~> 1.1" +gem "importmap-rails", "~> 2.0" gem "kredis", "~> 1.2" -gem "mini_racer", "~> 0.6" # Necessary for autoprefixer-rails, which is required by bootstrap. -gem "pg", "~> 1.4" +gem "octopoller", "~> 0.3" gem "postmark-rails", "~> 0.22" -gem 'pry-rails', "~> 0.3" -gem "puma", "~> 6.0" -gem "rack-cors", "~> 2.0" +gem "propshaft", "~> 0.8" +gem "pry-rails", "~> 0.3" +gem "puma", "~> 6.4" gem "rails_bootstrap_navbar", "~> 3.0" -gem "rails", "~> 7.0.4" -gem "redis-namespace", "~> 1.9" -gem "redis", "~> 4.0" -gem "rubyzip", "~> 2.3" -gem "sassc-rails", "~> 2.1" -gem "sdoc", "~> 2.4" +gem "rails-i18n", "~> 7.0" +gem "rails", "~> 7.1.2" +gem "redis-namespace", "~> 1.11" +gem "redis", "~> 5.0" +gem "sdoc", github: "rails/sdoc" # TODO: use released version when 3.x is released gem "sentry-rails", "~> 5.5" gem "sentry-sidekiq", "~> 5.5" -gem "sidekiq-scheduler", "~> 4.0" -gem "sidekiq", "~> 6.5" +gem "sidekiq", "~> 7.2" gem "sitemap_generator", "~> 6.3" -gem "sprockets-rails", "~> 3.4" -gem "stimulus-rails", "~> 1.1" -gem "tries", "~> 0.4" -gem "turbo-rails", "~> 1.1" +gem "sqlite3", "~> 1.6" +gem "stimulus-rails", "~> 1.3" +gem "turbo-rails", "~> 2.0" group :development do - gem "annotate", "~> 3.0", require: false + gem "annotaterb", "~> 4.4", require: false gem "better_errors", "~> 2.8" gem "binding_of_caller", "~> 1.0" - gem "database_consistency", "~> 1.0", require: false end diff --git a/Gemfile.lock b/Gemfile.lock index 4bd3be5..1c4457f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,187 +1,182 @@ GIT remote: https://github.com/manuelmeurer/baseline.git - revision: 038cb5e7c29ec947308303bbb49e38992c4aa7ad + revision: fccf9436c4065f8d07bb206a2b90544af7b30adb specs: baseline (1.0) +GIT + remote: https://github.com/rails/sdoc.git + revision: e9bb867eba81f48c402a129e688e810ec1fa387c + specs: + sdoc (3.0.0.alpha) + nokogiri + rdoc (>= 5.0) + rouge + +GIT + remote: https://github.com/twbs/bootstrap-rubygem.git + revision: 90467dee09b0c6e52e7d58de867148fda0dd9f49 + specs: + bootstrap (5.3.2) + autoprefixer-rails (>= 9.1.0) + popper_js (>= 2.11.8, < 3) + GEM remote: https://rubygems.org/ specs: - actioncable (7.0.4.3) - actionpack (= 7.0.4.3) - activesupport (= 7.0.4.3) + actioncable (7.1.3.2) + actionpack (= 7.1.3.2) + activesupport (= 7.1.3.2) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (7.0.4.3) - actionpack (= 7.0.4.3) - activejob (= 7.0.4.3) - activerecord (= 7.0.4.3) - activestorage (= 7.0.4.3) - activesupport (= 7.0.4.3) + zeitwerk (~> 2.6) + actionmailbox (7.1.3.2) + actionpack (= 7.1.3.2) + activejob (= 7.1.3.2) + activerecord (= 7.1.3.2) + activestorage (= 7.1.3.2) + activesupport (= 7.1.3.2) mail (>= 2.7.1) net-imap net-pop net-smtp - actionmailer (7.0.4.3) - actionpack (= 7.0.4.3) - actionview (= 7.0.4.3) - activejob (= 7.0.4.3) - activesupport (= 7.0.4.3) + actionmailer (7.1.3.2) + actionpack (= 7.1.3.2) + actionview (= 7.1.3.2) + activejob (= 7.1.3.2) + activesupport (= 7.1.3.2) mail (~> 2.5, >= 2.5.4) net-imap net-pop net-smtp - rails-dom-testing (~> 2.0) - actionpack (7.0.4.3) - actionview (= 7.0.4.3) - activesupport (= 7.0.4.3) - rack (~> 2.0, >= 2.2.0) + rails-dom-testing (~> 2.2) + actionpack (7.1.3.2) + actionview (= 7.1.3.2) + activesupport (= 7.1.3.2) + nokogiri (>= 1.8.5) + racc + rack (>= 2.2.4) + rack-session (>= 1.0.1) rack-test (>= 0.6.3) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (7.0.4.3) - actionpack (= 7.0.4.3) - activerecord (= 7.0.4.3) - activestorage (= 7.0.4.3) - activesupport (= 7.0.4.3) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) + actiontext (7.1.3.2) + actionpack (= 7.1.3.2) + activerecord (= 7.1.3.2) + activestorage (= 7.1.3.2) + activesupport (= 7.1.3.2) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.0.4.3) - activesupport (= 7.0.4.3) + actionview (7.1.3.2) + activesupport (= 7.1.3.2) builder (~> 3.1) - erubi (~> 1.4) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.1, >= 1.2.0) - active_record_extended (3.2.1) - activerecord (>= 5.2, < 7.2.0) - pg (< 3.0) - activejob (7.0.4.3) - activesupport (= 7.0.4.3) + erubi (~> 1.11) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) + activejob (7.1.3.2) + activesupport (= 7.1.3.2) globalid (>= 0.3.6) - activemodel (7.0.4.3) - activesupport (= 7.0.4.3) - activerecord (7.0.4.3) - activemodel (= 7.0.4.3) - activesupport (= 7.0.4.3) - activestorage (7.0.4.3) - actionpack (= 7.0.4.3) - activejob (= 7.0.4.3) - activerecord (= 7.0.4.3) - activesupport (= 7.0.4.3) + activemodel (7.1.3.2) + activesupport (= 7.1.3.2) + activerecord (7.1.3.2) + activemodel (= 7.1.3.2) + activesupport (= 7.1.3.2) + timeout (>= 0.4.0) + activerecord-enhancedsqlite3-adapter (0.5.0) + activerecord (>= 7.1) + sqlite3 (~> 1.6) + activestorage (7.1.3.2) + actionpack (= 7.1.3.2) + activejob (= 7.1.3.2) + activerecord (= 7.1.3.2) + activesupport (= 7.1.3.2) marcel (~> 1.0) - mini_mime (>= 1.1.0) - activesupport (7.0.4.3) + activesupport (7.1.3.2) + base64 + bigdecimal concurrent-ruby (~> 1.0, >= 1.0.2) + connection_pool (>= 2.2.5) + drb i18n (>= 1.6, < 2) minitest (>= 5.1) + mutex_m tzinfo (~> 2.0) - addressable (2.8.4) - public_suffix (>= 2.0.2, < 6.0) - amazing_print (1.4.0) - annotate (3.2.0) - activerecord (>= 3.2, < 8.0) - rake (>= 10.4, < 14.0) - async (2.5.1) - console (~> 1.10) - io-event (~> 1.1) - timers (~> 4.1) - async-http (0.60.1) - async (>= 1.25) - async-io (>= 1.28) - async-pool (>= 0.2) - protocol-http (~> 0.24.0) - protocol-http1 (~> 0.15.0) - protocol-http2 (~> 0.15.0) - traces (>= 0.8.0) - async-io (1.34.3) - async - async-pool (0.4.0) - async (>= 1.25) - async-rest (0.12.4) - async-http (~> 0.42) - protocol-http (~> 0.7) - autoprefixer-rails (10.4.13.0) + amazing_print (1.6.0) + annotaterb (4.7.0) + autoprefixer-rails (10.4.16.0) execjs (~> 2) - aws-eventstream (1.2.0) - aws-partitions (1.763.0) - aws-sdk-core (3.172.0) - aws-eventstream (~> 1, >= 1.0.2) + aws-eventstream (1.3.0) + aws-partitions (1.904.0) + aws-sdk-core (3.191.5) + aws-eventstream (~> 1, >= 1.3.0) aws-partitions (~> 1, >= 1.651.0) - aws-sigv4 (~> 1.5) + aws-sigv4 (~> 1.8) jmespath (~> 1, >= 1.6.1) - aws-sdk-kms (1.64.0) - aws-sdk-core (~> 3, >= 3.165.0) + aws-sdk-kms (1.78.0) + aws-sdk-core (~> 3, >= 3.191.0) aws-sigv4 (~> 1.1) - aws-sdk-s3 (1.122.0) - aws-sdk-core (~> 3, >= 3.165.0) + aws-sdk-s3 (1.146.1) + aws-sdk-core (~> 3, >= 3.191.0) aws-sdk-kms (~> 1) - aws-sigv4 (~> 1.4) - aws-sigv4 (1.5.2) + aws-sigv4 (~> 1.8) + aws-sigv4 (1.8.0) aws-eventstream (~> 1, >= 1.0.2) - better_errors (2.10.0) + base64 (0.2.0) + better_errors (2.10.1) erubi (>= 1.0.0) rack (>= 0.9.0) rouge (>= 1.0.0) - binding_of_caller (1.0.0) - debug_inspector (>= 0.0.1) - bootsnap (1.16.0) + bigdecimal (3.1.7) + binding_of_caller (1.0.1) + debug_inspector (>= 1.2.0) + bootsnap (1.18.3) msgpack (~> 1.2) - bootstrap (5.2.3) - autoprefixer-rails (>= 9.1.0) - popper_js (>= 2.11.6, < 3) - sassc-rails (>= 2.0.0) - bootstrap-navbar (3.2.1) + bootstrap-navbar (3.2.2) gem_config (~> 0.3) builder (3.2.4) - cloudflare (4.3.0) - async-rest (~> 0.12.3) coderay (1.1.3) - concurrent-ruby (1.2.2) - connection_pool (2.4.0) - console (1.16.2) - fiber-local + concurrent-ruby (1.2.3) + connection_pool (2.4.1) crass (1.0.6) - database_consistency (1.7.8) - activerecord (>= 3.2) - date (3.3.3) - debug_inspector (1.1.0) - envkey (2.3.0) + dartsass-rails (0.5.0) + railties (>= 6.0.0) + sass-embedded (~> 1.63) + date (3.3.4) + debug_inspector (1.2.0) + drb (2.2.1) + envkey (2.4.2) erubi (1.12.0) - et-orbi (1.2.7) - tzinfo - execjs (2.8.1) - ffi (1.15.5) - fiber-local (1.0.0) - friendly_id (5.5.0) + execjs (2.9.1) + friendly_id (5.5.1) activerecord (>= 4.0.0) - fugit (1.8.1) - et-orbi (~> 1, >= 1.2.7) - raabro (~> 1.4) gem_config (0.3.2) - git (1.18.0) - addressable (~> 2.8) - rchardet (~> 1.8) - globalid (1.1.0) - activesupport (>= 5.0) - haml (6.1.1) + globalid (1.2.1) + activesupport (>= 6.1) + google-protobuf (4.26.1-arm64-darwin) + rake (>= 13) + google-protobuf (4.26.1-x86_64-linux) + rake (>= 13) + haml (6.3.0) temple (>= 0.8.2) thor tilt - hiredis (0.6.3) - i18n (1.13.0) + i18n (1.14.4) concurrent-ruby (~> 1.0) - importmap-rails (1.1.6) + importmap-rails (2.0.1) actionpack (>= 6.0.0) + activesupport (>= 6.0.0) railties (>= 6.0.0) - io-event (1.2.2) + io-console (0.7.2) + irb (1.12.0) + rdoc + reline (>= 0.4.2) jmespath (1.6.2) - json (2.6.3) - kredis (1.3.0.1) + json (2.7.1) + kredis (1.7.0) + activemodel (>= 6.0.0) activesupport (>= 6.0.0) redis (>= 4.2, < 6) - libv8-node (16.10.0.0-arm64-darwin) - libv8-node (16.10.0.0-x86_64-linux) - loofah (2.21.2) + loofah (2.22.0) crass (~> 1.0.2) nokogiri (>= 1.12.0) mail (2.8.1) @@ -189,204 +184,185 @@ GEM net-imap net-pop net-smtp - marcel (1.0.2) + marcel (1.0.4) method_source (1.0.0) - mini_mime (1.1.2) - mini_racer (0.6.3) - libv8-node (~> 16.10.0.0) - minitest (5.18.0) - msgpack (1.7.0) - net-imap (0.3.4) + mini_mime (1.1.5) + minitest (5.22.3) + msgpack (1.7.2) + mutex_m (0.2.0) + net-imap (0.4.10) date net-protocol net-pop (0.1.2) net-protocol - net-protocol (0.2.1) + net-protocol (0.2.2) timeout - net-smtp (0.3.3) + net-smtp (0.5.0) net-protocol - nio4r (2.5.9) - nokogiri (1.14.4-arm64-darwin) + nio4r (2.7.1) + nokogiri (1.16.3-arm64-darwin) racc (~> 1.4) - nokogiri (1.14.4-x86_64-linux) + nokogiri (1.16.3-x86_64-linux) racc (~> 1.4) - pg (1.5.3) - popper_js (2.11.7) - postmark (1.24.0) + octopoller (0.3.1) + popper_js (2.11.8) + postmark (1.25.0) json postmark-rails (0.22.1) actionmailer (>= 3.0.0) postmark (>= 1.21.3, < 2.0) - protocol-hpack (1.4.2) - protocol-http (0.24.1) - protocol-http1 (0.15.0) - protocol-http (~> 0.22) - protocol-http2 (0.15.1) - protocol-hpack (~> 1.4) - protocol-http (~> 0.18) + propshaft (0.8.0) + actionpack (>= 7.0.0) + activesupport (>= 7.0.0) + rack + railties (>= 7.0.0) pry (0.14.2) coderay (~> 1.1) method_source (~> 1.0) pry-rails (0.3.9) pry (>= 0.10.4) - psych (5.1.0) + psych (5.1.2) stringio - public_suffix (5.0.1) - puma (6.2.2) + puma (6.4.2) nio4r (~> 2.0) - raabro (1.4.0) - racc (1.6.2) - rack (2.2.7) - rack-cors (2.0.1) - rack (>= 2.0.0) + racc (1.7.3) + rack (3.0.10) + rack-session (2.0.0) + rack (>= 3.0.0) rack-test (2.1.0) rack (>= 1.3) - rails (7.0.4.3) - actioncable (= 7.0.4.3) - actionmailbox (= 7.0.4.3) - actionmailer (= 7.0.4.3) - actionpack (= 7.0.4.3) - actiontext (= 7.0.4.3) - actionview (= 7.0.4.3) - activejob (= 7.0.4.3) - activemodel (= 7.0.4.3) - activerecord (= 7.0.4.3) - activestorage (= 7.0.4.3) - activesupport (= 7.0.4.3) + rackup (2.1.0) + rack (>= 3) + webrick (~> 1.8) + rails (7.1.3.2) + actioncable (= 7.1.3.2) + actionmailbox (= 7.1.3.2) + actionmailer (= 7.1.3.2) + actionpack (= 7.1.3.2) + actiontext (= 7.1.3.2) + actionview (= 7.1.3.2) + activejob (= 7.1.3.2) + activemodel (= 7.1.3.2) + activerecord (= 7.1.3.2) + activestorage (= 7.1.3.2) + activesupport (= 7.1.3.2) bundler (>= 1.15.0) - railties (= 7.0.4.3) - rails-dom-testing (2.0.3) - activesupport (>= 4.2.0) + railties (= 7.1.3.2) + rails-dom-testing (2.2.0) + activesupport (>= 5.0.0) + minitest nokogiri (>= 1.6) - rails-html-sanitizer (1.5.0) - loofah (~> 2.19, >= 2.19.1) + rails-html-sanitizer (1.6.0) + loofah (~> 2.21) + nokogiri (~> 1.14) + rails-i18n (7.0.9) + i18n (>= 0.7, < 2) + railties (>= 6.0.0, < 8) rails_bootstrap_navbar (3.0.0) bootstrap-navbar (~> 3.0) rails (>= 3.0.0) - railties (7.0.4.3) - actionpack (= 7.0.4.3) - activesupport (= 7.0.4.3) - method_source + railties (7.1.3.2) + actionpack (= 7.1.3.2) + activesupport (= 7.1.3.2) + irb + rackup (>= 1.0.0) rake (>= 12.2) - thor (~> 1.0) - zeitwerk (~> 2.5) - rake (13.0.6) - rchardet (1.8.0) - rdoc (6.5.0) + thor (~> 1.0, >= 1.2.2) + zeitwerk (~> 2.6) + rake (13.1.0) + rdoc (6.6.3.1) psych (>= 4.0.0) - redis (4.8.1) - redis-namespace (1.10.0) + redis (5.1.0) + redis-client (>= 0.17.0) + redis-client (0.21.1) + connection_pool + redis-namespace (1.11.0) redis (>= 4) - rouge (4.1.1) - rubyzip (2.3.2) - rufus-scheduler (3.8.2) - fugit (~> 1.1, >= 1.1.6) - sassc (2.4.0) - ffi (~> 1.9) - sassc-rails (2.1.2) - railties (>= 4.0.0) - sassc (>= 2.0) - sprockets (> 3.0) - sprockets-rails - tilt - sdoc (2.6.1) - rdoc (>= 5.0) - sentry-rails (5.9.0) + reline (0.5.0) + io-console (~> 0.5) + rouge (4.2.1) + sass-embedded (1.72.0-arm64-darwin) + google-protobuf (>= 3.25, < 5.0) + sass-embedded (1.72.0-x86_64-linux-gnu) + google-protobuf (>= 3.25, < 5.0) + sentry-rails (5.17.1) railties (>= 5.0) - sentry-ruby (~> 5.9.0) - sentry-ruby (5.9.0) + sentry-ruby (~> 5.17.1) + sentry-ruby (5.17.1) + bigdecimal concurrent-ruby (~> 1.0, >= 1.0.2) - sentry-sidekiq (5.9.0) - sentry-ruby (~> 5.9.0) + sentry-sidekiq (5.17.1) + sentry-ruby (~> 5.17.1) sidekiq (>= 3.0) - sidekiq (6.5.8) - connection_pool (>= 2.2.5, < 3) - rack (~> 2.0) - redis (>= 4.5.0, < 5) - sidekiq-scheduler (4.0.3) - redis (>= 4.2.0) - rufus-scheduler (~> 3.2) - sidekiq (>= 4, < 7) - tilt (>= 1.4.0) + sidekiq (7.2.2) + concurrent-ruby (< 2) + connection_pool (>= 2.3.0) + rack (>= 2.2.4) + redis-client (>= 0.19.0) sitemap_generator (6.3.0) builder (~> 3.0) - sprockets (4.2.0) - concurrent-ruby (~> 1.0) - rack (>= 2.2.4, < 4) - sprockets-rails (3.4.2) - actionpack (>= 5.2) - activesupport (>= 5.2) - sprockets (>= 3.0.0) - stimulus-rails (1.2.1) + sqlite3 (1.7.3-arm64-darwin) + sqlite3 (1.7.3-x86_64-linux) + stimulus-rails (1.3.3) railties (>= 6.0.0) - stringio (3.0.6) - temple (0.10.0) - thor (1.2.2) - tilt (2.1.0) - timeout (0.3.2) - timers (4.3.5) - traces (0.9.1) - tries (0.4.0) - gem_config (~> 0.2) - turbo-rails (1.4.0) + stringio (3.1.0) + temple (0.10.3) + thor (1.3.1) + tilt (2.3.0) + timeout (0.4.1) + turbo-rails (2.0.5) actionpack (>= 6.0.0) activejob (>= 6.0.0) railties (>= 6.0.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) - websocket-driver (0.7.5) + webrick (1.8.1) + websocket-driver (0.7.6) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) - zeitwerk (2.6.8) + zeitwerk (2.6.13) PLATFORMS - arm64-darwin-22 + arm64-darwin-23 x86_64-linux DEPENDENCIES - active_record_extended (~> 3.0) - amazing_print (~> 1.4) - annotate (~> 3.0) + activerecord-enhancedsqlite3-adapter (~> 0.5) + amazing_print (~> 1.5) + annotaterb (~> 4.4) aws-sdk-s3 (~> 1.8) baseline! better_errors (~> 2.8) binding_of_caller (~> 1.0) - bootsnap (~> 1.13) - bootstrap (~> 5.2) - cloudflare (~> 4.3) - database_consistency (~> 1.0) + bootsnap (~> 1.17) + bootstrap! + dartsass-rails (~> 0.5) envkey (~> 2.0) friendly_id (~> 5.5) - git (~> 1.12) haml (~> 6.0) - hiredis (~> 0.6) - importmap-rails (~> 1.1) + importmap-rails (~> 2.0) kredis (~> 1.2) - mini_racer (~> 0.6) - pg (~> 1.4) + octopoller (~> 0.3) postmark-rails (~> 0.22) + propshaft (~> 0.8) pry-rails (~> 0.3) - puma (~> 6.0) - rack-cors (~> 2.0) - rails (~> 7.0.4) + puma (~> 6.4) + rails (~> 7.1.2) + rails-i18n (~> 7.0) rails_bootstrap_navbar (~> 3.0) - redis (~> 4.0) - redis-namespace (~> 1.9) - rubyzip (~> 2.3) - sassc-rails (~> 2.1) - sdoc (~> 2.4) + redis (~> 5.0) + redis-namespace (~> 1.11) + sdoc! sentry-rails (~> 5.5) sentry-sidekiq (~> 5.5) - sidekiq (~> 6.5) - sidekiq-scheduler (~> 4.0) + sidekiq (~> 7.2) sitemap_generator (~> 6.3) - sprockets-rails (~> 3.4) - stimulus-rails (~> 1.1) - tries (~> 0.4) - turbo-rails (~> 1.1) + sqlite3 (~> 1.6) + stimulus-rails (~> 1.3) + turbo-rails (~> 2.0) RUBY VERSION - ruby 3.2.0p0 + ruby 3.3.0p0 BUNDLED WITH - 2.4.7 + 2.5.6 diff --git a/LICENSE.txt b/LICENSE.txt index 1f0d5ee..75a7488 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,4 +1,4 @@ -Copyright (c) 2013-2022 Manuel Meurer +Copyright (c) Manuel Meurer MIT License diff --git a/Procfile.dev b/Procfile.dev new file mode 100644 index 0000000..852e6c7 --- /dev/null +++ b/Procfile.dev @@ -0,0 +1,2 @@ +web: bin/rails server -p 3000 +css: bin/rails dartsass:watch diff --git a/Rakefile b/Rakefile index c4f9523..d1baef0 100644 --- a/Rakefile +++ b/Rakefile @@ -1,5 +1,3 @@ -# frozen_string_literal: true - require_relative "config/application" Rails.application.load_tasks diff --git a/app/assets/config/manifest.js b/app/assets/config/manifest.js deleted file mode 100644 index 7d98271..0000000 --- a/app/assets/config/manifest.js +++ /dev/null @@ -1,3 +0,0 @@ -//= link_directory ../stylesheets .css -//= link_tree ../images -//= link_tree ../../javascript .js diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index b87bcc7..bed1e96 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -1,2 +1,2 @@ -@import "partials/*"; -// @import "pages/*"; +@import "bootstrap"; +@import "partials/basics"; diff --git a/app/assets/stylesheets/partials/_bootstrap.scss b/app/assets/stylesheets/partials/_bootstrap.scss deleted file mode 100644 index 731ba7e..0000000 --- a/app/assets/stylesheets/partials/_bootstrap.scss +++ /dev/null @@ -1,48 +0,0 @@ -@import "bootstrap/mixins/banner"; -@include bsBanner(""); - -// Configuration -@import "bootstrap/functions"; -@import "bootstrap/variables"; -@import "bootstrap/maps"; -@import "bootstrap/mixins"; -@import "bootstrap/utilities"; - -// Layout & components -@import "bootstrap/root"; -@import "bootstrap/reboot"; -@import "bootstrap/type"; -@import "bootstrap/images"; -@import "bootstrap/containers"; -@import "bootstrap/grid"; -@import "bootstrap/tables"; -@import "bootstrap/forms"; -@import "bootstrap/buttons"; -@import "bootstrap/transitions"; -@import "bootstrap/dropdown"; -@import "bootstrap/button-group"; -@import "bootstrap/nav"; -@import "bootstrap/navbar"; -@import "bootstrap/card"; -@import "bootstrap/accordion"; -@import "bootstrap/breadcrumb"; -@import "bootstrap/pagination"; -@import "bootstrap/badge"; -@import "bootstrap/alert"; -@import "bootstrap/progress"; -@import "bootstrap/list-group"; -@import "bootstrap/close"; -@import "bootstrap/toasts"; -@import "bootstrap/modal"; -@import "bootstrap/tooltip"; -@import "bootstrap/popover"; -@import "bootstrap/carousel"; -@import "bootstrap/spinners"; -@import "bootstrap/offcanvas"; -@import "bootstrap/placeholders"; - -// Helpers -@import "bootstrap/helpers"; - -// Utilities -@import "bootstrap/utilities/api"; diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 553a51e..73b636c 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,13 +1,7 @@ -# frozen_string_literal: true - class ApplicationController < ActionController::Base + include Baseline::ControllerExtensions + def home render "/home" end - - def health - Doc.count - expires_now - head :ok - end end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 7610db8..fcd8ac6 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,5 +1,3 @@ -# frozen_string_literal: true - module ApplicationHelper include Baseline::Helper end diff --git a/app/javascript/application.js b/app/javascript/application.js index b07adae..63bf04b 100644 --- a/app/javascript/application.js +++ b/app/javascript/application.js @@ -1,3 +1,13 @@ import "@hotwired/turbo-rails" -import "@popperjs/core" -import "controllers" +import "popper" +import "bootstrap" + +import { Application } from "@hotwired/stimulus" +import { eagerLoadControllersFrom } from "@hotwired/stimulus-loading" + +const application = Application.start() + +application.debug = false +window.Stimulus = application + +eagerLoadControllersFrom("controllers", application) diff --git a/app/javascript/controllers/application.js b/app/javascript/controllers/application.js deleted file mode 100644 index a98409d..0000000 --- a/app/javascript/controllers/application.js +++ /dev/null @@ -1,8 +0,0 @@ -import { Application } from "@hotwired/stimulus" - -const application = Application.start() - -application.debug = false -window.Stimulus = application - -export { application } diff --git a/app/javascript/controllers/index.js b/app/javascript/controllers/index.js deleted file mode 100644 index 46c98e1..0000000 --- a/app/javascript/controllers/index.js +++ /dev/null @@ -1,4 +0,0 @@ -import { application } from "controllers/application" -import { eagerLoadControllersFrom } from "@hotwired/stimulus-loading" - -eagerLoadControllersFrom("controllers", application) diff --git a/app/mailers/application_mailer.rb b/app/mailers/application_mailer.rb index 539f078..761a4ed 100644 --- a/app/mailers/application_mailer.rb +++ b/app/mailers/application_mailer.rb @@ -1,9 +1,8 @@ -# frozen_string_literal: true - class ApplicationMailer < ActionMailer::Base - default from: "RubyDocs ", - template_path: "mailers", - message_stream: :outbound + default \ + from: "RubyDocs ", + template_path: "mailers", + message_stream: :outbound layout "mailer" end diff --git a/app/models/application_record.rb b/app/models/application_record.rb index 9ba9670..ce6eb78 100644 --- a/app/models/application_record.rb +++ b/app/models/application_record.rb @@ -1,5 +1,3 @@ -# frozen_string_literal: true - class ApplicationRecord < ActiveRecord::Base include Baseline::ModelExtensions primary_abstract_class diff --git a/app/models/current.rb b/app/models/current.rb new file mode 100644 index 0000000..a25ccfd --- /dev/null +++ b/app/models/current.rb @@ -0,0 +1,3 @@ +class Current < ActiveSupport::CurrentAttributes + attribute :missing_value # Set by baseline +end diff --git a/app/services/report_error.rb b/app/services/report_error.rb new file mode 100644 index 0000000..32473af --- /dev/null +++ b/app/services/report_error.rb @@ -0,0 +1 @@ +ReportError = Baseline::ReportError diff --git a/bin/build b/bin/build new file mode 100755 index 0000000..1627cb2 --- /dev/null +++ b/bin/build @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +bundle install -j $(nproc) + +$(bundle show baseline)/bin/build diff --git a/bin/bundle b/bin/bundle new file mode 100755 index 0000000..483ef21 --- /dev/null +++ b/bin/bundle @@ -0,0 +1,107 @@ +#!/usr/bin/env ruby +# +# This file was generated by Bundler. +# +# The application 'bundle' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "rubygems" + +m = Module.new do + module_function + + def invoked_as_script? + File.expand_path($0) == File.expand_path(__FILE__) + end + + def env_var_version + ENV["BUNDLER_VERSION"] + end + + def cli_arg_version + return unless invoked_as_script? # don't want to hijack other binstubs + return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update` + bundler_version = nil + update_index = nil + ARGV.each_with_index do |a, i| + if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN + bundler_version = a + end + next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/ + bundler_version = $1 + update_index = i + end + bundler_version + end + + def gemfile + gemfile = ENV["BUNDLE_GEMFILE"] + return gemfile if gemfile && !gemfile.empty? + + File.expand_path("../Gemfile", __dir__) + end + + def lockfile + lockfile = + case File.basename(gemfile) + when "gems.rb" then gemfile.sub(/\.rb$/, ".locked") + else "#{gemfile}.lock" + end + File.expand_path(lockfile) + end + + def lockfile_version + return unless File.file?(lockfile) + lockfile_contents = File.read(lockfile) + return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/ + Regexp.last_match(1) + end + + def bundler_requirement + @bundler_requirement ||= + env_var_version || + cli_arg_version || + bundler_requirement_for(lockfile_version) + end + + def bundler_requirement_for(version) + return "#{Gem::Requirement.default}.a" unless version + + bundler_gem_version = Gem::Version.new(version) + + bundler_gem_version.approximate_recommendation + end + + def load_bundler! + ENV["BUNDLE_GEMFILE"] ||= gemfile + + activate_bundler + end + + def activate_bundler + gem_error = activation_error_handling do + gem "bundler", bundler_requirement + end + return if gem_error.nil? + require_error = activation_error_handling do + require "bundler/version" + end + return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION)) + warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`" + exit 42 + end + + def activation_error_handling + yield + nil + rescue StandardError, LoadError => e + e + end +end + +m.load_bundler! + +if m.invoked_as_script? + load Gem.bin_path("bundler", "bundle") +end diff --git a/bin/deploy b/bin/deploy index c67e983..8961a0f 100755 --- a/bin/deploy +++ b/bin/deploy @@ -1,18 +1,3 @@ #!/usr/bin/env bash -if [[ -n $RAILS_ENV && $RAILS_ENV != "development" ]]; then - echo "Refusing to run in $RAILS_ENV environment." - exit 1 -fi - -stash_message="deploy-$(date +%s)" -stash_output="$(git stash save --include-untracked $stash_message)" -stashed="$(echo $stash_output | grep $stash_message)" - -bin/rails runner "Rails.application.eager_load!" && - git push && - fly deploy --build-arg REVISION=$(git rev-parse HEAD) - -if [[ "$stashed" ]]; then - git stash pop -fi +$(bundle show baseline)/bin/deploy diff --git a/bin/dev b/bin/dev new file mode 100755 index 0000000..74ade16 --- /dev/null +++ b/bin/dev @@ -0,0 +1,8 @@ +#!/usr/bin/env sh + +if ! gem list foreman -i --silent; then + echo "Installing foreman..." + gem install foreman +fi + +exec foreman start -f Procfile.dev "$@" diff --git a/bin/prod-console b/bin/prod-console index d176cc4..f714326 100755 --- a/bin/prod-console +++ b/bin/prod-console @@ -1,10 +1,3 @@ #!/usr/bin/env bash -set -x - -if [[ -n $RAILS_ENV && $RAILS_ENV != "development" ]]; then - echo "Refusing to run in $RAILS_ENV environment." - exit 1 -fi - -fly ssh console -C "app/bin/rails c" +$(bundle show baseline)/bin/prod-console many-apps rubydocs diff --git a/bin/setup b/bin/setup index 90b5aac..514bf64 100755 --- a/bin/setup +++ b/bin/setup @@ -1,37 +1,36 @@ #!/usr/bin/env ruby +require "fileutils" -require 'fileutils' - -APP_ROOT = File.expand_path('..', __dir__) +# path to your application root. +APP_ROOT = File.expand_path("..", __dir__) def system!(*args) - system(*args) || abort("\n== Command #{args} failed ==") + system(*args, exception: true) end FileUtils.chdir APP_ROOT do - puts '== Installing git submodules ==' - system! 'git submodule init; git submodule update --init' + # This script is a way to set up or update your development environment automatically. + # This script is idempotent, so that you can run it at any time and get an expectable outcome. + # Add necessary setup steps to this file. - puts '== Installing dependencies ==' - system! 'gem install bundler --conservative' - system('bundle check') || system!('bundle install') - system! 'bin/yarn' + puts "== Installing dependencies ==" + system! "gem install bundler --conservative" + system("bundle check") || system!("bundle install") - puts "\n== Copying sample files ==" - unless File.exist?('config/database.yml') - FileUtils.cp 'config/database.yml.sample', 'config/database.yml' - end + # Install JavaScript dependencies + system!("bun install") - unless File.exist?('.env') - FileUtils.cp '.env.sample', '.env' - end + # puts "\n== Copying sample files ==" + # unless File.exist?("config/database.yml") + # FileUtils.cp "config/database.yml.sample", "config/database.yml" + # end puts "\n== Preparing database ==" - system! 'bin/rails db:prepare' + system! "bin/rails db:prepare" puts "\n== Removing old logs and tempfiles ==" - system! 'bin/rails log:clear tmp:clear' + system! "bin/rails log:clear tmp:clear" puts "\n== Restarting application server ==" - system! 'bin/rails restart' + system! "bin/rails restart" end diff --git a/config.ru b/config.ru index 5251c59..11bc6e2 100644 --- a/config.ru +++ b/config.ru @@ -1,5 +1,3 @@ -# frozen_string_literal: true - require_relative "config/environment" run Rails.application diff --git a/config/application.rb b/config/application.rb index 13f34ca..ead1a6c 100644 --- a/config/application.rb +++ b/config/application.rb @@ -1,5 +1,3 @@ -# frozen_string_literal: true - require_relative "boot" require "rails/all" @@ -8,26 +6,36 @@ module RubyDocs class Application < Rails::Application - config.load_defaults 7.0 - config.revision = ENV["REVISION"].presence || - `git rev-parse HEAD 2> /dev/null`.chomp.presence or - raise "Could not determine revision." + config.load_defaults 7.1 + config.autoload_lib ignore: %w(assets tasks) + + config.time_zone = "Berlin" + config.revision = begin + ENV.fetch("HATCHBOX_REVISION") + rescue KeyError + `git rev-parse HEAD 2> /dev/null`.chomp + end.presence or raise "Could not load revision." config.action_mailer.delivery_method = :postmark config.active_record.query_log_tags_enabled = true + config.active_record.sqlite3_production_warning = false + + config.assets.excluded_paths.concat [ + Rails.root.join("app", "assets", "stylesheets") + ] + + config.i18n.raise_on_missing_translations = true config.middleware.insert 0, Rack::Deflater - config.middleware.insert 0, Rack::Cors do - allow do - origins "*" - resource "*", headers: :any, methods: %i(get options post patch put) - end - end Rails.application.routes.default_url_options = config.action_mailer.default_url_options = { host: ENV.fetch("HOST"), protocol: "https" } + + config.after_initialize do + RubyVM::YJIT.enable + end end end diff --git a/config/boot.rb b/config/boot.rb index 1c033d6..04a5b03 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -1,5 +1,3 @@ -# frozen_string_literal: true - ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__) require "bundler/setup" diff --git a/config/database.yml b/config/database.yml new file mode 100644 index 0000000..5ef7c10 --- /dev/null +++ b/config/database.yml @@ -0,0 +1,16 @@ +default: &default + adapter: sqlite3 + pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> + timeout: 5000 + +development: + <<: *default + database: storage/development.sqlite3 + +test: + <<: *default + database: storage/test.sqlite3 + +production: + <<: *default + database: storage/production.sqlite3 diff --git a/config/environment.rb b/config/environment.rb index e8173e0..73a3979 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -1,5 +1,3 @@ -# frozen_string_literal: true - require_relative "application" Rails.application.initialize! diff --git a/config/environments/development.rb b/config/environments/development.rb index c93044d..02a5f84 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -1,12 +1,10 @@ -# frozen_string_literal: true - require "active_support/core_ext/integer/time" Rails.application.configure do # In the development environment your application's code is reloaded any time # it changes. This slows down response time but is perfect for development # since you don't have to restart the web server when you make code changes. - config.cache_classes = false + config.enable_reloading = true # Do not eager load code on boot. config.eager_load = false @@ -56,8 +54,8 @@ # Highlight code that triggered database queries in logs. config.active_record.verbose_query_logs = true - # Suppress logger output for asset requests. - config.assets.quiet = true + # Highlight code that enqueued background job in logs. + config.active_job.verbose_enqueue_logs = true # Raises error for missing translations. # config.i18n.raise_on_missing_translations = true @@ -68,5 +66,8 @@ # Uncomment if you wish to allow Action Cable access from any origin. # config.action_cable.disable_request_forgery_protection = true + # Raise error when a before_action's only/except options reference missing actions + config.action_controller.raise_on_missing_callback_actions = true + config.hosts << /([a-z]+\.)?#{ENV.fetch "HOST"}/ end diff --git a/config/environments/production.rb b/config/environments/production.rb index 1cd517e..66fc812 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -1,10 +1,8 @@ -# frozen_string_literal: true - require "active_support/core_ext/integer/time" Rails.application.configure do # Code is not reloaded between requests. - config.cache_classes = true + config.enable_reloading = false # Eager load code on boot. This eager loads most of Rails and # your application in memory, allowing both threaded web servers @@ -13,53 +11,62 @@ config.eager_load = true # Full error reports are disabled and caching is turned on. - config.consider_all_requests_local = false + config.consider_all_requests_local = false config.action_controller.perform_caching = true - # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"] - # or in config/master.key. This key is used to decrypt credentials (and other encrypted files). + # Ensures that a master key has been made available in ENV["RAILS_MASTER_KEY"], config/master.key, or an environment + # key such as config/credentials/production.key. This key is used to decrypt credentials (and other encrypted files). # config.require_master_key = true - # Disable serving static files from the `/public` folder by default since - # Apache or NGINX already handles this. - config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present? - - # Compress CSS using a preprocessor. - # config.assets.css_compressor = :sass - - # Do not fallback to assets pipeline if a precompiled asset is missed. - config.assets.compile = false + # Disable serving static files from `public/`, relying on NGINX/Apache to do so instead. + # config.public_file_server.enabled = false # Enable serving of images, stylesheets, and JavaScripts from an asset server. - if asset_host = ENV["ASSET_HOST"] - config.asset_host = asset_host - end + # config.asset_host = "http://assets.example.com" # Specifies the header that your server uses for sending files. # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for Apache # config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" # for NGINX # Store uploaded files on the local file system (see config/storage.yml for options). - config.active_storage.service = :local + config.active_storage.service = :cloudflare # Mount Action Cable outside main process or domain. # config.action_cable.mount_path = nil # config.action_cable.url = "wss://example.com/cable" # config.action_cable.allowed_request_origins = [ "http://example.com", /http:\/\/example.*/ ] + # Assume all access to the app is happening through a SSL-terminating reverse proxy. + # Can be used together with config.force_ssl for Strict-Transport-Security and secure cookies. + # config.assume_ssl = true + # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. config.force_ssl = true - # Include generic and useful information about system operation, but avoid logging too much - # information to avoid inadvertent exposure of personally identifiable information (PII). - config.log_level = :info + # Log to STDOUT by default + config.logger = ActiveSupport::Logger.new(STDOUT) + .tap { |logger| logger.formatter = ::Logger::Formatter.new } + .then { |logger| ActiveSupport::TaggedLogging.new(logger) } + + if Rails.version > "7.1.4" + raise "enable multiple loggers when this bug is fixed: https://github.com/rails/rails/issues/49745" + end + # Log to STDOUT and production.log. + # config.logger = [STDOUT, "log/production.log"].map do |destination| + # ActiveSupport::Logger.new(destination, formatter: ::Logger::Formatter.new) + # .then { ActiveSupport::TaggedLogging.new _1 } + # end.then { ActiveSupport::BroadcastLogger.new(*_1) } # Prepend all log lines with the following tags. - config.log_tags = [ :request_id ] + config.log_tags = [:request_id] + + # Info include generic and useful information about system operation, but avoids logging too much + # information to avoid inadvertent exposure of personally identifiable information (PII). If you + # want to log everything, set the level to "debug". + config.log_level = ENV.fetch("RAILS_LOG_LEVEL", "info") # Use a different cache store in production. config.cache_store = :redis_cache_store, { - driver: :hiredis, url: Baseline::RedisURL.fetch, namespace: "cache", expires_in: 1.month, @@ -70,7 +77,7 @@ } # Use a real queuing backend for Active Job (and separate queues per environment). - # config.active_job.queue_adapter = :resque + # config.active_job.queue_adapter = :resque # config.active_job.queue_name_prefix = "rubydocs_production" config.action_mailer.perform_caching = false @@ -86,19 +93,14 @@ # Don't log any deprecations. config.active_support.report_deprecations = false - # Use default logging formatter so that PID and timestamp are not suppressed. - config.log_formatter = ::Logger::Formatter.new - - # Use a different logger for distributed setups. - # require "syslog/logger" - # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new "app-name") - - if ENV["RAILS_LOG_TO_STDOUT"].present? - logger = ActiveSupport::Logger.new(STDOUT) - logger.formatter = config.log_formatter - config.logger = ActiveSupport::TaggedLogging.new(logger) - end - # Do not dump schema after migrations. config.active_record.dump_schema_after_migration = false + + # Enable DNS rebinding protection and other `Host` header attacks. + # config.hosts = [ + # "example.com", # Allow requests from example.com + # /.*\.example\.com/ # Allow requests from subdomains like `www.example.com` + # ] + # Skip DNS rebinding protection for the default health check endpoint. + # config.host_authorization = { exclude: ->(request) { request.path == "/up" } } end diff --git a/config/environments/test.rb b/config/environments/test.rb index fd31549..69a48f6 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -1,14 +1,13 @@ -# frozen_string_literal: true - require "active_support/core_ext/integer/time" Rails.application.configure do - # Turn false under Spring and add config.action_view.cache_template_loading = true. - config.cache_classes = true + # While tests run files are not watched, reloading is not necessary. + config.enable_reloading = false - # Eager loading loads your whole application. When running a single test locally, - # this probably isn't necessary. It's a good idea to do in a continuous integration - # system, or in some way before deploying your code. + # Eager loading loads your entire application. When running a single test locally, + # this is usually not necessary, and can slow down your test suite. However, it's + # recommended that you enable it in continuous integration systems to ensure eager + # loading is working properly before deploying your code. config.eager_load = ENV["CI"].present? # Configure public file server for tests with Cache-Control for performance. @@ -18,12 +17,12 @@ } # Show full error reports and disable caching. - config.consider_all_requests_local = true + config.consider_all_requests_local = true config.action_controller.perform_caching = false config.cache_store = :null_store - # Raise exceptions instead of rendering exception templates. - config.action_dispatch.show_exceptions = false + # Render exception templates for rescuable exceptions and raise for other exceptions. + config.action_dispatch.show_exceptions = :rescuable # Disable request forgery protection in test environment. config.action_controller.allow_forgery_protection = false @@ -52,4 +51,7 @@ # Annotate rendered view with file names. # config.action_view.annotate_rendered_view_with_filenames = true + + # Raise error when a before_action's only/except options reference missing actions + config.action_controller.raise_on_missing_callback_actions = true end diff --git a/config/importmap.rb b/config/importmap.rb index f7a4579..320116b 100644 --- a/config/importmap.rb +++ b/config/importmap.rb @@ -1,11 +1,9 @@ -# frozen_string_literal: true +pin "application" -pin "application", preload: true - -pin "bootstrap", to: "https://ga.jspm.io/npm:bootstrap@5.2.1/dist/js/bootstrap.esm.js" -pin "@popperjs/core", to: "https://ga.jspm.io/npm:@popperjs/core@2.11.6/dist/esm/index.js" -pin "@hotwired/stimulus", to: "stimulus.min.js", preload: true -pin "@hotwired/stimulus-loading", to: "stimulus-loading.js", preload: true -pin "@hotwired/turbo-rails", to: "turbo.min.js", preload: true +pin "@hotwired/stimulus-loading", to: "stimulus-loading.js" +pin "@hotwired/stimulus", to: "stimulus.min.js" +pin "@hotwired/turbo-rails", to: "turbo.min.js" +pin "bootstrap", to: "bootstrap.min.js" +pin "popper", to: "popper.js" pin_all_from "app/javascript/controllers", under: "controllers" diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index ede4c46..b4c984e 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -1,12 +1,5 @@ -# frozen_string_literal: true - # Version of your assets, change this if you want to expire all your assets. Rails.application.config.assets.version = "1.0" # Add additional assets to the asset load path. # Rails.application.config.assets.paths << Emoji.images_path - -# Precompile additional assets. -# application.js, application.css, and all non-JS/CSS in the app/assets -# folder are already added. -# Rails.application.config.assets.precompile += %w( admin.js admin.css ) diff --git a/config/initializers/content_security_policy.rb b/config/initializers/content_security_policy.rb index 428cfd5..ea1d893 100644 --- a/config/initializers/content_security_policy.rb +++ b/config/initializers/content_security_policy.rb @@ -1,5 +1,3 @@ -# frozen_string_literal: true - # Define an application-wide content security policy. # See the Securing Rails Applications Guide for more information: # https://guides.rubyonrails.org/security.html#content-security-policy-header @@ -16,9 +14,9 @@ # # policy.report_uri "/csp-violation-report-endpoint" # end # -# # Generate session nonces for permitted importmap and inline scripts +# # Generate session nonces for permitted importmap, inline scripts, and inline styles. # config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s } -# config.content_security_policy_nonce_directives = %w(script-src) +# config.content_security_policy_nonce_directives = %w(script-src style-src) # # # Report violations without enforcing the policy. # # config.content_security_policy_report_only = true diff --git a/config/initializers/filter_parameter_logging.rb b/config/initializers/filter_parameter_logging.rb index b5783e8..7c87eab 100644 --- a/config/initializers/filter_parameter_logging.rb +++ b/config/initializers/filter_parameter_logging.rb @@ -1,8 +1,6 @@ -# frozen_string_literal: true - -# Configure parameters to be filtered from the log file. Use this to limit dissemination of -# sensitive information. See the ActiveSupport::ParameterFilter documentation for supported -# notations and behaviors. +# Configure parameters to be partially matched (e.g. passw matches password) and filtered from the log file. +# Use this to limit dissemination of sensitive information. +# See the ActiveSupport::ParameterFilter documentation for supported notations and behaviors. Rails.application.config.filter_parameters += [ :passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn ] diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb index 7f7b3e9..bb5f9c3 100644 --- a/config/initializers/inflections.rb +++ b/config/initializers/inflections.rb @@ -1,5 +1,3 @@ -# frozen_string_literal: true - # Add new inflection rules using the following format. Inflections # are locale specific, and you may define rules for as many different # locales as you wish. All of these examples are active by default: diff --git a/config/initializers/permissions_policy.rb b/config/initializers/permissions_policy.rb index 810aade..2e7fd9e 100644 --- a/config/initializers/permissions_policy.rb +++ b/config/initializers/permissions_policy.rb @@ -1,13 +1,11 @@ -# frozen_string_literal: true - # Define an application-wide HTTP permissions policy. For further -# information see https://developers.google.com/web/updates/2018/06/feature-policy -# -# Rails.application.config.permissions_policy do |f| -# f.camera :none -# f.gyroscope :none -# f.microphone :none -# f.usb :none -# f.fullscreen :self -# f.payment :self, "https://secure.example.com" +# information see: https://developers.google.com/web/updates/2018/06/feature-policy + +# Rails.application.config.permissions_policy do |policy| +# policy.camera :none +# policy.gyroscope :none +# policy.microphone :none +# policy.usb :none +# policy.fullscreen :self +# policy.payment :self, "https://secure.example.com" # end diff --git a/config/initializers/postmark.rb b/config/initializers/postmark.rb index 3b0f0f4..fd2b3d4 100644 --- a/config/initializers/postmark.rb +++ b/config/initializers/postmark.rb @@ -1,5 +1,3 @@ -# frozen_string_literal: true - require "postmark" Postmark.api_token = ENV["POSTMARK_API_TOKEN"] diff --git a/config/initializers/sentry.rb b/config/initializers/sentry.rb index 2baae45..f0bf711 100644 --- a/config/initializers/sentry.rb +++ b/config/initializers/sentry.rb @@ -1,5 +1,3 @@ -# frozen_string_literal: true - Sentry.init do |config| config.breadcrumbs_logger = %i(active_support_logger http_logger) config.include_local_variables = true diff --git a/config/initializers/sidekiq.rb b/config/initializers/sidekiq.rb deleted file mode 100644 index 20bb791..0000000 --- a/config/initializers/sidekiq.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -redis_options = { - url: Baseline::RedisURL.fetch, - namespace: "sidekiq" -} - -Sidekiq.configure_server do |config| - config.redis = redis_options -end - -Sidekiq.configure_client do |config| - config.redis = redis_options.merge(size: 1) -end - -Sidekiq.default_job_options = { - "retry" => false -} diff --git a/config/locales/en.yml b/config/locales/en.yml index a9f72ec..ea95161 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1,2 +1,2 @@ en: - hello: "Hello world" + please_wait: Please wait... diff --git a/config/puma.rb b/config/puma.rb index 736019f..6e50287 100644 --- a/config/puma.rb +++ b/config/puma.rb @@ -1,15 +1,44 @@ -# frozen_string_literal: true +require "sidekiq" -max_threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 } -min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_threads_count } +max_threads_count = ENV.fetch("RAILS_MAX_THREADS", 3) +min_threads_count = ENV.fetch("RAILS_MIN_THREADS", max_threads_count) threads min_threads_count, max_threads_count -worker_timeout 3600 if ENV.fetch("RAILS_ENV", "development") == "development" +if ENV["RAILS_ENV"] == "production" + require "concurrent-ruby" + worker_count = Integer(ENV.fetch("WEB_CONCURRENCY") { Concurrent.physical_processor_count }) + if worker_count > 1 + workers worker_count + end +end -port ENV.fetch("PORT") { 3000 } +if ENV.fetch("RAILS_ENV", "development") == "development" + worker_timeout 3600 +end -environment ENV.fetch("RAILS_ENV") { "development" } - -pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" } +port ENV.fetch("PORT", 3000) +environment ENV.fetch("RAILS_ENV", "development") +pidfile ENV.fetch("PIDFILE", "tmp/pids/server.pid") plugin :tmp_restart + +preload_app! + +sidekiq = nil + +on_worker_boot do + Sidekiq.default_job_options = { + "retry" => false + } + Sidekiq.strict_args!(:warn) + sidekiq = Sidekiq.configure_embed do |config| + config.concurrency = 1 + config.redis = { + url: Baseline::RedisURL.fetch + } + end.tap(&:run) +end + +on_worker_shutdown do + sidekiq&.stop +end diff --git a/config/routes.rb b/config/routes.rb index 96bd93a..3ad504b 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,7 +1,4 @@ -# frozen_string_literal: true - require "sidekiq/web" -require "sidekiq-scheduler/web" if Rails.env.production? Sidekiq::Web.use Rack::Auth::Basic do |username, password| @@ -16,9 +13,7 @@ Rails.application.routes.draw do mount Sidekiq::Web => "sidekiq" - get ":sitemap", sitemap: /sitemap[A-Za-z\d.]*/, to: redirect { "https://#{ENV.fetch "CLOUDFLARE_R2_BUCKET_URL"}#{_2.path}" } - root "application#home" - get :health, controller: "application" + get "up" => "rails/health#show", as: :rails_health_check end diff --git a/config/sidekiq.yml b/config/sidekiq.yml deleted file mode 100644 index 50bccac..0000000 --- a/config/sidekiq.yml +++ /dev/null @@ -1 +0,0 @@ -:concurrency: 2 diff --git a/config/sitemap.rb b/config/sitemap.rb index ddc6fd2..36db955 100644 --- a/config/sitemap.rb +++ b/config/sitemap.rb @@ -1,17 +1,6 @@ -# frozen_string_literal: true - require "sitemap_generator" -require "aws-sdk-s3" -SitemapGenerator::Sitemap.default_host = Rails.application.routes.url_helpers.root_url -SitemapGenerator::Sitemap.adapter = SitemapGenerator::AwsSdkAdapter.new( - ENV.fetch("CLOUDFLARE_R2_BUCKET"), - access_key_id: ENV.fetch("CLOUDFLARE_R2_ACCESS_KEY_ID"), - secret_access_key: ENV.fetch("CLOUDFLARE_R2_SECRET_ACCESS_KEY"), - endpoint: "https://#{ENV.fetch "CLOUDFLARE_ACCOUNT_ID"}.r2.cloudflarestorage.com", - region: "auto", - acl: "private" - ) +SitemapGenerator::Sitemap.default_host = root_url SitemapGenerator::Sitemap.create do end diff --git a/config/storage.yml b/config/storage.yml index 695f17b..711bd76 100644 --- a/config/storage.yml +++ b/config/storage.yml @@ -1,7 +1,16 @@ -test: - service: Disk - root: <%= Rails.root.join("tmp/storage") %> - local: service: Disk root: <%= Rails.root.join("storage") %> + +test: + service: Disk + root: <%= Rails.root.join("tmp", "storage") %> + +cloudflare: + service: S3 + access_key_id: <%= ENV["CLOUDFLARE_R2_ACCESS_KEY_ID"] %> + secret_access_key: <%= ENV["CLOUDFLARE_R2_SECRET_ACCESS_KEY"] %> + endpoint: https://<%= ENV["CLOUDFLARE_ACCOUNT_ID"] %>.r2.cloudflarestorage.com + bucket: rubydocs + region: auto + force_path_style: true diff --git a/fly.toml b/fly.toml deleted file mode 100644 index 2a316f1..0000000 --- a/fly.toml +++ /dev/null @@ -1,53 +0,0 @@ -# fly.toml app configuration file generated for ruby-docs on 2023-05-15T18:00:58+02:00 -# -# See https://fly.io/docs/reference/configuration/ for information about how to use this file. -# - -app = "ruby-docs" -primary_region = "fra" -kill_signal = "SIGINT" -kill_timeout = "5s" - -[experimental] - auto_rollback = true - -[build] - [build.args] - BUILD_COMMAND = "bin/rails fly:build" - SERVER_COMMAND = "bin/rails fly:server" - -[deploy] - release_command = "bin/rails fly:release" - -[env] - PORT = "8080" - -[[services]] - protocol = "tcp" - internal_port = 8080 - min_machines_running = 0 - processes = ["app"] - - [services.concurrency] - type = "connections" - hard_limit = 25 - soft_limit = 20 - - [[services.ports]] - port = 80 - handlers = ["http"] - force_https = true - - [[services.ports]] - port = 443 - handlers = ["tls", "http"] - - [[services.tcp_checks]] - interval = "15s" - timeout = "2s" - grace_period = "1s" - restart_limit = 0 - -[[statics]] - guest_path = "/app/public" - url_prefix = "/" diff --git a/lib/tasks/auto_annotate_models.rake b/lib/tasks/auto_annotate_models.rake deleted file mode 100644 index 50cf33b..0000000 --- a/lib/tasks/auto_annotate_models.rake +++ /dev/null @@ -1,54 +0,0 @@ -return unless Rails.env.development? - -require "annotate" - -task :set_annotation_options do - Annotate.set_defaults \ - "active_admin" => "false", - "additional_file_patterns" => [], - "routes" => "false", - "models" => "true", - "position_in_routes" => "after", - "position_in_class" => "after", - "position_in_test" => "after", - "position_in_fixture" => "after", - "position_in_factory" => "after", - "position_in_serializer" => "after", - "show_foreign_keys" => "false", - "show_complete_foreign_keys" => "false", - "show_indexes" => "false", - "simple_indexes" => "false", - "model_dir" => "app/models", - "root_dir" => "", - "include_version" => "false", - "require" => "", - "exclude_tests" => "false", - "exclude_fixtures" => "false", - "exclude_factories" => "false", - "exclude_serializers" => "false", - "exclude_scaffolds" => "true", - "exclude_controllers" => "true", - "exclude_helpers" => "true", - "exclude_sti_subclasses" => "false", - "ignore_model_sub_dir" => "false", - "ignore_columns" => nil, - "ignore_routes" => nil, - "ignore_unknown_models" => "false", - "hide_limit_column_types" => "integer,bigint,boolean", - "hide_default_column_types" => "json,jsonb,hstore", - "skip_on_db_migrate" => "false", - "format_bare" => "true", - "format_rdoc" => "false", - "format_yard" => "false", - "format_markdown" => "false", - "sort" => "false", - "force" => "false", - "frozen" => "false", - "classified_sort" => "true", - "trace" => "false", - "wrapper_open" => nil, - "wrapper_close" => nil, - "with_comment" => "true" -end - -Annotate.load_tasks diff --git a/lib/tasks/fly.rake b/lib/tasks/fly.rake deleted file mode 100644 index 9ae5beb..0000000 --- a/lib/tasks/fly.rake +++ /dev/null @@ -1,37 +0,0 @@ -# commands used to deploy a Rails application -namespace :fly do - # BUILD step: - # - changes to the filesystem made here DO get deployed - # - NO access to secrets, volumes, databases - # - Failures here prevent deployment - task :build => 'assets:precompile' - - # RELEASE step: - # - changes to the filesystem made here are DISCARDED - # - full access to secrets, databases - # - failures here prevent deployment - task :release => 'db:migrate' - - # SERVER step: - # - changes to the filesystem made here are deployed - # - full access to secrets, databases - # - failures here result in VM being stated, shutdown, and rolled back - # to last successful deploy (if any). - task :server => :swapfile do - sh 'bin/rails server' - end - - # optional SWAPFILE task: - # - adjust fallocate size as needed - # - performance critical applications should scale memory to the - # point where swap is rarely used. 'fly scale help' for details. - # - disable by removing dependency on the :server task, thus: - # task :server do - task :swapfile do - sh 'fallocate -l 512M /swapfile' - sh 'chmod 0600 /swapfile' - sh 'mkswap /swapfile' - sh 'echo 10 > /proc/sys/vm/swappiness' - sh 'swapon /swapfile' - end -end diff --git a/test/application_system_test_case.rb b/test/application_system_test_case.rb deleted file mode 100644 index c05709a..0000000 --- a/test/application_system_test_case.rb +++ /dev/null @@ -1,7 +0,0 @@ -# frozen_string_literal: true - -require "test_helper" - -class ApplicationSystemTestCase < ActionDispatch::SystemTestCase - driven_by :selenium, using: :chrome, screen_size: [1400, 1400] -end diff --git a/test/test_helper.rb b/test/test_helper.rb deleted file mode 100644 index 0893464..0000000 --- a/test/test_helper.rb +++ /dev/null @@ -1,12 +0,0 @@ -# frozen_string_literal: true - -ENV["RAILS_ENV"] ||= "test" - -require_relative "../config/environment" - -require "rails/test_help" - -class ActiveSupport::TestCase - parallelize workers: :number_of_processors - fixtures :all -end