clerk-sdk-ruby 4.0.0.beta3 → 4.0.0.beta4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.env.example +3 -0
- data/.github/workflows/main.yml +22 -14
- data/.gitignore +7 -1
- data/.rspec +3 -0
- data/.ruby-version +1 -0
- data/CHANGELOG.md +22 -0
- data/Gemfile +26 -3
- data/Gemfile.lock +269 -13
- data/Guardfile +14 -0
- data/README.md +71 -11
- data/Rakefile +50 -6
- data/apps/rack/app.rb +67 -0
- data/apps/rack/config.ru +17 -0
- data/apps/rack/middleware/disable_paths.rb +13 -0
- data/apps/rails-api/.dockerignore +41 -0
- data/apps/rails-api/.gitattributes +9 -0
- data/apps/rails-api/.gitignore +32 -0
- data/apps/rails-api/.kamal/hooks/docker-setup.sample +3 -0
- data/apps/rails-api/.kamal/hooks/post-deploy.sample +14 -0
- data/apps/rails-api/.kamal/hooks/post-proxy-reboot.sample +3 -0
- data/apps/rails-api/.kamal/hooks/pre-build.sample +51 -0
- data/apps/rails-api/.kamal/hooks/pre-connect.sample +47 -0
- data/apps/rails-api/.kamal/hooks/pre-deploy.sample +109 -0
- data/apps/rails-api/.kamal/hooks/pre-proxy-reboot.sample +3 -0
- data/apps/rails-api/.kamal/secrets +17 -0
- data/apps/rails-api/.rubocop.yml +8 -0
- data/apps/rails-api/.ruby-version +1 -0
- data/apps/rails-api/Dockerfile +69 -0
- data/apps/rails-api/Gemfile +54 -0
- data/apps/rails-api/Gemfile.lock +374 -0
- data/apps/rails-api/README.md +24 -0
- data/apps/rails-api/Rakefile +6 -0
- data/apps/rails-api/app/controllers/application_controller.rb +3 -0
- data/apps/rails-api/app/controllers/home_controller.rb +5 -0
- data/apps/rails-api/app/jobs/application_job.rb +7 -0
- data/apps/rails-api/app/mailers/application_mailer.rb +4 -0
- data/apps/rails-api/app/models/application_record.rb +3 -0
- data/apps/rails-api/app/views/layouts/mailer.html.erb +13 -0
- data/apps/rails-api/app/views/layouts/mailer.text.erb +1 -0
- data/apps/rails-api/bin/brakeman +7 -0
- data/apps/rails-api/bin/bundle +109 -0
- data/apps/rails-api/bin/dev +2 -0
- data/apps/rails-api/bin/docker-entrypoint +14 -0
- data/apps/rails-api/bin/jobs +6 -0
- data/apps/rails-api/bin/kamal +27 -0
- data/apps/rails-api/bin/rails +4 -0
- data/apps/rails-api/bin/rake +4 -0
- data/apps/rails-api/bin/rubocop +8 -0
- data/apps/rails-api/bin/setup +34 -0
- data/apps/rails-api/bin/thrust +5 -0
- data/apps/rails-api/config/application.rb +36 -0
- data/apps/rails-api/config/boot.rb +4 -0
- data/apps/rails-api/config/cable.yml +17 -0
- data/apps/rails-api/config/cache.yml +16 -0
- data/apps/rails-api/config/credentials.yml.enc +1 -0
- data/apps/rails-api/config/database.yml +41 -0
- data/apps/rails-api/config/deploy.yml +116 -0
- data/apps/rails-api/config/environment.rb +5 -0
- data/apps/rails-api/config/environments/development.rb +70 -0
- data/apps/rails-api/config/environments/production.rb +88 -0
- data/apps/rails-api/config/environments/test.rb +53 -0
- data/apps/rails-api/config/initializers/cors.rb +16 -0
- data/apps/rails-api/config/initializers/filter_parameter_logging.rb +8 -0
- data/apps/rails-api/config/initializers/inflections.rb +16 -0
- data/apps/rails-api/config/locales/en.yml +31 -0
- data/apps/rails-api/config/puma.rb +41 -0
- data/apps/rails-api/config/queue.yml +18 -0
- data/apps/rails-api/config/recurring.yml +10 -0
- data/apps/rails-api/config/routes.rb +10 -0
- data/apps/rails-api/config/storage.yml +34 -0
- data/apps/rails-api/config.ru +6 -0
- data/apps/rails-api/db/cable_schema.rb +11 -0
- data/apps/rails-api/db/cache_schema.rb +14 -0
- data/apps/rails-api/db/queue_schema.rb +129 -0
- data/apps/rails-api/db/seeds.rb +9 -0
- data/apps/rails-api/public/robots.txt +1 -0
- data/apps/rails-api/test/controllers/home_controller_test.rb +7 -0
- data/apps/rails-api/test/test_helper.rb +15 -0
- data/apps/rails-full/.dockerignore +47 -0
- data/apps/rails-full/.gitattributes +9 -0
- data/apps/rails-full/.gitignore +34 -0
- data/apps/rails-full/.kamal/hooks/docker-setup.sample +3 -0
- data/apps/rails-full/.kamal/hooks/post-deploy.sample +14 -0
- data/apps/rails-full/.kamal/hooks/post-proxy-reboot.sample +3 -0
- data/apps/rails-full/.kamal/hooks/pre-build.sample +51 -0
- data/apps/rails-full/.kamal/hooks/pre-connect.sample +47 -0
- data/apps/rails-full/.kamal/hooks/pre-deploy.sample +109 -0
- data/apps/rails-full/.kamal/hooks/pre-proxy-reboot.sample +3 -0
- data/apps/rails-full/.kamal/secrets +17 -0
- data/apps/rails-full/.rubocop.yml +8 -0
- data/apps/rails-full/.ruby-version +1 -0
- data/apps/rails-full/Dockerfile +72 -0
- data/apps/rails-full/Gemfile +70 -0
- data/apps/rails-full/Gemfile.lock +429 -0
- data/apps/rails-full/README.md +24 -0
- data/apps/rails-full/Rakefile +6 -0
- data/apps/rails-full/app/assets/stylesheets/application.css +10 -0
- data/apps/rails-full/app/controllers/application_controller.rb +6 -0
- data/apps/rails-full/app/controllers/home_controller.rb +11 -0
- data/apps/rails-full/app/helpers/application_helper.rb +2 -0
- data/apps/rails-full/app/helpers/home_helper.rb +2 -0
- data/apps/rails-full/app/javascript/application.js +3 -0
- data/apps/rails-full/app/javascript/controllers/application.js +9 -0
- data/apps/rails-full/app/javascript/controllers/hello_controller.js +7 -0
- data/apps/rails-full/app/javascript/controllers/index.js +4 -0
- data/apps/rails-full/app/jobs/application_job.rb +7 -0
- data/apps/rails-full/app/mailers/application_mailer.rb +4 -0
- data/apps/rails-full/app/models/application_record.rb +3 -0
- data/apps/rails-full/app/views/home/index.html.erb +7 -0
- data/apps/rails-full/app/views/layouts/application.html.erb +60 -0
- data/apps/rails-full/app/views/layouts/mailer.html.erb +13 -0
- data/apps/rails-full/app/views/layouts/mailer.text.erb +1 -0
- data/apps/rails-full/app/views/pwa/manifest.json.erb +22 -0
- data/apps/rails-full/app/views/pwa/service-worker.js +26 -0
- data/apps/rails-full/bin/brakeman +7 -0
- data/apps/rails-full/bin/bundle +109 -0
- data/apps/rails-full/bin/dev +2 -0
- data/apps/rails-full/bin/docker-entrypoint +14 -0
- data/apps/rails-full/bin/importmap +4 -0
- data/apps/rails-full/bin/jobs +6 -0
- data/apps/rails-full/bin/kamal +27 -0
- data/apps/rails-full/bin/rails +4 -0
- data/apps/rails-full/bin/rake +4 -0
- data/apps/rails-full/bin/rubocop +8 -0
- data/apps/rails-full/bin/setup +34 -0
- data/apps/rails-full/bin/thrust +5 -0
- data/apps/rails-full/config/application.rb +31 -0
- data/apps/rails-full/config/boot.rb +4 -0
- data/apps/rails-full/config/cable.yml +17 -0
- data/apps/rails-full/config/cache.yml +16 -0
- data/apps/rails-full/config/credentials.yml.enc +1 -0
- data/apps/rails-full/config/database.yml +41 -0
- data/apps/rails-full/config/deploy.yml +116 -0
- data/apps/rails-full/config/environment.rb +5 -0
- data/apps/rails-full/config/environments/development.rb +72 -0
- data/apps/rails-full/config/environments/production.rb +91 -0
- data/apps/rails-full/config/environments/test.rb +53 -0
- data/apps/rails-full/config/importmap.rb +7 -0
- data/apps/rails-full/config/initializers/assets.rb +7 -0
- data/apps/rails-full/config/initializers/clerk.rb +4 -0
- data/apps/rails-full/config/initializers/content_security_policy.rb +25 -0
- data/apps/rails-full/config/initializers/filter_parameter_logging.rb +8 -0
- data/apps/rails-full/config/initializers/inflections.rb +16 -0
- data/apps/rails-full/config/locales/en.yml +31 -0
- data/apps/rails-full/config/puma.rb +41 -0
- data/apps/rails-full/config/queue.yml +18 -0
- data/apps/rails-full/config/recurring.yml +10 -0
- data/apps/rails-full/config/routes.rb +15 -0
- data/apps/rails-full/config/storage.yml +34 -0
- data/apps/rails-full/config.ru +6 -0
- data/apps/rails-full/db/cable_schema.rb +11 -0
- data/apps/rails-full/db/cache_schema.rb +14 -0
- data/apps/rails-full/db/queue_schema.rb +129 -0
- data/apps/rails-full/db/seeds.rb +9 -0
- data/apps/rails-full/public/400.html +114 -0
- data/apps/rails-full/public/404.html +114 -0
- data/apps/rails-full/public/406-unsupported-browser.html +114 -0
- data/apps/rails-full/public/422.html +114 -0
- data/apps/rails-full/public/500.html +114 -0
- data/apps/rails-full/public/icon.png +0 -0
- data/apps/rails-full/public/icon.svg +3 -0
- data/apps/rails-full/public/robots.txt +1 -0
- data/apps/rails-full/test/application_system_test_case.rb +5 -0
- data/apps/rails-full/test/controllers/home_controller_test.rb +7 -0
- data/apps/rails-full/test/test_helper.rb +15 -0
- data/apps/sinatra/app.rb +29 -0
- data/apps/sinatra/config.ru +2 -0
- data/apps/sinatra/views/index.erb +44 -0
- data/clerk-sdk-ruby.gemspec +2 -1
- data/lib/clerk/authenticatable.rb +14 -79
- data/lib/clerk/authenticate_context.rb +164 -181
- data/lib/clerk/authenticate_request.rb +238 -230
- data/lib/clerk/configuration.rb +78 -0
- data/lib/clerk/constants.rb +68 -46
- data/lib/clerk/error.rb +17 -0
- data/lib/clerk/jwks_cache.rb +27 -22
- data/lib/clerk/proxy.rb +135 -0
- data/lib/clerk/rack.rb +2 -0
- data/lib/clerk/rack_middleware.rb +88 -73
- data/lib/clerk/rails.rb +3 -0
- data/lib/clerk/railtie.rb +7 -6
- data/lib/clerk/sdk.rb +46 -156
- data/lib/clerk/sinatra.rb +52 -0
- data/lib/clerk/utils.rb +52 -6
- data/lib/clerk/version.rb +1 -1
- data/lib/clerk.rb +15 -51
- metadata +187 -25
- data/CODEOWNERS +0 -1
- data/lib/clerk/errors.rb +0 -22
- data/lib/clerk/rack_middleware_v2.rb +0 -167
- data/lib/clerk/resources/allowlist.rb +0 -16
- data/lib/clerk/resources/allowlist_identifiers.rb +0 -16
- data/lib/clerk/resources/clients.rb +0 -23
- data/lib/clerk/resources/email_addresses.rb +0 -17
- data/lib/clerk/resources/emails.rb +0 -16
- data/lib/clerk/resources/jwks.rb +0 -18
- data/lib/clerk/resources/organizations.rb +0 -73
- data/lib/clerk/resources/phone_numbers.rb +0 -17
- data/lib/clerk/resources/plural_resource.rb +0 -38
- data/lib/clerk/resources/sessions.rb +0 -26
- data/lib/clerk/resources/singular_resource.rb +0 -14
- data/lib/clerk/resources/users.rb +0 -37
- data/lib/clerk/resources.rb +0 -10
@@ -0,0 +1 @@
|
|
1
|
+
<%= yield %>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
{
|
2
|
+
"name": "RailsFull",
|
3
|
+
"icons": [
|
4
|
+
{
|
5
|
+
"src": "/icon.png",
|
6
|
+
"type": "image/png",
|
7
|
+
"sizes": "512x512"
|
8
|
+
},
|
9
|
+
{
|
10
|
+
"src": "/icon.png",
|
11
|
+
"type": "image/png",
|
12
|
+
"sizes": "512x512",
|
13
|
+
"purpose": "maskable"
|
14
|
+
}
|
15
|
+
],
|
16
|
+
"start_url": "/",
|
17
|
+
"display": "standalone",
|
18
|
+
"scope": "/",
|
19
|
+
"description": "RailsFull.",
|
20
|
+
"theme_color": "red",
|
21
|
+
"background_color": "red"
|
22
|
+
}
|
@@ -0,0 +1,26 @@
|
|
1
|
+
// Add a service worker for processing Web Push notifications:
|
2
|
+
//
|
3
|
+
// self.addEventListener("push", async (event) => {
|
4
|
+
// const { title, options } = await event.data.json()
|
5
|
+
// event.waitUntil(self.registration.showNotification(title, options))
|
6
|
+
// })
|
7
|
+
//
|
8
|
+
// self.addEventListener("notificationclick", function(event) {
|
9
|
+
// event.notification.close()
|
10
|
+
// event.waitUntil(
|
11
|
+
// clients.matchAll({ type: "window" }).then((clientList) => {
|
12
|
+
// for (let i = 0; i < clientList.length; i++) {
|
13
|
+
// let client = clientList[i]
|
14
|
+
// let clientPath = (new URL(client.url)).pathname
|
15
|
+
//
|
16
|
+
// if (clientPath == event.notification.data.path && "focus" in client) {
|
17
|
+
// return client.focus()
|
18
|
+
// }
|
19
|
+
// }
|
20
|
+
//
|
21
|
+
// if (clients.openWindow) {
|
22
|
+
// return clients.openWindow(event.notification.data.path)
|
23
|
+
// }
|
24
|
+
// })
|
25
|
+
// )
|
26
|
+
// })
|
@@ -0,0 +1,109 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
#
|
5
|
+
# This file was generated by Bundler.
|
6
|
+
#
|
7
|
+
# The application 'bundle' is installed as part of a gem, and
|
8
|
+
# this file is here to facilitate running it.
|
9
|
+
#
|
10
|
+
|
11
|
+
require "rubygems"
|
12
|
+
|
13
|
+
m = Module.new do
|
14
|
+
module_function
|
15
|
+
|
16
|
+
def invoked_as_script?
|
17
|
+
File.expand_path($0) == File.expand_path(__FILE__)
|
18
|
+
end
|
19
|
+
|
20
|
+
def env_var_version
|
21
|
+
ENV["BUNDLER_VERSION"]
|
22
|
+
end
|
23
|
+
|
24
|
+
def cli_arg_version
|
25
|
+
return unless invoked_as_script? # don't want to hijack other binstubs
|
26
|
+
return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update`
|
27
|
+
bundler_version = nil
|
28
|
+
update_index = nil
|
29
|
+
ARGV.each_with_index do |a, i|
|
30
|
+
if update_index && update_index.succ == i && a.match?(Gem::Version::ANCHORED_VERSION_PATTERN)
|
31
|
+
bundler_version = a
|
32
|
+
end
|
33
|
+
next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/
|
34
|
+
bundler_version = $1
|
35
|
+
update_index = i
|
36
|
+
end
|
37
|
+
bundler_version
|
38
|
+
end
|
39
|
+
|
40
|
+
def gemfile
|
41
|
+
gemfile = ENV["BUNDLE_GEMFILE"]
|
42
|
+
return gemfile if gemfile && !gemfile.empty?
|
43
|
+
|
44
|
+
File.expand_path("../Gemfile", __dir__)
|
45
|
+
end
|
46
|
+
|
47
|
+
def lockfile
|
48
|
+
lockfile =
|
49
|
+
case File.basename(gemfile)
|
50
|
+
when "gems.rb" then gemfile.sub(/\.rb$/, ".locked")
|
51
|
+
else "#{gemfile}.lock"
|
52
|
+
end
|
53
|
+
File.expand_path(lockfile)
|
54
|
+
end
|
55
|
+
|
56
|
+
def lockfile_version
|
57
|
+
return unless File.file?(lockfile)
|
58
|
+
lockfile_contents = File.read(lockfile)
|
59
|
+
return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/
|
60
|
+
Regexp.last_match(1)
|
61
|
+
end
|
62
|
+
|
63
|
+
def bundler_requirement
|
64
|
+
@bundler_requirement ||=
|
65
|
+
env_var_version ||
|
66
|
+
cli_arg_version ||
|
67
|
+
bundler_requirement_for(lockfile_version)
|
68
|
+
end
|
69
|
+
|
70
|
+
def bundler_requirement_for(version)
|
71
|
+
return "#{Gem::Requirement.default}.a" unless version
|
72
|
+
|
73
|
+
bundler_gem_version = Gem::Version.new(version)
|
74
|
+
|
75
|
+
bundler_gem_version.approximate_recommendation
|
76
|
+
end
|
77
|
+
|
78
|
+
def load_bundler!
|
79
|
+
ENV["BUNDLE_GEMFILE"] ||= gemfile
|
80
|
+
|
81
|
+
activate_bundler
|
82
|
+
end
|
83
|
+
|
84
|
+
def activate_bundler
|
85
|
+
gem_error = activation_error_handling do
|
86
|
+
gem "bundler", bundler_requirement
|
87
|
+
end
|
88
|
+
return if gem_error.nil?
|
89
|
+
require_error = activation_error_handling do
|
90
|
+
require "bundler/version"
|
91
|
+
end
|
92
|
+
return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION))
|
93
|
+
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}'`"
|
94
|
+
exit 42
|
95
|
+
end
|
96
|
+
|
97
|
+
def activation_error_handling
|
98
|
+
yield
|
99
|
+
nil
|
100
|
+
rescue StandardError, LoadError => e
|
101
|
+
e
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
m.load_bundler!
|
106
|
+
|
107
|
+
if m.invoked_as_script?
|
108
|
+
load Gem.bin_path("bundler", "bundle")
|
109
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/bin/bash -e
|
2
|
+
|
3
|
+
# Enable jemalloc for reduced memory usage and latency.
|
4
|
+
if [ -z "${LD_PRELOAD+x}" ]; then
|
5
|
+
LD_PRELOAD=$(find /usr/lib -name libjemalloc.so.2 -print -quit)
|
6
|
+
export LD_PRELOAD
|
7
|
+
fi
|
8
|
+
|
9
|
+
# If running the rails server then create or migrate existing database
|
10
|
+
if [ "${@: -2:1}" == "./bin/rails" ] && [ "${@: -1:1}" == "server" ]; then
|
11
|
+
./bin/rails db:prepare
|
12
|
+
fi
|
13
|
+
|
14
|
+
exec "${@}"
|
@@ -0,0 +1,27 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
#
|
5
|
+
# This file was generated by Bundler.
|
6
|
+
#
|
7
|
+
# The application 'kamal' is installed as part of a gem, and
|
8
|
+
# this file is here to facilitate running it.
|
9
|
+
#
|
10
|
+
|
11
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
|
12
|
+
|
13
|
+
bundle_binstub = File.expand_path("bundle", __dir__)
|
14
|
+
|
15
|
+
if File.file?(bundle_binstub)
|
16
|
+
if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
|
17
|
+
load(bundle_binstub)
|
18
|
+
else
|
19
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
20
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
require "rubygems"
|
25
|
+
require "bundler/setup"
|
26
|
+
|
27
|
+
load Gem.bin_path("kamal", "kamal")
|
@@ -0,0 +1,8 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require "rubygems"
|
3
|
+
require "bundler/setup"
|
4
|
+
|
5
|
+
# explicit rubocop config increases performance slightly while avoiding config confusion.
|
6
|
+
ARGV.unshift("--config", File.expand_path("../.rubocop.yml", __dir__))
|
7
|
+
|
8
|
+
load Gem.bin_path("rubocop", "rubocop")
|
@@ -0,0 +1,34 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require "fileutils"
|
3
|
+
|
4
|
+
APP_ROOT = File.expand_path("..", __dir__)
|
5
|
+
|
6
|
+
def system!(*args)
|
7
|
+
system(*args, exception: true)
|
8
|
+
end
|
9
|
+
|
10
|
+
FileUtils.chdir APP_ROOT do
|
11
|
+
# This script is a way to set up or update your development environment automatically.
|
12
|
+
# This script is idempotent, so that you can run it at any time and get an expectable outcome.
|
13
|
+
# Add necessary setup steps to this file.
|
14
|
+
|
15
|
+
puts "== Installing dependencies =="
|
16
|
+
system("bundle check") || system!("bundle install")
|
17
|
+
|
18
|
+
# puts "\n== Copying sample files =="
|
19
|
+
# unless File.exist?("config/database.yml")
|
20
|
+
# FileUtils.cp "config/database.yml.sample", "config/database.yml"
|
21
|
+
# end
|
22
|
+
|
23
|
+
puts "\n== Preparing database =="
|
24
|
+
system! "bin/rails db:prepare"
|
25
|
+
|
26
|
+
puts "\n== Removing old logs and tempfiles =="
|
27
|
+
system! "bin/rails log:clear tmp:clear"
|
28
|
+
|
29
|
+
unless ARGV.include?("--skip-server")
|
30
|
+
puts "\n== Starting development server =="
|
31
|
+
STDOUT.flush # flush the output before exec(2) so that it displays
|
32
|
+
exec "bin/dev"
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require_relative "boot"
|
2
|
+
|
3
|
+
require "rails/all"
|
4
|
+
|
5
|
+
# Require the gems listed in Gemfile, including any gems
|
6
|
+
# you've limited to :test, :development, or :production.
|
7
|
+
Bundler.require(*Rails.groups)
|
8
|
+
|
9
|
+
# Load environment variables manually from shared .env file
|
10
|
+
require "dotenv/rails"
|
11
|
+
Dotenv::Rails.files.unshift(File.expand_path(File.join("..", "..", ".env")))
|
12
|
+
|
13
|
+
module RailsFull
|
14
|
+
class Application < Rails::Application
|
15
|
+
# Initialize configuration defaults for originally generated Rails version.
|
16
|
+
config.load_defaults 8.0
|
17
|
+
|
18
|
+
# Please, add to the `ignore` list any other `lib` subdirectories that do
|
19
|
+
# not contain `.rb` files, or that should not be reloaded or eager loaded.
|
20
|
+
# Common ones are `templates`, `generators`, or `middleware`, for example.
|
21
|
+
config.autoload_lib(ignore: %w[assets tasks])
|
22
|
+
|
23
|
+
# Configuration for the application, engines, and railties goes here.
|
24
|
+
#
|
25
|
+
# These settings can be overridden in specific environments using the files
|
26
|
+
# in config/environments, which are processed later.
|
27
|
+
#
|
28
|
+
# config.time_zone = "Central Time (US & Canada)"
|
29
|
+
# config.eager_load_paths << Rails.root.join("extras")
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# Async adapter only works within the same process, so for manually triggering cable updates from a console,
|
2
|
+
# and seeing results in the browser, you must do so from the web console (running inside the dev process),
|
3
|
+
# not a terminal started via bin/rails console! Add "console" to any action or any ERB template view
|
4
|
+
# to make the web console appear.
|
5
|
+
development:
|
6
|
+
adapter: async
|
7
|
+
|
8
|
+
test:
|
9
|
+
adapter: test
|
10
|
+
|
11
|
+
production:
|
12
|
+
adapter: solid_cable
|
13
|
+
connects_to:
|
14
|
+
database:
|
15
|
+
writing: cable
|
16
|
+
polling_interval: 0.1.seconds
|
17
|
+
message_retention: 1.day
|
@@ -0,0 +1,16 @@
|
|
1
|
+
default: &default
|
2
|
+
store_options:
|
3
|
+
# Cap age of oldest cache entry to fulfill retention policies
|
4
|
+
# max_age: <%= 60.days.to_i %>
|
5
|
+
max_size: <%= 256.megabytes %>
|
6
|
+
namespace: <%= Rails.env %>
|
7
|
+
|
8
|
+
development:
|
9
|
+
<<: *default
|
10
|
+
|
11
|
+
test:
|
12
|
+
<<: *default
|
13
|
+
|
14
|
+
production:
|
15
|
+
database: cache
|
16
|
+
<<: *default
|
@@ -0,0 +1 @@
|
|
1
|
+
HjFmR7rvjb6I8x4lUwbNJW7XxLVXkqUz2gONRhdXNK4flRFut+273GglF3i0hxNc/au4TlXai1EdH4dnE3nlnT/FADvU07kG8J5Q/HTT6IlvObtcw4uDgFtMVx/IvbitIjB9c2amaFKbBucjy9nBpopewh4TZbmJevA1QtGRI9V3A6eDeUuTHM3MM34q7oKV/kx5EH3njPxYGx6lWwQMmTDhkLB0bjf6erdNRVsglZVXmSs9opTO5vmoAkOBFb4GdtOXq297BBNTW2Cnc/BhW403IuIMxBX9R9299n0TNsRSITWKnXZ+VqPlxwM2/tZwiZlfd5R22KqzZC4a7dRdwZ24y46LBMsIk+6q2rosV0a6S+hN+FDYTkGMjj2kYlYjfMKJjIGf6xM8n59YOgh/Ir9V/ouf42W30ZDFkauX8XL0ygQRvICESGzg4QEakkoPJoHboiUmnUoOBCfUbXg50C2+dAiFUayKO8vORg4UsVXSdg6AES9K9rk6--5BPhfQGoIFXv/74y--dDR6BykRl0GAw/Dc89/vQQ==
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# SQLite. Versions 3.8.0 and up are supported.
|
2
|
+
# gem install sqlite3
|
3
|
+
#
|
4
|
+
# Ensure the SQLite 3 gem is defined in your Gemfile
|
5
|
+
# gem "sqlite3"
|
6
|
+
#
|
7
|
+
default: &default
|
8
|
+
adapter: sqlite3
|
9
|
+
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
|
10
|
+
timeout: 5000
|
11
|
+
|
12
|
+
development:
|
13
|
+
<<: *default
|
14
|
+
database: storage/development.sqlite3
|
15
|
+
|
16
|
+
# Warning: The database defined as "test" will be erased and
|
17
|
+
# re-generated from your development database when you run "rake".
|
18
|
+
# Do not set this db to the same as development or production.
|
19
|
+
test:
|
20
|
+
<<: *default
|
21
|
+
database: storage/test.sqlite3
|
22
|
+
|
23
|
+
|
24
|
+
# Store production database in the storage/ directory, which by default
|
25
|
+
# is mounted as a persistent Docker volume in config/deploy.yml.
|
26
|
+
production:
|
27
|
+
primary:
|
28
|
+
<<: *default
|
29
|
+
database: storage/production.sqlite3
|
30
|
+
cache:
|
31
|
+
<<: *default
|
32
|
+
database: storage/production_cache.sqlite3
|
33
|
+
migrations_paths: db/cache_migrate
|
34
|
+
queue:
|
35
|
+
<<: *default
|
36
|
+
database: storage/production_queue.sqlite3
|
37
|
+
migrations_paths: db/queue_migrate
|
38
|
+
cable:
|
39
|
+
<<: *default
|
40
|
+
database: storage/production_cable.sqlite3
|
41
|
+
migrations_paths: db/cable_migrate
|
@@ -0,0 +1,116 @@
|
|
1
|
+
# Name of your application. Used to uniquely configure containers.
|
2
|
+
service: rails_full
|
3
|
+
|
4
|
+
# Name of the container image.
|
5
|
+
image: your-user/rails_full
|
6
|
+
|
7
|
+
# Deploy to these servers.
|
8
|
+
servers:
|
9
|
+
web:
|
10
|
+
- 192.168.0.1
|
11
|
+
# job:
|
12
|
+
# hosts:
|
13
|
+
# - 192.168.0.1
|
14
|
+
# cmd: bin/jobs
|
15
|
+
|
16
|
+
# Enable SSL auto certification via Let's Encrypt and allow for multiple apps on a single web server.
|
17
|
+
# Remove this section when using multiple web servers and ensure you terminate SSL at your load balancer.
|
18
|
+
#
|
19
|
+
# Note: If using Cloudflare, set encryption mode in SSL/TLS setting to "Full" to enable CF-to-app encryption.
|
20
|
+
proxy:
|
21
|
+
ssl: true
|
22
|
+
host: app.example.com
|
23
|
+
|
24
|
+
# Credentials for your image host.
|
25
|
+
registry:
|
26
|
+
# Specify the registry server, if you're not using Docker Hub
|
27
|
+
# server: registry.digitalocean.com / ghcr.io / ...
|
28
|
+
username: your-user
|
29
|
+
|
30
|
+
# Always use an access token rather than real password when possible.
|
31
|
+
password:
|
32
|
+
- KAMAL_REGISTRY_PASSWORD
|
33
|
+
|
34
|
+
# Inject ENV variables into containers (secrets come from .kamal/secrets).
|
35
|
+
env:
|
36
|
+
secret:
|
37
|
+
- RAILS_MASTER_KEY
|
38
|
+
clear:
|
39
|
+
# Run the Solid Queue Supervisor inside the web server's Puma process to do jobs.
|
40
|
+
# When you start using multiple servers, you should split out job processing to a dedicated machine.
|
41
|
+
SOLID_QUEUE_IN_PUMA: true
|
42
|
+
|
43
|
+
# Set number of processes dedicated to Solid Queue (default: 1)
|
44
|
+
# JOB_CONCURRENCY: 3
|
45
|
+
|
46
|
+
# Set number of cores available to the application on each server (default: 1).
|
47
|
+
# WEB_CONCURRENCY: 2
|
48
|
+
|
49
|
+
# Match this to any external database server to configure Active Record correctly
|
50
|
+
# Use rails_full-db for a db accessory server on same machine via local kamal docker network.
|
51
|
+
# DB_HOST: 192.168.0.2
|
52
|
+
|
53
|
+
# Log everything from Rails
|
54
|
+
# RAILS_LOG_LEVEL: debug
|
55
|
+
|
56
|
+
# Aliases are triggered with "bin/kamal <alias>". You can overwrite arguments on invocation:
|
57
|
+
# "bin/kamal logs -r job" will tail logs from the first server in the job section.
|
58
|
+
aliases:
|
59
|
+
console: app exec --interactive --reuse "bin/rails console"
|
60
|
+
shell: app exec --interactive --reuse "bash"
|
61
|
+
logs: app logs -f
|
62
|
+
dbc: app exec --interactive --reuse "bin/rails dbconsole"
|
63
|
+
|
64
|
+
|
65
|
+
# Use a persistent storage volume for sqlite database files and local Active Storage files.
|
66
|
+
# Recommended to change this to a mounted volume path that is backed up off server.
|
67
|
+
volumes:
|
68
|
+
- "rails_full_storage:/rails/storage"
|
69
|
+
|
70
|
+
|
71
|
+
# Bridge fingerprinted assets, like JS and CSS, between versions to avoid
|
72
|
+
# hitting 404 on in-flight requests. Combines all files from new and old
|
73
|
+
# version inside the asset_path.
|
74
|
+
asset_path: /rails/public/assets
|
75
|
+
|
76
|
+
# Configure the image builder.
|
77
|
+
builder:
|
78
|
+
arch: amd64
|
79
|
+
|
80
|
+
# # Build image via remote server (useful for faster amd64 builds on arm64 computers)
|
81
|
+
# remote: ssh://docker@docker-builder-server
|
82
|
+
#
|
83
|
+
# # Pass arguments and secrets to the Docker build process
|
84
|
+
# args:
|
85
|
+
# RUBY_VERSION: 3.3.5
|
86
|
+
# secrets:
|
87
|
+
# - GITHUB_TOKEN
|
88
|
+
# - RAILS_MASTER_KEY
|
89
|
+
|
90
|
+
# Use a different ssh user than root
|
91
|
+
# ssh:
|
92
|
+
# user: app
|
93
|
+
|
94
|
+
# Use accessory services (secrets come from .kamal/secrets).
|
95
|
+
# accessories:
|
96
|
+
# db:
|
97
|
+
# image: mysql:8.0
|
98
|
+
# host: 192.168.0.2
|
99
|
+
# # Change to 3306 to expose port to the world instead of just local network.
|
100
|
+
# port: "127.0.0.1:3306:3306"
|
101
|
+
# env:
|
102
|
+
# clear:
|
103
|
+
# MYSQL_ROOT_HOST: '%'
|
104
|
+
# secret:
|
105
|
+
# - MYSQL_ROOT_PASSWORD
|
106
|
+
# files:
|
107
|
+
# - config/mysql/production.cnf:/etc/mysql/my.cnf
|
108
|
+
# - db/production.sql:/docker-entrypoint-initdb.d/setup.sql
|
109
|
+
# directories:
|
110
|
+
# - data:/var/lib/mysql
|
111
|
+
# redis:
|
112
|
+
# image: redis:7.0
|
113
|
+
# host: 192.168.0.2
|
114
|
+
# port: 6379
|
115
|
+
# directories:
|
116
|
+
# - data:/data
|
@@ -0,0 +1,72 @@
|
|
1
|
+
require "active_support/core_ext/integer/time"
|
2
|
+
|
3
|
+
Rails.application.configure do
|
4
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
5
|
+
|
6
|
+
# Make code changes take effect immediately without server restart.
|
7
|
+
config.enable_reloading = true
|
8
|
+
|
9
|
+
# Do not eager load code on boot.
|
10
|
+
config.eager_load = false
|
11
|
+
|
12
|
+
# Show full error reports.
|
13
|
+
config.consider_all_requests_local = true
|
14
|
+
|
15
|
+
# Enable server timing.
|
16
|
+
config.server_timing = true
|
17
|
+
|
18
|
+
# Enable/disable Action Controller caching. By default Action Controller caching is disabled.
|
19
|
+
# Run rails dev:cache to toggle Action Controller caching.
|
20
|
+
if Rails.root.join("tmp/caching-dev.txt").exist?
|
21
|
+
config.action_controller.perform_caching = true
|
22
|
+
config.action_controller.enable_fragment_cache_logging = true
|
23
|
+
config.public_file_server.headers = { "cache-control" => "public, max-age=#{2.days.to_i}" }
|
24
|
+
else
|
25
|
+
config.action_controller.perform_caching = false
|
26
|
+
end
|
27
|
+
|
28
|
+
# Change to :null_store to avoid any caching.
|
29
|
+
config.cache_store = :memory_store
|
30
|
+
|
31
|
+
# Store uploaded files on the local file system (see config/storage.yml for options).
|
32
|
+
config.active_storage.service = :local
|
33
|
+
|
34
|
+
# Don't care if the mailer can't send.
|
35
|
+
config.action_mailer.raise_delivery_errors = false
|
36
|
+
|
37
|
+
# Make template changes take effect immediately.
|
38
|
+
config.action_mailer.perform_caching = false
|
39
|
+
|
40
|
+
# Set localhost to be used by links generated in mailer templates.
|
41
|
+
config.action_mailer.default_url_options = { host: "localhost", port: 3000 }
|
42
|
+
|
43
|
+
# Print deprecation notices to the Rails logger.
|
44
|
+
config.active_support.deprecation = :log
|
45
|
+
|
46
|
+
# Raise an error on page load if there are pending migrations.
|
47
|
+
config.active_record.migration_error = :page_load
|
48
|
+
|
49
|
+
# Highlight code that triggered database queries in logs.
|
50
|
+
config.active_record.verbose_query_logs = true
|
51
|
+
|
52
|
+
# Append comments with runtime information tags to SQL queries in logs.
|
53
|
+
config.active_record.query_log_tags_enabled = true
|
54
|
+
|
55
|
+
# Highlight code that enqueued background job in logs.
|
56
|
+
config.active_job.verbose_enqueue_logs = true
|
57
|
+
|
58
|
+
# Raises error for missing translations.
|
59
|
+
# config.i18n.raise_on_missing_translations = true
|
60
|
+
|
61
|
+
# Annotate rendered view with file names.
|
62
|
+
config.action_view.annotate_rendered_view_with_filenames = true
|
63
|
+
|
64
|
+
# Uncomment if you wish to allow Action Cable access from any origin.
|
65
|
+
# config.action_cable.disable_request_forgery_protection = true
|
66
|
+
|
67
|
+
# Raise error when a before_action's only/except options reference missing actions.
|
68
|
+
config.action_controller.raise_on_missing_callback_actions = true
|
69
|
+
|
70
|
+
# Apply autocorrection by RuboCop to files generated by `bin/rails generate`.
|
71
|
+
# config.generators.apply_rubocop_autocorrect_after_generate!
|
72
|
+
end
|