From eb6311322731b5c7c31d9e82b40abdeb7152eed4 Mon Sep 17 00:00:00 2001 From: Pete Matsyburka Date: Sat, 31 Jan 2026 17:20:01 +0200 Subject: [PATCH] use trilogy mysql --- Dockerfile | 4 ++-- Gemfile | 2 +- Gemfile.lock | 12 +++++++++--- config/database.yml | 5 ++--- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3d296004..f6412c78 100644 --- a/Dockerfile +++ b/Dockerfile @@ -51,7 +51,7 @@ ENV OPENSSL_CONF=/etc/openssl_legacy.cnf WORKDIR /app -RUN apk add --no-cache sqlite-dev libpq-dev mariadb-dev vips-dev yaml-dev redis libheif vips-heif gcompat ttf-freefont onnxruntime && mkdir /fonts && rm /usr/share/fonts/freefont/FreeSans.otf +RUN apk add --no-cache sqlite-dev libpq-dev vips-dev yaml-dev redis libheif vips-heif gcompat ttf-freefont onnxruntime && mkdir /fonts && rm /usr/share/fonts/freefont/FreeSans.otf RUN addgroup -g 2000 docuseal && adduser -u 2000 -G docuseal -s /bin/sh -D -h /home/docuseal docuseal @@ -69,7 +69,7 @@ activate = 1' >> /etc/openssl_legacy.cnf COPY --chown=docuseal:docuseal ./Gemfile ./Gemfile.lock ./ -RUN apk add --no-cache build-base && bundle install && apk del --no-cache build-base && rm -rf ~/.bundle /usr/local/bundle/cache && ruby -e "puts Dir['/usr/local/bundle/**/{spec,rdoc,resources/shared,resources/collation,resources/locales}']" | xargs rm -rf && ln -sf /usr/lib/libonnxruntime.so.1 $(ruby -e "print Dir[Gem::Specification.find_by_name('onnxruntime').gem_dir + '/vendor/*.so'].first") +RUN apk add --no-cache build-base git && bundle install && apk del --no-cache build-base git && rm -rf ~/.bundle /usr/local/bundle/cache && ruby -e "puts Dir['/usr/local/bundle/**/{spec,rdoc,resources/shared,resources/collation,resources/locales}']" | xargs rm -rf && ln -sf /usr/lib/libonnxruntime.so.1 $(ruby -e "print Dir[Gem::Specification.find_by_name('onnxruntime').gem_dir + '/vendor/*.so'].first") COPY --chown=docuseal:docuseal ./bin ./bin COPY --chown=docuseal:docuseal ./app ./app diff --git a/Gemfile b/Gemfile index 650cde01..61c84807 100644 --- a/Gemfile +++ b/Gemfile @@ -23,7 +23,6 @@ gem 'hexapdf' gem 'image_processing' gem 'jwt', require: false gem 'lograge' -gem 'mysql2', require: false gem 'numo-narray-alt', require: false gem 'oj' gem 'onnxruntime', require: false @@ -45,6 +44,7 @@ gem 'shakapacker' gem 'sidekiq' gem 'sqlite3', require: false gem 'strip_attributes' +gem 'trilogy', github: 'trilogy-libraries/trilogy', glob: 'contrib/ruby/*.gemspec', require: false gem 'turbo-rails' gem 'twitter_cldr', require: false gem 'tzinfo-data' diff --git a/Gemfile.lock b/Gemfile.lock index e4419ff0..7ad54e84 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,3 +1,11 @@ +GIT + remote: https://github.com/trilogy-libraries/trilogy.git + revision: 3963d490459df7a2b5bedb42424c3285f25eab22 + glob: contrib/ruby/*.gemspec + specs: + trilogy (2.10.0) + bigdecimal + GEM remote: https://rubygems.org/ specs: @@ -318,8 +326,6 @@ GEM prism (~> 1.5) msgpack (1.8.0) multi_json (1.19.1) - mysql2 (0.5.7) - bigdecimal net-http (0.9.1) uri (>= 0.11.1) net-imap (0.6.2) @@ -644,7 +650,6 @@ DEPENDENCIES jwt letter_opener_web lograge - mysql2 numo-narray-alt oj onnxruntime @@ -673,6 +678,7 @@ DEPENDENCIES simplecov sqlite3 strip_attributes + trilogy! turbo-rails twitter_cldr tzinfo-data diff --git a/config/database.yml b/config/database.yml index 20921d2d..cedeaa09 100644 --- a/config/database.yml +++ b/config/database.yml @@ -30,9 +30,8 @@ production: <% elsif ENV['DATABASE_URL'].match?(/\Apostgres/) %> <<: *default url: <%= ENV['DATABASE_URL'] %> -<% elsif ENV['DATABASE_URL'].match?(/\Amysql/) %> - adapter: mysql2 +<% elsif ENV['DATABASE_URL'].match?(/\Amysql|\Atrilogy/) %> encoding: utf8mb4 pool: <%= ENV.fetch('RAILS_MAX_THREADS', 15).to_i + ENV.fetch('SIDEKIQ_THREADS', 5).to_i %> - url: <%= ENV['DATABASE_URL'] %> + url: <%= ENV['DATABASE_URL'].sub(/\Amysql2?/, 'trilogy') %> <% end %>