Merge branch 'chore/db_configs' into live
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
commit
dad7d5195e
@ -1,6 +1,15 @@
|
|||||||
# PRIMARY_DOMAIN=kosmos.org
|
# PRIMARY_DOMAIN=kosmos.org
|
||||||
# AKKOUNTS_DOMAIN=accounts.example.com
|
# AKKOUNTS_DOMAIN=accounts.example.com
|
||||||
|
|
||||||
|
# The default backend is SQLite
|
||||||
|
# DB_ADAPTER=postgresql
|
||||||
|
# PG_HOST=localhost
|
||||||
|
# PG_PORT=5432
|
||||||
|
# PG_DATABASE=akkounts
|
||||||
|
# PG_DATABASE_QUEUE=akkounts_queue
|
||||||
|
# PG_USERNAME=akkounts
|
||||||
|
# PG_PASSWORD=
|
||||||
|
|
||||||
# SMTP_SERVER=smtp.example.com
|
# SMTP_SERVER=smtp.example.com
|
||||||
# SMTP_PORT=587
|
# SMTP_PORT=587
|
||||||
# SMTP_LOGIN=accounts
|
# SMTP_LOGIN=accounts
|
||||||
|
9
Gemfile
9
Gemfile
@ -4,7 +4,7 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
|
|||||||
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
|
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
|
||||||
gem 'rails', '~> 8.0'
|
gem 'rails', '~> 8.0'
|
||||||
# Use Puma as the app server
|
# Use Puma as the app server
|
||||||
gem 'puma', '~> 4.1'
|
gem 'puma', '~> 6.6'
|
||||||
# View components
|
# View components
|
||||||
gem "view_component"
|
gem "view_component"
|
||||||
# Asset bundler
|
# Asset bundler
|
||||||
@ -19,8 +19,6 @@ gem "turbo-rails"
|
|||||||
gem "stimulus-rails"
|
gem "stimulus-rails"
|
||||||
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
|
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
|
||||||
gem 'jbuilder', '~> 2.7'
|
gem 'jbuilder', '~> 2.7'
|
||||||
# Use Redis adapter to run Action Cable in production
|
|
||||||
# gem 'redis', '~> 4.0'
|
|
||||||
# Use Active Model has_secure_password
|
# Use Active Model has_secure_password
|
||||||
gem 'bcrypt', '~> 3.1'
|
gem 'bcrypt', '~> 3.1'
|
||||||
|
|
||||||
@ -53,8 +51,8 @@ gem 'down'
|
|||||||
gem 'aws-sdk-s3', require: false
|
gem 'aws-sdk-s3', require: false
|
||||||
|
|
||||||
# Background/scheduled jobs
|
# Background/scheduled jobs
|
||||||
gem 'sidekiq', '< 7'
|
gem 'solid_queue'
|
||||||
gem 'sidekiq-scheduler'
|
gem "mission_control-jobs"
|
||||||
|
|
||||||
# Monitoring
|
# Monitoring
|
||||||
gem "sentry-ruby"
|
gem "sentry-ruby"
|
||||||
@ -65,6 +63,7 @@ gem 'discourse_api'
|
|||||||
gem "lnurl"
|
gem "lnurl"
|
||||||
gem 'manifique', '~> 1.1.0'
|
gem 'manifique', '~> 1.1.0'
|
||||||
gem 'nostr', '~> 0.6.0'
|
gem 'nostr', '~> 0.6.0'
|
||||||
|
gem "redis", "~> 5.4"
|
||||||
|
|
||||||
group :development, :test do
|
group :development, :test do
|
||||||
# Use sqlite3 as the database for Active Record
|
# Use sqlite3 as the database for Active Record
|
||||||
|
41
Gemfile.lock
41
Gemfile.lock
@ -265,6 +265,16 @@ GEM
|
|||||||
mini_mime (1.1.5)
|
mini_mime (1.1.5)
|
||||||
mini_portile2 (2.8.8)
|
mini_portile2 (2.8.8)
|
||||||
minitest (5.25.5)
|
minitest (5.25.5)
|
||||||
|
mission_control-jobs (1.0.2)
|
||||||
|
actioncable (>= 7.1)
|
||||||
|
actionpack (>= 7.1)
|
||||||
|
activejob (>= 7.1)
|
||||||
|
activerecord (>= 7.1)
|
||||||
|
importmap-rails (>= 1.2.1)
|
||||||
|
irb (~> 1.13)
|
||||||
|
railties (>= 7.1)
|
||||||
|
stimulus-rails
|
||||||
|
turbo-rails
|
||||||
multipart-post (2.4.1)
|
multipart-post (2.4.1)
|
||||||
net-http (0.6.0)
|
net-http (0.6.0)
|
||||||
uri
|
uri
|
||||||
@ -315,7 +325,7 @@ GEM
|
|||||||
date
|
date
|
||||||
stringio
|
stringio
|
||||||
public_suffix (6.0.1)
|
public_suffix (6.0.1)
|
||||||
puma (4.3.12)
|
puma (6.6.0)
|
||||||
nio4r (~> 2.0)
|
nio4r (~> 2.0)
|
||||||
raabro (1.4.0)
|
raabro (1.4.0)
|
||||||
racc (1.8.1)
|
racc (1.8.1)
|
||||||
@ -375,7 +385,10 @@ GEM
|
|||||||
logger
|
logger
|
||||||
rdoc (6.13.1)
|
rdoc (6.13.1)
|
||||||
psych (>= 4.0.0)
|
psych (>= 4.0.0)
|
||||||
redis (4.8.1)
|
redis (5.4.0)
|
||||||
|
redis-client (>= 0.22.0)
|
||||||
|
redis-client (0.24.0)
|
||||||
|
connection_pool
|
||||||
regexp_parser (2.10.0)
|
regexp_parser (2.10.0)
|
||||||
reline (0.6.1)
|
reline (0.6.1)
|
||||||
io-console (~> 0.5)
|
io-console (~> 0.5)
|
||||||
@ -424,8 +437,6 @@ GEM
|
|||||||
ruby-vips (2.2.3)
|
ruby-vips (2.2.3)
|
||||||
ffi (~> 1.12)
|
ffi (~> 1.12)
|
||||||
logger
|
logger
|
||||||
rufus-scheduler (3.9.2)
|
|
||||||
fugit (~> 1.1, >= 1.11.1)
|
|
||||||
sanitize (7.0.0)
|
sanitize (7.0.0)
|
||||||
crass (~> 1.0.2)
|
crass (~> 1.0.2)
|
||||||
nokogiri (>= 1.16.8)
|
nokogiri (>= 1.16.8)
|
||||||
@ -436,14 +447,6 @@ GEM
|
|||||||
sentry-ruby (5.23.0)
|
sentry-ruby (5.23.0)
|
||||||
bigdecimal
|
bigdecimal
|
||||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||||
sidekiq (6.5.12)
|
|
||||||
connection_pool (>= 2.2.5, < 3)
|
|
||||||
rack (~> 2.0)
|
|
||||||
redis (>= 4.5.0, < 5)
|
|
||||||
sidekiq-scheduler (5.0.6)
|
|
||||||
rufus-scheduler (~> 3.2)
|
|
||||||
sidekiq (>= 6, < 8)
|
|
||||||
tilt (>= 1.4.0, < 3)
|
|
||||||
solargraph (0.54.2)
|
solargraph (0.54.2)
|
||||||
backport (~> 1.2)
|
backport (~> 1.2)
|
||||||
benchmark (~> 0.4)
|
benchmark (~> 0.4)
|
||||||
@ -463,6 +466,13 @@ GEM
|
|||||||
tilt (~> 2.0)
|
tilt (~> 2.0)
|
||||||
yard (~> 0.9, >= 0.9.24)
|
yard (~> 0.9, >= 0.9.24)
|
||||||
yard-solargraph (~> 0.1)
|
yard-solargraph (~> 0.1)
|
||||||
|
solid_queue (1.1.5)
|
||||||
|
activejob (>= 7.1)
|
||||||
|
activerecord (>= 7.1)
|
||||||
|
concurrent-ruby (>= 1.3.1)
|
||||||
|
fugit (~> 1.11.0)
|
||||||
|
railties (>= 7.1)
|
||||||
|
thor (~> 1.3.1)
|
||||||
sqlite3 (2.6.0)
|
sqlite3 (2.6.0)
|
||||||
mini_portile2 (~> 2.8.0)
|
mini_portile2 (~> 2.8.0)
|
||||||
sqlite3 (2.6.0-arm64-darwin)
|
sqlite3 (2.6.0-arm64-darwin)
|
||||||
@ -543,22 +553,23 @@ DEPENDENCIES
|
|||||||
lnurl
|
lnurl
|
||||||
lockbox
|
lockbox
|
||||||
manifique (~> 1.1.0)
|
manifique (~> 1.1.0)
|
||||||
|
mission_control-jobs
|
||||||
net-ldap
|
net-ldap
|
||||||
nostr (~> 0.6.0)
|
nostr (~> 0.6.0)
|
||||||
pagy (~> 6.0, >= 6.0.2)
|
pagy (~> 6.0, >= 6.0.2)
|
||||||
pg (~> 1.5)
|
pg (~> 1.5)
|
||||||
propshaft
|
propshaft
|
||||||
puma (~> 4.1)
|
puma (~> 6.6)
|
||||||
rails (~> 8.0)
|
rails (~> 8.0)
|
||||||
rails-controller-testing
|
rails-controller-testing
|
||||||
rails-settings-cached (~> 2.8.3)
|
rails-settings-cached (~> 2.8.3)
|
||||||
|
redis (~> 5.4)
|
||||||
rqrcode (~> 2.0)
|
rqrcode (~> 2.0)
|
||||||
rspec-rails
|
rspec-rails
|
||||||
sentry-rails
|
sentry-rails
|
||||||
sentry-ruby
|
sentry-ruby
|
||||||
sidekiq (< 7)
|
|
||||||
sidekiq-scheduler
|
|
||||||
solargraph
|
solargraph
|
||||||
|
solid_queue
|
||||||
sqlite3 (>= 2.1)
|
sqlite3 (>= 2.1)
|
||||||
stimulus-rails
|
stimulus-rails
|
||||||
turbo-rails
|
turbo-rails
|
||||||
|
@ -57,7 +57,7 @@ Running the test suite:
|
|||||||
Running the test suite with Docker Compose requires overriding the Rails
|
Running the test suite with Docker Compose requires overriding the Rails
|
||||||
environment:
|
environment:
|
||||||
|
|
||||||
docker-compose run -e "RAILS_ENV=test" web rspec
|
docker-compose exec -e "RAILS_ENV=test" web rspec
|
||||||
|
|
||||||
### Docker Compose
|
### Docker Compose
|
||||||
|
|
||||||
|
@ -3,8 +3,6 @@ class RemoteStorageExpireAuthorizationJob < ApplicationJob
|
|||||||
|
|
||||||
def perform(rs_auth_id)
|
def perform(rs_auth_id)
|
||||||
rs_auth = RemoteStorageAuthorization.find rs_auth_id
|
rs_auth = RemoteStorageAuthorization.find rs_auth_id
|
||||||
return unless rs_auth.expire_at.nil? || rs_auth.expire_at <= DateTime.now
|
|
||||||
|
|
||||||
rs_auth.destroy!
|
rs_auth.destroy!
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -69,11 +69,19 @@ class RemoteStorageAuthorization < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def remove_token_expiry_job
|
def remove_token_expiry_job
|
||||||
queue = Sidekiq::Queue.new(RemoteStorageExpireAuthorizationJob.queue_name)
|
job_class = RemoteStorageExpireAuthorizationJob
|
||||||
queue.each do |job|
|
job_args = [id]
|
||||||
next unless job.display_class == "RemoteStorageExpireAuthorizationJob"
|
|
||||||
job.delete if job.display_args == [id]
|
query = SolidQueue::Job.where(class_name: job_class.to_s)
|
||||||
end
|
|
||||||
|
case ActiveRecord::Base.connection.adapter_name.downcase
|
||||||
|
when /sqlite/
|
||||||
|
query.where("json_extract(arguments, '$.arguments') = ?", job_args.to_json)
|
||||||
|
when /postgres/
|
||||||
|
query.where("arguments->>'arguments' = ?", job_args.to_json)
|
||||||
|
else
|
||||||
|
raise "Unsupported database adapter"
|
||||||
|
end.destroy_all
|
||||||
end
|
end
|
||||||
|
|
||||||
def find_or_create_web_app
|
def find_or_create_web_app
|
||||||
|
6
bin/jobs
Executable file
6
bin/jobs
Executable file
@ -0,0 +1,6 @@
|
|||||||
|
#!/usr/bin/env ruby
|
||||||
|
|
||||||
|
require_relative "../config/environment"
|
||||||
|
require "solid_queue/cli"
|
||||||
|
|
||||||
|
SolidQueue::Cli.start(ARGV)
|
@ -47,7 +47,8 @@ module Akkounts
|
|||||||
g.stylesheets false
|
g.stylesheets false
|
||||||
end
|
end
|
||||||
|
|
||||||
config.active_job.queue_adapter = :sidekiq
|
config.active_job.queue_adapter = :solid_queue
|
||||||
|
config.mission_control.jobs.http_basic_auth_enabled = false
|
||||||
|
|
||||||
config.action_mailer.deliver_later_queue_name = nil # use "default" queue
|
config.action_mailer.deliver_later_queue_name = nil # use "default" queue
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
tmI5vm7qZhaigr52jEBVWkRdj+EE+9OmPh3vWXC7kA/OHuuucpr7SodychuMkQDPLM0BLk88LFsqvRIR+mqnLWpRC+P9aeUFE6ohxSWzcAd7Y4sgxUD8zpCRPndrwTw0hxXXj1WZSYeWn4BoAB34aV+gYen2MajZF3a95hJGtS5yjgWxvLVkQQKqRDfykkfX6fCS0BPo5X7sT7m4xwCATD/D4219wajm5W3TIdkriHtwt28ZLspaRWA5e0UkzKf8+/Gaj2CrW7UWcvew8R93zQ5RA2/Sp3sDTVN+kLz9I9Q095lQC0ywCAEFYHeKmc2tjrzqRaAAWu06xmWLqGIg21G+A/UU9lUJOkIpxQACWoOfS2IoXR1nXhgXMopkz3aCBXDxKw554v4H2QyOceOsuRf2C685ibMqzQkKMmJ4tcbiOJL77DUc08JTjB8Dq4Ohr8sMzXbV/hATevjYoRP0XarLekqhLv90ZLuIVY16DwB0CzACeNBKeKbeLqJF51upRRWgi+gTbYpV04yUwnXdyssF8mydWocgihrTryBi8F6PsuhBGcaYdP+0yibnGxDCC4x2rupbBfMj2OIX7pYzgtIHB3Eo954Y+bCoggqbE/Qrb9VVXNMgtKgLt8EGWU2tg6wl9QicitIq87uLDAade93zTn6rmcKPywjMDo6jbVIs653ZdUhiKdHGdpnJccbgQ/iLSPB1umNnCeaEX5jM+K9zBvl7ZMCdSk1YIQ==--ekKumqLiSlVJNwMe--K/ecXmmMT1x+WnIXMbHBDw==
|
zaTF2ZJaU/M9CYmXEJoDmS1oniSV/1YT0UnM1jysEhMknn3bYOzRBZM3eGJ5Mr6bJYz6cv5hSDL5pT0/6hqgpV04dc/fVDplWO4eEpD1kBFM3LjIPCe9REbRlRUwODpoV/y6wWOFme8nFMS9uOSFkL6RtMuQli0os5Rp+2Jal2lJwAujFjFwuuj+1iRzqc3pzeIIy0clPmR9ANxXS+rPL3jmxty6QzVMr9Q658roVD38yRg0CNgs09eZ/FvqeqXlQkwDfg2/zX9tg5ocGwvHzmicZJ/yU6kl6liqNAJvEDrolm0gSzemY8NfhCySd5wjEvpP+uvKxbd5M3rhagC8S9MmpmxewuOKbDFEyTSRO6Kp2yakdcLSn12ZPB+X0nlMRno+UEzh0EvcX2mxRXppIKrsRUGVeYmj4GMI0vyLW1eCuyPLueN7sOnSjhtM84URNWkSnb0LTxlYxOJGbnwzn85QVpFdXtDktbaXvMWcVdH9XdMDbaBs1G7BIA6Z8i+mxLVVEbQWQM6VBrUhpkpWfphLmN5b16LYbGTzdKnR0iPcsNr8Tsl8vYfeWH8S0ujD105lS39v37YimN6E5l4X2CrqG+DNBtKfbqC0E3lhZMqDRWetxzaxE47oe4g=--0EKrvwe2YTfsbssz--SbmUH0sMiy5uUhpxFImgMA==
|
@ -1,21 +1,37 @@
|
|||||||
default: &default
|
default: &default
|
||||||
adapter: sqlite3
|
adapter: <%= ENV["DB_ADAPTER"] || "sqlite3" %>
|
||||||
pool: <%= ENV["DB_POOL"] || ENV['MAX_THREADS'] || 5 %>
|
pool: <%= ENV["DB_POOL"] || ENV['MAX_THREADS'] || 5 %>
|
||||||
timeout: 5000
|
timeout: 5000
|
||||||
|
<% if ENV["DB_ADAPTER"] == "postgresql" %>
|
||||||
|
host: <%= ENV["PG_HOST"] || 'localhost' %>
|
||||||
|
port: <%= ENV["PG_PORT"] || 5432 %>
|
||||||
|
username: <%= ENV["PG_USERNAME"] || 'akkounts' %>
|
||||||
|
password: <%= ENV["PG_PASSWORD"] %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<% if ENV["LNDHUB_PG_HOST"].present? %>
|
||||||
|
lndhub: &lndhub
|
||||||
|
adapter: postgresql
|
||||||
|
database_tasks: false
|
||||||
|
host: <%= ENV["LNDHUB_PG_HOST"] %>
|
||||||
|
port: <%= ENV["LNDHUB_PG_PORT"] || 5432 %>
|
||||||
|
database: <%= ENV["LNDHUB_PG_DATABASE"] || 'lndhub' %>
|
||||||
|
username: <%= ENV["LNDHUB_PG_USERNAME"] || 'lndhub' %>
|
||||||
|
password: <%= ENV["LNDHUB_PG_PASSWORD"] %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
development:
|
development:
|
||||||
primary:
|
primary:
|
||||||
<<: *default
|
<<: *default
|
||||||
database: db/development.sqlite3
|
database: <%= ENV["DB_ADAPTER"] == "postgresql" ? ENV["PG_DATABASE"] : "db/development.sqlite3" %>
|
||||||
lndhub:
|
queue:
|
||||||
<<: *default
|
<<: *default
|
||||||
adapter: postgresql
|
database: <%= ENV["DB_ADAPTER"] == "postgresql" ? ENV["PG_DATABASE_QUEUE"] : "db/development_queue.sqlite3" %>
|
||||||
database_tasks: false
|
migrations_paths: db/queue_migrate
|
||||||
host: <%= ENV["LNDHUB_PG_HOST"] || 'localhost' %>
|
<% if ENV["LNDHUB_PG_HOST"].present? %>
|
||||||
port: <%= ENV["LNDHUB_PG_PORT"] || 5432 %>
|
lndhub:
|
||||||
database: <%= ENV["LNDHUB_PG_DATABASE"] || 'lndhub' %>
|
<<: *lndhub
|
||||||
username: <%= ENV["LNDHUB_PG_USERNAME"] || 'lndhub' %>
|
<% end %>
|
||||||
password: <%= ENV["LNDHUB_PG_PASSWORD"] %>
|
|
||||||
|
|
||||||
# Warning: The database defined as "test" will be erased and
|
# Warning: The database defined as "test" will be erased and
|
||||||
# re-generated from your development database when you run "rake".
|
# re-generated from your development database when you run "rake".
|
||||||
@ -32,18 +48,12 @@ test:
|
|||||||
production:
|
production:
|
||||||
primary:
|
primary:
|
||||||
<<: *default
|
<<: *default
|
||||||
adapter: postgresql
|
database: <%= ENV["DB_ADAPTER"] == "postgresql" ? ENV["PG_DATABASE"] : "db/production.sqlite3" %>
|
||||||
database: akkounts
|
queue:
|
||||||
port: 5432
|
|
||||||
host: <%= Rails.application.credentials.postgres[:host] rescue nil %>
|
|
||||||
username: <%= Rails.application.credentials.postgres[:username] rescue nil %>
|
|
||||||
password: <%= Rails.application.credentials.postgres[:password] rescue nil %>
|
|
||||||
lndhub:
|
|
||||||
<<: *default
|
<<: *default
|
||||||
adapter: postgresql
|
database: <%= ENV["DB_ADAPTER"] == "postgresql" ? ENV["PG_DATABASE_QUEUE"] : "db/production_queue.sqlite3" %>
|
||||||
database_tasks: false
|
migrations_paths: db/queue_migrate
|
||||||
host: <%= ENV["LNDHUB_PG_HOST"] || 'localhost' %>
|
<% if ENV["LNDHUB_PG_HOST"].present? %>
|
||||||
port: <%= ENV["LNDHUB_PG_PORT"] || 5432 %>
|
lndhub:
|
||||||
database: <%= ENV["LNDHUB_PG_DATABASE"] || 'lndhub' %>
|
<<: *lndhub
|
||||||
username: <%= ENV["LNDHUB_PG_USERNAME"] || 'lndhub' %>
|
<% end %>
|
||||||
password: <%= ENV["LNDHUB_PG_PASSWORD"] %>
|
|
||||||
|
@ -54,6 +54,9 @@ Rails.application.configure do
|
|||||||
# Highlight code that enqueued background job in logs.
|
# Highlight code that enqueued background job in logs.
|
||||||
config.active_job.verbose_enqueue_logs = true
|
config.active_job.verbose_enqueue_logs = true
|
||||||
|
|
||||||
|
# Solid Queue database
|
||||||
|
config.solid_queue.connects_to = { database: { writing: :queue } }
|
||||||
|
|
||||||
# Suppress logger output for asset requests.
|
# Suppress logger output for asset requests.
|
||||||
# config.assets.quiet = true
|
# config.assets.quiet = true
|
||||||
|
|
||||||
|
@ -54,8 +54,9 @@ Rails.application.configure do
|
|||||||
# Replace the default in-process memory cache store with a durable alternative.
|
# Replace the default in-process memory cache store with a durable alternative.
|
||||||
# config.cache_store = :mem_cache_store
|
# config.cache_store = :mem_cache_store
|
||||||
|
|
||||||
# Replace the default in-process and non-durable queuing backend for Active Job.
|
# Solid Queue database
|
||||||
# config.active_job.queue_adapter = :resque
|
config.solid_queue.connects_to = { database: { writing: :queue } }
|
||||||
|
|
||||||
# E-mail settings, adapted from https://github.com/mastodon/mastodon
|
# E-mail settings, adapted from https://github.com/mastodon/mastodon
|
||||||
|
|
||||||
outgoing_email_address = ENV.fetch('SMTP_FROM_ADDRESS', 'accounts@localhost')
|
outgoing_email_address = ENV.fetch('SMTP_FROM_ADDRESS', 'accounts@localhost')
|
||||||
|
11
config/initializers/devise_rails8_patch.rb
Normal file
11
config/initializers/devise_rails8_patch.rb
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
# See https://alvincrespo.hashnode.dev/rails-8s-lazy-route-loading-devise
|
||||||
|
# TODO remove when Devise is fixed
|
||||||
|
require 'devise'
|
||||||
|
Devise # make sure it's already loaded
|
||||||
|
|
||||||
|
module Devise
|
||||||
|
def self.mappings
|
||||||
|
Rails.application.try(:reload_routes_unless_loaded)
|
||||||
|
@@mappings
|
||||||
|
end
|
||||||
|
end
|
@ -1,5 +0,0 @@
|
|||||||
require_relative "../../app/models/setting"
|
|
||||||
|
|
||||||
Sidekiq.configure_server do |config|
|
|
||||||
config.redis = { url: Setting.redis_url }
|
|
||||||
end
|
|
21
config/queue.yml
Normal file
21
config/queue.yml
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
default: &default
|
||||||
|
dispatchers:
|
||||||
|
- polling_interval: 1
|
||||||
|
batch_size: 500
|
||||||
|
workers:
|
||||||
|
- queues: "*"
|
||||||
|
threads: 3
|
||||||
|
processes: <%= ENV.fetch("JOB_CONCURRENCY", 1) %>
|
||||||
|
polling_interval: 0.1
|
||||||
|
|
||||||
|
development:
|
||||||
|
<<: *default
|
||||||
|
workers:
|
||||||
|
- queues: "*"
|
||||||
|
threads: 1
|
||||||
|
|
||||||
|
test:
|
||||||
|
<<: *default
|
||||||
|
|
||||||
|
production:
|
||||||
|
<<: *default
|
10
config/recurring.yml
Normal file
10
config/recurring.yml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
# production:
|
||||||
|
# periodic_cleanup:
|
||||||
|
# class: CleanSoftDeletedRecordsJob
|
||||||
|
# queue: background
|
||||||
|
# args: [ 1000, { batch_size: 500 } ]
|
||||||
|
# schedule: every hour
|
||||||
|
# periodic_command:
|
||||||
|
# command: "SoftDeletedRecord.due.delete_all"
|
||||||
|
# priority: 2
|
||||||
|
# schedule: at 5am every day
|
@ -1,5 +1,3 @@
|
|||||||
require 'sidekiq/web'
|
|
||||||
|
|
||||||
Rails.application.routes.draw do
|
Rails.application.routes.draw do
|
||||||
devise_for :users, controllers: {
|
devise_for :users, controllers: {
|
||||||
confirmations: 'users/confirmations',
|
confirmations: 'users/confirmations',
|
||||||
@ -123,7 +121,7 @@ Rails.application.routes.draw do
|
|||||||
end
|
end
|
||||||
|
|
||||||
authenticate :user, ->(user) { user.is_admin? } do
|
authenticate :user, ->(user) { user.is_admin? } do
|
||||||
mount Sidekiq::Web, at: '/sidekiq'
|
mount MissionControl::Jobs::Engine, at: "/jobs"
|
||||||
mount Flipper::UI.app(Flipper), at: '/flipper'
|
mount Flipper::UI.app(Flipper), at: '/flipper'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
129
db/queue_schema.rb
Normal file
129
db/queue_schema.rb
Normal file
@ -0,0 +1,129 @@
|
|||||||
|
ActiveRecord::Schema[7.1].define(version: 1) do
|
||||||
|
create_table "solid_queue_blocked_executions", force: :cascade do |t|
|
||||||
|
t.bigint "job_id", null: false
|
||||||
|
t.string "queue_name", null: false
|
||||||
|
t.integer "priority", default: 0, null: false
|
||||||
|
t.string "concurrency_key", null: false
|
||||||
|
t.datetime "expires_at", null: false
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.index [ "concurrency_key", "priority", "job_id" ], name: "index_solid_queue_blocked_executions_for_release"
|
||||||
|
t.index [ "expires_at", "concurrency_key" ], name: "index_solid_queue_blocked_executions_for_maintenance"
|
||||||
|
t.index [ "job_id" ], name: "index_solid_queue_blocked_executions_on_job_id", unique: true
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "solid_queue_claimed_executions", force: :cascade do |t|
|
||||||
|
t.bigint "job_id", null: false
|
||||||
|
t.bigint "process_id"
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.index [ "job_id" ], name: "index_solid_queue_claimed_executions_on_job_id", unique: true
|
||||||
|
t.index [ "process_id", "job_id" ], name: "index_solid_queue_claimed_executions_on_process_id_and_job_id"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "solid_queue_failed_executions", force: :cascade do |t|
|
||||||
|
t.bigint "job_id", null: false
|
||||||
|
t.text "error"
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.index [ "job_id" ], name: "index_solid_queue_failed_executions_on_job_id", unique: true
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "solid_queue_jobs", force: :cascade do |t|
|
||||||
|
t.string "queue_name", null: false
|
||||||
|
t.string "class_name", null: false
|
||||||
|
t.text "arguments"
|
||||||
|
t.integer "priority", default: 0, null: false
|
||||||
|
t.string "active_job_id"
|
||||||
|
t.datetime "scheduled_at"
|
||||||
|
t.datetime "finished_at"
|
||||||
|
t.string "concurrency_key"
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.datetime "updated_at", null: false
|
||||||
|
t.index [ "active_job_id" ], name: "index_solid_queue_jobs_on_active_job_id"
|
||||||
|
t.index [ "class_name" ], name: "index_solid_queue_jobs_on_class_name"
|
||||||
|
t.index [ "finished_at" ], name: "index_solid_queue_jobs_on_finished_at"
|
||||||
|
t.index [ "queue_name", "finished_at" ], name: "index_solid_queue_jobs_for_filtering"
|
||||||
|
t.index [ "scheduled_at", "finished_at" ], name: "index_solid_queue_jobs_for_alerting"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "solid_queue_pauses", force: :cascade do |t|
|
||||||
|
t.string "queue_name", null: false
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.index [ "queue_name" ], name: "index_solid_queue_pauses_on_queue_name", unique: true
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "solid_queue_processes", force: :cascade do |t|
|
||||||
|
t.string "kind", null: false
|
||||||
|
t.datetime "last_heartbeat_at", null: false
|
||||||
|
t.bigint "supervisor_id"
|
||||||
|
t.integer "pid", null: false
|
||||||
|
t.string "hostname"
|
||||||
|
t.text "metadata"
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.string "name", null: false
|
||||||
|
t.index [ "last_heartbeat_at" ], name: "index_solid_queue_processes_on_last_heartbeat_at"
|
||||||
|
t.index [ "name", "supervisor_id" ], name: "index_solid_queue_processes_on_name_and_supervisor_id", unique: true
|
||||||
|
t.index [ "supervisor_id" ], name: "index_solid_queue_processes_on_supervisor_id"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "solid_queue_ready_executions", force: :cascade do |t|
|
||||||
|
t.bigint "job_id", null: false
|
||||||
|
t.string "queue_name", null: false
|
||||||
|
t.integer "priority", default: 0, null: false
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.index [ "job_id" ], name: "index_solid_queue_ready_executions_on_job_id", unique: true
|
||||||
|
t.index [ "priority", "job_id" ], name: "index_solid_queue_poll_all"
|
||||||
|
t.index [ "queue_name", "priority", "job_id" ], name: "index_solid_queue_poll_by_queue"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "solid_queue_recurring_executions", force: :cascade do |t|
|
||||||
|
t.bigint "job_id", null: false
|
||||||
|
t.string "task_key", null: false
|
||||||
|
t.datetime "run_at", null: false
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.index [ "job_id" ], name: "index_solid_queue_recurring_executions_on_job_id", unique: true
|
||||||
|
t.index [ "task_key", "run_at" ], name: "index_solid_queue_recurring_executions_on_task_key_and_run_at", unique: true
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "solid_queue_recurring_tasks", force: :cascade do |t|
|
||||||
|
t.string "key", null: false
|
||||||
|
t.string "schedule", null: false
|
||||||
|
t.string "command", limit: 2048
|
||||||
|
t.string "class_name"
|
||||||
|
t.text "arguments"
|
||||||
|
t.string "queue_name"
|
||||||
|
t.integer "priority", default: 0
|
||||||
|
t.boolean "static", default: true, null: false
|
||||||
|
t.text "description"
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.datetime "updated_at", null: false
|
||||||
|
t.index [ "key" ], name: "index_solid_queue_recurring_tasks_on_key", unique: true
|
||||||
|
t.index [ "static" ], name: "index_solid_queue_recurring_tasks_on_static"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "solid_queue_scheduled_executions", force: :cascade do |t|
|
||||||
|
t.bigint "job_id", null: false
|
||||||
|
t.string "queue_name", null: false
|
||||||
|
t.integer "priority", default: 0, null: false
|
||||||
|
t.datetime "scheduled_at", null: false
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.index [ "job_id" ], name: "index_solid_queue_scheduled_executions_on_job_id", unique: true
|
||||||
|
t.index [ "scheduled_at", "priority", "job_id" ], name: "index_solid_queue_dispatch_all"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "solid_queue_semaphores", force: :cascade do |t|
|
||||||
|
t.string "key", null: false
|
||||||
|
t.integer "value", default: 1, null: false
|
||||||
|
t.datetime "expires_at", null: false
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.datetime "updated_at", null: false
|
||||||
|
t.index [ "expires_at" ], name: "index_solid_queue_semaphores_on_expires_at"
|
||||||
|
t.index [ "key", "value" ], name: "index_solid_queue_semaphores_on_key_and_value"
|
||||||
|
t.index [ "key" ], name: "index_solid_queue_semaphores_on_key", unique: true
|
||||||
|
end
|
||||||
|
|
||||||
|
add_foreign_key "solid_queue_blocked_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
|
||||||
|
add_foreign_key "solid_queue_claimed_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
|
||||||
|
add_foreign_key "solid_queue_failed_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
|
||||||
|
add_foreign_key "solid_queue_ready_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
|
||||||
|
add_foreign_key "solid_queue_recurring_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
|
||||||
|
add_foreign_key "solid_queue_scheduled_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
|
||||||
|
end
|
@ -37,6 +37,9 @@ services:
|
|||||||
- "3000:3000"
|
- "3000:3000"
|
||||||
environment:
|
environment:
|
||||||
RAILS_ENV: development
|
RAILS_ENV: development
|
||||||
|
SOLID_QUEUE_IN_PUMA: true
|
||||||
|
LAUNCHY_DRY_RUN: true
|
||||||
|
BROWSER: /dev/null
|
||||||
PRIMARY_DOMAIN: kosmos.org
|
PRIMARY_DOMAIN: kosmos.org
|
||||||
LDAP_HOST: ldap
|
LDAP_HOST: ldap
|
||||||
LDAP_PORT: 3389
|
LDAP_PORT: 3389
|
||||||
@ -54,30 +57,6 @@ services:
|
|||||||
- ldap
|
- ldap
|
||||||
- redis
|
- redis
|
||||||
|
|
||||||
sidekiq:
|
|
||||||
build: .
|
|
||||||
command: bash -c "bundle exec sidekiq -C config/sidekiq.yml"
|
|
||||||
volumes:
|
|
||||||
- .:/akkounts
|
|
||||||
networks:
|
|
||||||
- internal_network
|
|
||||||
environment:
|
|
||||||
RAILS_ENV: development
|
|
||||||
PRIMARY_DOMAIN: kosmos.org
|
|
||||||
LDAP_HOST: ldap
|
|
||||||
LDAP_PORT: 3389
|
|
||||||
LDAP_ADMIN_PASSWORD: passthebutter
|
|
||||||
LDAP_USE_TLS: "false"
|
|
||||||
LAUNCHY_DRY_RUN: true
|
|
||||||
BROWSER: /dev/null
|
|
||||||
REDIS_URL: redis://redis:6379/0
|
|
||||||
RS_REDIS_URL: redis://redis:6379/1
|
|
||||||
RS_STORAGE_URL: "http://localhost:4567"
|
|
||||||
S3_ENABLED: false
|
|
||||||
depends_on:
|
|
||||||
- ldap
|
|
||||||
- redis
|
|
||||||
|
|
||||||
minio:
|
minio:
|
||||||
image: quay.io/minio/minio:latest
|
image: quay.io/minio/minio:latest
|
||||||
command: "server /data --console-address ':9001'"
|
command: "server /data --console-address ':9001'"
|
||||||
|
@ -5,6 +5,7 @@ RSpec.describe Rs::OauthController, type: :controller do
|
|||||||
|
|
||||||
before do
|
before do
|
||||||
allow_any_instance_of(AppCatalog::WebApp).to receive(:update_metadata).and_return(true)
|
allow_any_instance_of(AppCatalog::WebApp).to receive(:update_metadata).and_return(true)
|
||||||
|
allow_any_instance_of(RemoteStorageAuthorization).to receive(:remove_token_expiry_job).and_return(nil)
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "GET /rs/oauth/:username" do
|
describe "GET /rs/oauth/:username" do
|
||||||
|
@ -5,6 +5,7 @@ RSpec.describe Services::RsAuthsController, type: :controller do
|
|||||||
|
|
||||||
before do
|
before do
|
||||||
allow_any_instance_of(AppCatalog::WebApp).to receive(:update_metadata).and_return(true)
|
allow_any_instance_of(AppCatalog::WebApp).to receive(:update_metadata).and_return(true)
|
||||||
|
allow_any_instance_of(RemoteStorageAuthorization).to receive(:remove_token_expiry_job).and_return(nil)
|
||||||
allow_any_instance_of(Flipper).to receive(:enabled?).and_return(true)
|
allow_any_instance_of(Flipper).to receive(:enabled?).and_return(true)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -5,6 +5,9 @@ RSpec.describe RemoteStorageExpireAuthorizationJob, type: :job do
|
|||||||
allow_any_instance_of(AppCatalog::WebApp).to(
|
allow_any_instance_of(AppCatalog::WebApp).to(
|
||||||
receive(:update_metadata).and_return(true)
|
receive(:update_metadata).and_return(true)
|
||||||
)
|
)
|
||||||
|
allow_any_instance_of(RemoteStorageAuthorization).to(
|
||||||
|
receive(:remove_token_expiry_job).and_return(nil)
|
||||||
|
)
|
||||||
|
|
||||||
@user = create :user, cn: "ronald", ou: "kosmos.org"
|
@user = create :user, cn: "ronald", ou: "kosmos.org"
|
||||||
@rs_authorization = create :remote_storage_authorization,
|
@rs_authorization = create :remote_storage_authorization,
|
||||||
|
@ -7,6 +7,7 @@ RSpec.describe RemoteStorageAuthorization, type: :model do
|
|||||||
|
|
||||||
before do
|
before do
|
||||||
allow_any_instance_of(AppCatalog::WebApp).to receive(:update_metadata).and_return(true)
|
allow_any_instance_of(AppCatalog::WebApp).to receive(:update_metadata).and_return(true)
|
||||||
|
allow_any_instance_of(RemoteStorageAuthorization).to receive(:remove_token_expiry_job).and_return(nil)
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "#create" do
|
describe "#create" do
|
||||||
|
Loading…
x
Reference in New Issue
Block a user