5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-22 11:46:22 +00:00

Merge remote-tracking branch 'origin/rails' into issue-9357-1
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
Cat /dev/Nulo 2023-05-16 15:30:25 +00:00
commit d5b7411e7a
12 changed files with 182 additions and 162 deletions

View file

@ -64,7 +64,7 @@ gem 'rollups', git: 'https://github.com/fauno/rollup.git', branch: 'update'
gem 'rubyzip'
gem 'rugged'
gem 'concurrent-ruby-ext'
gem 'sucker_punch'
gem 'que'
gem 'symbol-fstring', require: 'fstring/all'
gem 'terminal-table'
gem 'validates_hostname'

View file

@ -27,78 +27,78 @@ GIT
GEM
remote: https://17.3.alpine.gems.sutty.nl/
specs:
actioncable (6.1.7)
actionpack (= 6.1.7)
activesupport (= 6.1.7)
actioncable (6.1.7.3)
actionpack (= 6.1.7.3)
activesupport (= 6.1.7.3)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailbox (6.1.7)
actionpack (= 6.1.7)
activejob (= 6.1.7)
activerecord (= 6.1.7)
activestorage (= 6.1.7)
activesupport (= 6.1.7)
actionmailbox (6.1.7.3)
actionpack (= 6.1.7.3)
activejob (= 6.1.7.3)
activerecord (= 6.1.7.3)
activestorage (= 6.1.7.3)
activesupport (= 6.1.7.3)
mail (>= 2.7.1)
actionmailer (6.1.7)
actionpack (= 6.1.7)
actionview (= 6.1.7)
activejob (= 6.1.7)
activesupport (= 6.1.7)
actionmailer (6.1.7.3)
actionpack (= 6.1.7.3)
actionview (= 6.1.7.3)
activejob (= 6.1.7.3)
activesupport (= 6.1.7.3)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (6.1.7)
actionview (= 6.1.7)
activesupport (= 6.1.7)
actionpack (6.1.7.3)
actionview (= 6.1.7.3)
activesupport (= 6.1.7.3)
rack (~> 2.0, >= 2.0.9)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (6.1.7)
actionpack (= 6.1.7)
activerecord (= 6.1.7)
activestorage (= 6.1.7)
activesupport (= 6.1.7)
actiontext (6.1.7.3)
actionpack (= 6.1.7.3)
activerecord (= 6.1.7.3)
activestorage (= 6.1.7.3)
activesupport (= 6.1.7.3)
nokogiri (>= 1.8.5)
actionview (6.1.7)
activesupport (= 6.1.7)
actionview (6.1.7.3)
activesupport (= 6.1.7.3)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
activejob (6.1.7)
activesupport (= 6.1.7)
activejob (6.1.7.3)
activesupport (= 6.1.7.3)
globalid (>= 0.3.6)
activemodel (6.1.7)
activesupport (= 6.1.7)
activerecord (6.1.7)
activemodel (= 6.1.7)
activesupport (= 6.1.7)
activestorage (6.1.7)
actionpack (= 6.1.7)
activejob (= 6.1.7)
activerecord (= 6.1.7)
activesupport (= 6.1.7)
activemodel (6.1.7.3)
activesupport (= 6.1.7.3)
activerecord (6.1.7.3)
activemodel (= 6.1.7.3)
activesupport (= 6.1.7.3)
activestorage (6.1.7.3)
actionpack (= 6.1.7.3)
activejob (= 6.1.7.3)
activerecord (= 6.1.7.3)
activesupport (= 6.1.7.3)
marcel (~> 1.0)
mini_mime (>= 1.1.0)
activesupport (6.1.7)
activesupport (6.1.7.3)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
zeitwerk (~> 2.3)
addressable (2.8.1)
addressable (2.8.4)
public_suffix (>= 2.0.2, < 6.0)
ast (2.4.2)
bcrypt (3.1.18-x86_64-linux-musl)
bcrypt_pbkdf (1.1.0-x86_64-linux-musl)
benchmark-ips (2.10.0)
benchmark-ips (2.12.0)
bindex (0.8.1-x86_64-linux-musl)
blazer (2.6.5)
activerecord (>= 5)
chartkick (>= 3.2)
railties (>= 5)
safely_block (>= 0.1.1)
brakeman (5.4.0)
brakeman (5.4.1)
builder (3.2.4)
capybara (2.18.0)
addressable
@ -107,20 +107,20 @@ GEM
rack (>= 1.0.0)
rack-test (>= 0.5.4)
xpath (>= 2.0, < 4.0)
chartkick (4.2.1)
chartkick (5.0.1)
climate_control (1.2.0)
coderay (1.1.3)
colorator (1.1.0)
commonmarker (0.23.6-x86_64-linux-musl)
concurrent-ruby (1.1.10)
concurrent-ruby-ext (1.1.10-x86_64-linux-musl)
concurrent-ruby (= 1.1.10)
commonmarker (0.23.9-x86_64-linux-musl)
concurrent-ruby (1.2.2)
concurrent-ruby-ext (1.2.2-x86_64-linux-musl)
concurrent-ruby (= 1.2.2)
crass (1.0.6)
cssbundling-rails (1.1.2)
railties (>= 6.0.0)
database_cleaner (2.0.1)
database_cleaner-active_record (~> 2.0.0)
database_cleaner-active_record (2.0.1)
database_cleaner (2.0.2)
database_cleaner-active_record (>= 2, < 3)
database_cleaner-active_record (2.1.0)
activerecord (>= 5.a)
database_cleaner-core (~> 2.0.0)
database_cleaner-core (2.0.1)
@ -138,15 +138,15 @@ GEM
rake (> 10, < 14)
ruby-statistics (>= 2.1)
thor (>= 0.19, < 2)
devise (4.8.1)
devise (4.9.0)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 4.1.0)
responders
warden (~> 1.2.3)
devise-i18n (1.10.2)
devise (>= 4.8.0)
devise_invitable (2.0.6)
devise-i18n (1.11.0)
devise (>= 4.9.0)
devise_invitable (2.0.7)
actionmailer (>= 5.0)
devise (>= 4.6)
distributed-press-api-client (0.2.3)
@ -188,7 +188,7 @@ GEM
dry-inflector (~> 1.0)
dry-logic (~> 1.4)
zeitwerk (~> 2.6)
ed25519 (1.2.4-x86_64-linux-musl)
ed25519 (1.3.0-x86_64-linux-musl)
em-websocket (0.5.3)
eventmachine (>= 0.12.9)
http_parser.rb (~> 0)
@ -213,12 +213,12 @@ GEM
activerecord (>= 4.0.0)
get_process_mem (0.2.7)
ffi (~> 1.0)
globalid (1.0.0)
globalid (1.1.0)
activesupport (>= 5.0)
groupdate (6.1.0)
groupdate (6.2.0)
activesupport (>= 5.2)
hairtrigger (0.2.24)
activerecord (>= 5.0, < 7)
hairtrigger (1.0.0)
activerecord (>= 6.0, < 8)
ruby2ruby (~> 2.4)
ruby_parser (~> 3.10)
haml (6.1.1-x86_64-linux-musl)
@ -227,7 +227,7 @@ GEM
tilt
haml-lint (0.999.999)
haml_lint
haml_lint (0.43.0)
haml_lint (0.45.0)
haml (>= 4.0, < 6.2)
parallel (~> 1.10)
rainbow
@ -246,10 +246,10 @@ GEM
thor
hiredis (0.6.3-x86_64-linux-musl)
http_parser.rb (0.8.0-x86_64-linux-musl)
httparty (0.18.1)
mime-types (~> 3.0)
httparty (0.21.0)
mini_mime (>= 1.0.0)
multi_xml (>= 0.5.2)
i18n (1.12.0)
i18n (1.13.0)
concurrent-ruby (~> 1.0)
icalendar (2.8.0)
ice_cube (~> 0.16)
@ -257,7 +257,7 @@ GEM
image_processing (1.12.2)
mini_magick (>= 4.9.5, < 5)
ruby-vips (>= 2.0.17, < 3)
inline_svg (1.8.0)
inline_svg (1.9.0)
activesupport (>= 3.0)
nokogiri (>= 1.6)
jbuilder (2.11.5)
@ -282,7 +282,7 @@ GEM
commonmarker (~> 0.22)
jekyll-data (1.1.2)
jekyll (>= 3.3, < 5.0.0)
jekyll-images (0.4.0)
jekyll-images (0.4.1)
jekyll (~> 4)
ruby-filemagic (~> 0.7)
ruby-vips (~> 2)
@ -317,22 +317,22 @@ GEM
addressable (~> 2.8)
letter_opener (1.8.1)
launchy (>= 2.2, < 3)
liquid (4.0.3)
listen (3.7.1)
liquid (4.0.4)
listen (3.8.0)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
loaf (0.10.0)
railties (>= 3.2)
lockbox (1.1.1)
lockbox (1.2.0)
lograge (0.12.0)
actionpack (>= 4)
activesupport (>= 4)
railties (>= 4)
request_store (~> 1.0)
loofah (2.19.1)
loofah (2.20.0)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
mail (2.8.0)
mail (2.8.1)
mini_mime (>= 0.1.1)
net-imap
net-pop
@ -341,15 +341,12 @@ GEM
memory_profiler (1.0.1)
mercenary (0.4.0)
method_source (1.0.0)
mime-types (3.4.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2022.0105)
mini_histogram (0.3.1)
mini_magick (4.12.0)
mini_mime (1.1.2)
mini_portile2 (2.8.1)
minitest (5.14.4)
mobility (1.2.4)
minitest (5.18.0)
mobility (1.2.9)
i18n (>= 0.6.10, < 2)
request_store (~> 1.0)
multi_xml (0.6.0)
@ -362,74 +359,75 @@ GEM
timeout
net-smtp (0.3.3)
net-protocol
net-ssh (7.0.1)
net-ssh (7.1.0)
netaddr (2.0.6)
nio4r (2.5.8-x86_64-linux-musl)
nio4r (2.5.9-x86_64-linux-musl)
njalla-api-client (0.2.0)
dry-schema
httparty (~> 0.18)
nokogiri (1.13.10-x86_64-linux-musl)
nokogiri (1.14.4-x86_64-linux-musl)
mini_portile2 (~> 2.8.0)
racc (~> 1.4)
orm_adapter (0.5.0)
pairing_heap (3.0.1)
parallel (1.22.1)
parser (3.1.3.0)
parallel (1.23.0)
parser (3.2.1.1)
ast (~> 2.4.1)
pathutil (0.16.2)
forwardable-extended (~> 2.6)
pg (1.4.5-x86_64-linux-musl)
pg (1.5.3-x86_64-linux-musl)
pg_search (2.3.6)
activerecord (>= 5.2)
activesupport (>= 5.2)
prometheus_exporter (2.0.6)
prometheus_exporter (2.0.8)
webrick
pry (0.14.1)
pry (0.14.2)
coderay (~> 1.1)
method_source (~> 1.0)
public_suffix (5.0.1)
puma (6.0.1-x86_64-linux-musl)
puma (6.2.2-x86_64-linux-musl)
nio4r (~> 2.0)
pundit (2.3.0)
activesupport (>= 3.0.0)
que (2.2.0)
racc (1.6.2-x86_64-linux-musl)
rack (2.2.5)
rack-cors (1.1.1)
rack (2.2.6.4)
rack-cors (2.0.1)
rack (>= 2.0.0)
rack-mini-profiler (3.0.0)
rack (>= 1.2.0)
rack-proxy (0.7.4)
rack-proxy (0.7.6)
rack
rack-test (1.1.0)
rack (>= 1.0, < 3)
rails (6.1.7)
actioncable (= 6.1.7)
actionmailbox (= 6.1.7)
actionmailer (= 6.1.7)
actionpack (= 6.1.7)
actiontext (= 6.1.7)
actionview (= 6.1.7)
activejob (= 6.1.7)
activemodel (= 6.1.7)
activerecord (= 6.1.7)
activestorage (= 6.1.7)
activesupport (= 6.1.7)
rack-test (2.1.0)
rack (>= 1.3)
rails (6.1.7.3)
actioncable (= 6.1.7.3)
actionmailbox (= 6.1.7.3)
actionmailer (= 6.1.7.3)
actionpack (= 6.1.7.3)
actiontext (= 6.1.7.3)
actionview (= 6.1.7.3)
activejob (= 6.1.7.3)
activemodel (= 6.1.7.3)
activerecord (= 6.1.7.3)
activestorage (= 6.1.7.3)
activesupport (= 6.1.7.3)
bundler (>= 1.15.0)
railties (= 6.1.7)
railties (= 6.1.7.3)
sprockets-rails (>= 2.0.0)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
rails-html-sanitizer (1.4.4)
rails-html-sanitizer (1.5.0)
loofah (~> 2.19, >= 2.19.1)
rails-i18n (7.0.6)
i18n (>= 0.7, < 2)
railties (>= 6.0.0, < 8)
rails_warden (0.6.0)
warden (>= 1.2.0)
railties (6.1.7)
actionpack (= 6.1.7)
activesupport (= 6.1.7)
railties (6.1.7.3)
actionpack (= 6.1.7.3)
activesupport (= 6.1.7.3)
method_source
rake (>= 12.2)
thor (~> 1.0)
@ -438,9 +436,9 @@ GEM
rb-fsevent (0.11.2)
rb-inotify (0.10.1)
ffi (~> 1.0)
redis (4.5.1)
redis-actionpack (5.2.0)
actionpack (>= 5, < 7)
redis (4.8.1)
redis-actionpack (5.3.0)
actionpack (>= 5, < 8)
redis-rack (>= 2.1.0, < 3)
redis-store (>= 1.1.0, < 2)
redis-activesupport (5.3.0)
@ -453,67 +451,67 @@ GEM
redis-actionpack (>= 5.0, < 6)
redis-activesupport (>= 5.0, < 6)
redis-store (>= 1.2, < 2)
redis-store (1.9.1)
redis (>= 4, < 5)
reek (6.1.3)
redis-store (1.9.2)
redis (>= 4, < 6)
reek (6.1.4)
kwalify (~> 0.7.0)
parser (~> 3.1.0)
parser (~> 3.2.0)
rainbow (>= 2.0, < 4.0)
regexp_parser (2.6.1)
regexp_parser (2.8.0)
request_store (1.5.1)
rack (>= 1.4)
responders (3.0.1)
actionpack (>= 5.0)
railties (>= 5.0)
responders (3.1.0)
actionpack (>= 5.2)
railties (>= 5.2)
rexml (3.2.5)
rgl (0.6.2)
pairing_heap (>= 0.3.0)
rexml (~> 3.2, >= 3.2.4)
stream (~> 0.5.3)
rouge (3.30.0)
rubocop (1.41.1)
rubocop (1.42.0)
json (~> 2.3)
parallel (~> 1.10)
parser (>= 3.1.2.1)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.23.0, < 2.0)
rubocop-ast (>= 1.24.1, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.24.1)
parser (>= 3.1.1.0)
rubocop-rails (2.17.4)
rubocop-ast (1.28.0)
parser (>= 3.2.1.0)
rubocop-rails (2.18.0)
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 1.33.0, < 2.0)
ruby-filemagic (0.7.3-x86_64-linux-musl)
ruby-progressbar (1.11.0)
ruby-progressbar (1.13.0)
ruby-statistics (3.0.1)
ruby-vips (2.1.4)
ffi (~> 1.12)
ruby2ruby (2.5.0)
ruby_parser (~> 3.1)
sexp_processor (~> 4.6)
ruby_parser (3.19.2)
ruby_parser (3.20.0)
sexp_processor (~> 4.16)
rubyzip (2.3.2)
rugged (1.5.0.1-x86_64-linux-musl)
rugged (1.6.3-x86_64-linux-musl)
safe_yaml (1.0.6)
safely_block (0.3.0)
errbase (>= 0.1.1)
sassc (2.4.0-x86_64-linux-musl)
ffi (~> 1.9)
selenium-webdriver (4.7.1)
selenium-webdriver (4.8.6)
rexml (~> 3.2, >= 3.2.5)
rubyzip (>= 1.2.2, < 3.0)
websocket (~> 1.0)
semantic_range (3.0.0)
sexp_processor (4.16.0)
sexp_processor (4.16.1)
simpleidn (0.2.1)
unf (~> 0.1.4)
sourcemap (0.1.1)
spring (4.1.0)
spring (4.1.1)
spring-watcher-listen (2.1.0)
listen (>= 2.7, < 4.0)
spring (>= 4)
@ -524,28 +522,26 @@ GEM
actionpack (>= 5.2)
activesupport (>= 5.2)
sprockets (>= 3.0.0)
sqlite3 (1.5.4-x86_64-linux-musl)
sqlite3 (1.6.2-x86_64-linux-musl)
mini_portile2 (~> 2.8.0)
stackprof (0.2.23-x86_64-linux-musl)
stackprof (0.2.25-x86_64-linux-musl)
stream (0.5.5)
sucker_punch (3.1.0)
concurrent-ruby (~> 1.0)
sutty-liquid (0.7.4)
sutty-liquid (0.11.10)
fast_blank (~> 1.0)
jekyll (~> 4)
symbol-fstring (1.0.2-x86_64-linux-musl)
sysexits (1.2.0)
temple (0.9.1)
temple (0.10.0)
terminal-table (2.0.0)
unicode-display_width (~> 1.1, >= 1.1.1)
thor (1.2.1)
tilt (2.0.11)
tilt (2.1.0)
timecop (0.9.6)
timeout (0.3.1)
timeout (0.3.2)
turbolinks (5.2.1)
turbolinks-source (~> 5.2)
turbolinks-source (5.2.0)
tzinfo (2.0.5)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unf (0.1.4)
unf_ext
@ -561,19 +557,19 @@ GEM
activemodel (>= 6.0.0)
bindex (>= 0.4.0)
railties (>= 6.0.0)
webpacker (5.4.3)
webpacker (5.4.4)
activesupport (>= 5.2)
rack-proxy (>= 0.6.1)
railties (>= 5.2)
semantic_range (>= 2.3.0)
webrick (1.7.0)
webrick (1.8.1)
websocket (1.2.9)
websocket-driver (0.7.5-x86_64-linux-musl)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
xpath (3.2.0)
nokogiri (~> 1.8)
zeitwerk (2.6.6)
zeitwerk (2.6.8)
PLATFORMS
x86_64-linux-musl
@ -638,6 +634,7 @@ DEPENDENCIES
pry
puma
pundit
que
rack-cors
rack-mini-profiler
rails (~> 6.1.0)
@ -658,7 +655,6 @@ DEPENDENCIES
spring-watcher-listen
sqlite3
stackprof
sucker_punch
sutty-liquid (>= 0.7.3)
symbol-fstring
terminal-table
@ -670,7 +666,7 @@ DEPENDENCIES
yaml_db!
RUBY VERSION
ruby 3.1.3p185
ruby 3.1.4p223
BUNDLED WITH
2.3.26

View file

@ -8,4 +8,4 @@ prometheus: bundle exec prometheus_exporter -b 0.0.0.0 --prefix "sutty_"
distributed_press_tokens_renew: bundle exec rake distributed_press:tokens:renew
cleanup: bundle exec rake cleanup:everything
stats: bundle exec rake stats:process_all
distributed_press_renew_tokens: bundle exec rake distributed_press:tokens:renew
que: daemonize -c /srv/ -p /srv/tmp/que.pid -u rails /usr/local/bin/syslogize bundle exec que

View file

@ -2,7 +2,7 @@
# Base para trabajos
class ApplicationJob < ActiveJob::Base
include SuckerPunch::Job
include Que::ActiveJob::JobExtensions
private

View file

@ -6,8 +6,6 @@ class BacktraceJob < ApplicationJob
EMPTY_SOURCEMAP = { 'mappings' => '' }.freeze
queue_as :low_priority
attr_reader :params, :site_id
def perform(site_id:, params:)

View file

@ -10,8 +10,6 @@ class GitlabNotifierJob < ApplicationJob
# Variables que vamos a acceder luego
attr_reader :exception, :options, :issue_data, :cached
queue_as :low_priority
# @param [Exception] la excepción lanzada
# @param [Hash] opciones de ExceptionNotifier
def perform(exception, **options)

View file

@ -0,0 +1,22 @@
# frozen_string_literal: true
require 'json/add/exception'
module ActiveJob
module Serializers
class ExceptionSerializer < ObjectSerializer # :nodoc:
def serialize(ex)
super('value' => { 'class' => ex.class.name, 'exception' => ex.as_json })
end
def deserialize(hash)
hash.dig('value', 'class').constantize.json_create(hash.dig('value', 'exception'))
end
private
def klass
Exception
end
end
end
end

View file

@ -39,6 +39,12 @@ module Sutty
config.active_storage.variant_processor = :vips
config.active_storage.web_image_content_types << 'image/webp'
# Que
config.action_mailer.deliver_later_queue_name = :default
config.active_storage.queues.analysis = :default
config.active_storage.queues.purge = :default
config.active_job.queue_adapter = :que
config.to_prepare do
# Load application's model / class decorators
Dir.glob(File.join(File.dirname(__FILE__), '..', 'app', '**', '*_decorator.rb')).sort.each do |c|

View file

@ -64,11 +64,6 @@ Rails.application.configure do
# Use a different cache store in production.
config.cache_store = :redis_cache_store, { url: ENV['REDIS_SERVER'] }
# Use a real queuing backend for Active Job (and separate queues per
# environment)
config.active_job.queue_adapter = :sucker_punch
config.active_job.queue_name_prefix = "sutty_#{Rails.env}"
config.action_mailer.perform_caching = false
# Ignore bad email addresses and do not raise email delivery errors.

View file

@ -1,6 +0,0 @@
# frozen_string_literal: true
# Enviar una notificación cuando falla una tarea
SuckerPunch.exception_handler = lambda { |ex, _, args|
ExceptionNotifier.notify_exception(ex, data: args.last)
}

View file

@ -0,0 +1,12 @@
# frozen_string_literal: true
# Que
class CreateQueTables < ActiveRecord::Migration[6.1]
def up
Que.migrate! version: 7
end
def down
Que.migrate! version: 0
end
end

View file

@ -19,7 +19,6 @@ check program stats
every "0 1 * * *"
if status != 0 then alert
check program distributed_press_tokens_renew
with path "/usr/bin/foreman run -f /srv/Procfile -d /srv distributed_press_tokens_renew" as uid "rails" gid "www-data"
every "0 3 * * *"
if status != 0 then alert
check process que with pidfile /srv/tmp/que.pid
start program = "/usr/bin/foreman run -f /srv/Procfile -d /srv que"
stop program = "/bin/sh -c 'cat /srv/tmp/que.pid | xargs -r kill'"