nvoi 0.1.5
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 +7 -0
- data/.rubocop.yml +19 -0
- data/Gemfile +9 -0
- data/Gemfile.lock +151 -0
- data/Makefile +26 -0
- data/Rakefile +16 -0
- data/doc/config-schema.yaml +357 -0
- data/examples/apex-wildcard/deploy.yml +68 -0
- data/examples/golang/.gitignore +19 -0
- data/examples/golang/Dockerfile +43 -0
- data/examples/golang/README.md +59 -0
- data/examples/golang/deploy.enc +0 -0
- data/examples/golang/deploy.yml +54 -0
- data/examples/golang/go.mod +39 -0
- data/examples/golang/go.sum +96 -0
- data/examples/golang/main.go +177 -0
- data/examples/golang/models/user.go +17 -0
- data/examples/golang-postgres-multi/.gitignore +18 -0
- data/examples/golang-postgres-multi/Dockerfile +39 -0
- data/examples/golang-postgres-multi/README.md +211 -0
- data/examples/golang-postgres-multi/deploy.yml +67 -0
- data/examples/golang-postgres-multi/go.mod +45 -0
- data/examples/golang-postgres-multi/go.sum +108 -0
- data/examples/golang-postgres-multi/main.go +197 -0
- data/examples/golang-postgres-multi/models/user.go +17 -0
- data/examples/postgres-multi/.env.production.example +11 -0
- data/examples/postgres-multi/README.md +112 -0
- data/examples/postgres-multi/deploy.yml +74 -0
- data/examples/postgres-single/.env.production.example +11 -0
- data/examples/postgres-single/.gitignore +15 -0
- data/examples/postgres-single/Dockerfile +35 -0
- data/examples/postgres-single/README.md +76 -0
- data/examples/postgres-single/deploy.yml +56 -0
- data/examples/postgres-single/go.mod +45 -0
- data/examples/postgres-single/go.sum +108 -0
- data/examples/postgres-single/main.go +184 -0
- data/examples/rails-single/.dockerignore +51 -0
- data/examples/rails-single/.env.production.example +11 -0
- data/examples/rails-single/.github/dependabot.yml +12 -0
- data/examples/rails-single/.github/workflows/ci.yml +39 -0
- data/examples/rails-single/.gitignore +20 -0
- data/examples/rails-single/.node-version +1 -0
- data/examples/rails-single/.rubocop.yml +8 -0
- data/examples/rails-single/.ruby-version +1 -0
- data/examples/rails-single/Dockerfile +86 -0
- data/examples/rails-single/Gemfile +56 -0
- data/examples/rails-single/Gemfile.lock +350 -0
- data/examples/rails-single/Procfile.dev +3 -0
- data/examples/rails-single/README.md +17 -0
- data/examples/rails-single/Rakefile +6 -0
- data/examples/rails-single/app/assets/builds/.keep +0 -0
- data/examples/rails-single/app/assets/images/.keep +0 -0
- data/examples/rails-single/app/assets/stylesheets/application.tailwind.css +1 -0
- data/examples/rails-single/app/controllers/application_controller.rb +4 -0
- data/examples/rails-single/app/controllers/concerns/.keep +0 -0
- data/examples/rails-single/app/controllers/users_controller.rb +19 -0
- data/examples/rails-single/app/helpers/application_helper.rb +2 -0
- data/examples/rails-single/app/javascript/application.js +3 -0
- data/examples/rails-single/app/javascript/controllers/application.js +9 -0
- data/examples/rails-single/app/javascript/controllers/hello_controller.js +7 -0
- data/examples/rails-single/app/javascript/controllers/index.js +8 -0
- data/examples/rails-single/app/jobs/application_job.rb +7 -0
- data/examples/rails-single/app/mailers/application_mailer.rb +4 -0
- data/examples/rails-single/app/models/application_record.rb +3 -0
- data/examples/rails-single/app/models/concerns/.keep +0 -0
- data/examples/rails-single/app/models/user.rb +2 -0
- data/examples/rails-single/app/views/layouts/application.html.erb +28 -0
- data/examples/rails-single/app/views/layouts/mailer.html.erb +13 -0
- data/examples/rails-single/app/views/layouts/mailer.text.erb +1 -0
- data/examples/rails-single/app/views/pwa/manifest.json.erb +22 -0
- data/examples/rails-single/app/views/pwa/service-worker.js +26 -0
- data/examples/rails-single/app/views/users/index.html.erb +38 -0
- data/examples/rails-single/bin/brakeman +7 -0
- data/examples/rails-single/bin/bundle +109 -0
- data/examples/rails-single/bin/dev +11 -0
- data/examples/rails-single/bin/docker-entrypoint +14 -0
- data/examples/rails-single/bin/jobs +6 -0
- data/examples/rails-single/bin/kamal +27 -0
- data/examples/rails-single/bin/rails +4 -0
- data/examples/rails-single/bin/rake +4 -0
- data/examples/rails-single/bin/rubocop +8 -0
- data/examples/rails-single/bin/setup +37 -0
- data/examples/rails-single/bin/thrust +5 -0
- data/examples/rails-single/bun.lock +224 -0
- data/examples/rails-single/config/application.rb +42 -0
- data/examples/rails-single/config/boot.rb +4 -0
- data/examples/rails-single/config/cable.yml +17 -0
- data/examples/rails-single/config/cache.yml +16 -0
- data/examples/rails-single/config/credentials.yml.enc +1 -0
- data/examples/rails-single/config/database.yml +100 -0
- data/examples/rails-single/config/environment.rb +5 -0
- data/examples/rails-single/config/environments/development.rb +69 -0
- data/examples/rails-single/config/environments/production.rb +87 -0
- data/examples/rails-single/config/environments/test.rb +50 -0
- data/examples/rails-single/config/initializers/assets.rb +7 -0
- data/examples/rails-single/config/initializers/content_security_policy.rb +25 -0
- data/examples/rails-single/config/initializers/filter_parameter_logging.rb +8 -0
- data/examples/rails-single/config/initializers/inflections.rb +16 -0
- data/examples/rails-single/config/locales/en.yml +31 -0
- data/examples/rails-single/config/puma.rb +41 -0
- data/examples/rails-single/config/queue.yml +18 -0
- data/examples/rails-single/config/recurring.yml +15 -0
- data/examples/rails-single/config/routes.rb +4 -0
- data/examples/rails-single/config.ru +6 -0
- data/examples/rails-single/db/cable_schema.rb +11 -0
- data/examples/rails-single/db/cache_schema.rb +12 -0
- data/examples/rails-single/db/migrate/20251123095526_create_users.rb +10 -0
- data/examples/rails-single/db/queue_schema.rb +129 -0
- data/examples/rails-single/db/seeds.rb +9 -0
- data/examples/rails-single/deploy.yml +57 -0
- data/examples/rails-single/lib/tasks/.keep +0 -0
- data/examples/rails-single/log/.keep +0 -0
- data/examples/rails-single/package.json +17 -0
- data/examples/rails-single/public/400.html +114 -0
- data/examples/rails-single/public/404.html +114 -0
- data/examples/rails-single/public/406-unsupported-browser.html +114 -0
- data/examples/rails-single/public/422.html +114 -0
- data/examples/rails-single/public/500.html +114 -0
- data/examples/rails-single/public/icon.png +0 -0
- data/examples/rails-single/public/icon.svg +3 -0
- data/examples/rails-single/public/robots.txt +1 -0
- data/examples/rails-single/script/.keep +0 -0
- data/examples/rails-single/vendor/.keep +0 -0
- data/examples/rails-single/yarn.lock +188 -0
- data/exe/nvoi +6 -0
- data/lib/nvoi/cli.rb +190 -0
- data/lib/nvoi/cloudflare/client.rb +287 -0
- data/lib/nvoi/config/config.rb +248 -0
- data/lib/nvoi/config/env_resolver.rb +63 -0
- data/lib/nvoi/config/loader.rb +102 -0
- data/lib/nvoi/config/naming.rb +196 -0
- data/lib/nvoi/config/ssh_keys.rb +82 -0
- data/lib/nvoi/config/types.rb +274 -0
- data/lib/nvoi/constants.rb +59 -0
- data/lib/nvoi/credentials/crypto.rb +88 -0
- data/lib/nvoi/credentials/editor.rb +272 -0
- data/lib/nvoi/credentials/manager.rb +173 -0
- data/lib/nvoi/deployer/cleaner.rb +36 -0
- data/lib/nvoi/deployer/image_builder.rb +23 -0
- data/lib/nvoi/deployer/infrastructure.rb +126 -0
- data/lib/nvoi/deployer/orchestrator.rb +146 -0
- data/lib/nvoi/deployer/retry.rb +67 -0
- data/lib/nvoi/deployer/service_deployer.rb +311 -0
- data/lib/nvoi/deployer/tunnel_manager.rb +57 -0
- data/lib/nvoi/deployer/types.rb +8 -0
- data/lib/nvoi/errors.rb +67 -0
- data/lib/nvoi/k8s/renderer.rb +44 -0
- data/lib/nvoi/k8s/templates.rb +29 -0
- data/lib/nvoi/logger.rb +72 -0
- data/lib/nvoi/providers/aws.rb +403 -0
- data/lib/nvoi/providers/base.rb +111 -0
- data/lib/nvoi/providers/hetzner.rb +288 -0
- data/lib/nvoi/providers/hetzner_client.rb +170 -0
- data/lib/nvoi/remote/docker_manager.rb +203 -0
- data/lib/nvoi/remote/ssh_executor.rb +72 -0
- data/lib/nvoi/remote/volume_manager.rb +103 -0
- data/lib/nvoi/service/delete.rb +234 -0
- data/lib/nvoi/service/deploy.rb +80 -0
- data/lib/nvoi/service/exec.rb +144 -0
- data/lib/nvoi/service/provider.rb +36 -0
- data/lib/nvoi/steps/application_deployer.rb +26 -0
- data/lib/nvoi/steps/database_provisioner.rb +60 -0
- data/lib/nvoi/steps/k3s_cluster_setup.rb +105 -0
- data/lib/nvoi/steps/k3s_provisioner.rb +351 -0
- data/lib/nvoi/steps/server_provisioner.rb +43 -0
- data/lib/nvoi/steps/services_provisioner.rb +29 -0
- data/lib/nvoi/steps/tunnel_configurator.rb +66 -0
- data/lib/nvoi/steps/volume_provisioner.rb +154 -0
- data/lib/nvoi/version.rb +5 -0
- data/lib/nvoi.rb +79 -0
- data/templates/app-deployment.yaml.erb +102 -0
- data/templates/app-ingress.yaml.erb +20 -0
- data/templates/app-secret.yaml.erb +10 -0
- data/templates/app-service.yaml.erb +12 -0
- data/templates/db-statefulset.yaml.erb +76 -0
- data/templates/service-deployment.yaml.erb +91 -0
- data/templates/worker-deployment.yaml.erb +50 -0
- metadata +361 -0
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# PostgreSQL. Versions 9.3 and up are supported.
|
|
2
|
+
#
|
|
3
|
+
# Install the pg driver:
|
|
4
|
+
# gem install pg
|
|
5
|
+
# On macOS with Homebrew:
|
|
6
|
+
# gem install pg -- --with-pg-config=/usr/local/bin/pg_config
|
|
7
|
+
# On Windows:
|
|
8
|
+
# gem install pg
|
|
9
|
+
# Choose the win32 build.
|
|
10
|
+
# Install PostgreSQL and put its /bin directory on your path.
|
|
11
|
+
#
|
|
12
|
+
# Configure Using Gemfile
|
|
13
|
+
# gem "pg"
|
|
14
|
+
#
|
|
15
|
+
default: &default
|
|
16
|
+
adapter: postgresql
|
|
17
|
+
encoding: unicode
|
|
18
|
+
# For details on connection pooling, see Rails configuration guide
|
|
19
|
+
# https://guides.rubyonrails.org/configuring.html#database-pooling
|
|
20
|
+
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
development:
|
|
24
|
+
<<: *default
|
|
25
|
+
database: rails_single_development
|
|
26
|
+
|
|
27
|
+
# The specified database role being used to connect to PostgreSQL.
|
|
28
|
+
# To create additional roles in PostgreSQL see `$ createuser --help`.
|
|
29
|
+
# When left blank, PostgreSQL will use the default role. This is
|
|
30
|
+
# the same name as the operating system user running Rails.
|
|
31
|
+
#username: rails_single
|
|
32
|
+
|
|
33
|
+
# The password associated with the PostgreSQL role (username).
|
|
34
|
+
#password:
|
|
35
|
+
|
|
36
|
+
# Connect on a TCP socket. Omitted by default since the client uses a
|
|
37
|
+
# domain socket that doesn't need configuration. Windows does not have
|
|
38
|
+
# domain sockets, so uncomment these lines.
|
|
39
|
+
#host: localhost
|
|
40
|
+
|
|
41
|
+
# The TCP port the server listens on. Defaults to 5432.
|
|
42
|
+
# If your server runs on a different port number, change accordingly.
|
|
43
|
+
#port: 5432
|
|
44
|
+
|
|
45
|
+
# Schema search path. The server defaults to $user,public
|
|
46
|
+
#schema_search_path: myapp,sharedapp,public
|
|
47
|
+
|
|
48
|
+
# Minimum log levels, in increasing order:
|
|
49
|
+
# debug5, debug4, debug3, debug2, debug1,
|
|
50
|
+
# log, notice, warning, error, fatal, and panic
|
|
51
|
+
# Defaults to warning.
|
|
52
|
+
#min_messages: notice
|
|
53
|
+
|
|
54
|
+
# Warning: The database defined as "test" will be erased and
|
|
55
|
+
# re-generated from your development database when you run "rake".
|
|
56
|
+
# Do not set this db to the same as development or production.
|
|
57
|
+
test:
|
|
58
|
+
<<: *default
|
|
59
|
+
database: rails_single_test
|
|
60
|
+
|
|
61
|
+
# As with config/credentials.yml, you never want to store sensitive information,
|
|
62
|
+
# like your database password, in your source code. If your source code is
|
|
63
|
+
# ever seen by anyone, they now have access to your database.
|
|
64
|
+
#
|
|
65
|
+
# Instead, provide the password or a full connection URL as an environment
|
|
66
|
+
# variable when you boot the app. For example:
|
|
67
|
+
#
|
|
68
|
+
# DATABASE_URL="postgres://myuser:mypass@localhost/somedatabase"
|
|
69
|
+
#
|
|
70
|
+
# If the connection URL is provided in the special DATABASE_URL environment
|
|
71
|
+
# variable, Rails will automatically merge its configuration values on top of
|
|
72
|
+
# the values provided in this file. Alternatively, you can specify a connection
|
|
73
|
+
# URL environment variable explicitly:
|
|
74
|
+
#
|
|
75
|
+
# production:
|
|
76
|
+
# url: <%= ENV["MY_APP_DATABASE_URL"] %>
|
|
77
|
+
#
|
|
78
|
+
# Read https://guides.rubyonrails.org/configuring.html#configuring-a-database
|
|
79
|
+
# for a full overview on how database connection configuration can be specified.
|
|
80
|
+
#
|
|
81
|
+
production:
|
|
82
|
+
primary: &primary_production
|
|
83
|
+
<<: *default
|
|
84
|
+
host: <%= ENV["POSTGRES_HOST"] %>
|
|
85
|
+
port: <%= ENV["POSTGRES_PORT"] %>
|
|
86
|
+
database: <%= ENV["POSTGRES_DB"] %>
|
|
87
|
+
username: <%= ENV["POSTGRES_USER"] %>
|
|
88
|
+
password: <%= ENV["POSTGRES_PASSWORD"] %>
|
|
89
|
+
cache:
|
|
90
|
+
<<: *primary_production
|
|
91
|
+
database: <%= ENV["POSTGRES_DB"] %>_cache
|
|
92
|
+
migrations_paths: db/cache_migrate
|
|
93
|
+
queue:
|
|
94
|
+
<<: *primary_production
|
|
95
|
+
database: <%= ENV["POSTGRES_DB"] %>_queue
|
|
96
|
+
migrations_paths: db/queue_migrate
|
|
97
|
+
cable:
|
|
98
|
+
<<: *primary_production
|
|
99
|
+
database: <%= ENV["POSTGRES_DB"] %>_cable
|
|
100
|
+
migrations_paths: db/cable_migrate
|
|
@@ -0,0 +1,69 @@
|
|
|
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
|
+
# Don't care if the mailer can't send.
|
|
32
|
+
config.action_mailer.raise_delivery_errors = false
|
|
33
|
+
|
|
34
|
+
# Make template changes take effect immediately.
|
|
35
|
+
config.action_mailer.perform_caching = false
|
|
36
|
+
|
|
37
|
+
# Set localhost to be used by links generated in mailer templates.
|
|
38
|
+
config.action_mailer.default_url_options = { host: "localhost", port: 3000 }
|
|
39
|
+
|
|
40
|
+
# Print deprecation notices to the Rails logger.
|
|
41
|
+
config.active_support.deprecation = :log
|
|
42
|
+
|
|
43
|
+
# Raise an error on page load if there are pending migrations.
|
|
44
|
+
config.active_record.migration_error = :page_load
|
|
45
|
+
|
|
46
|
+
# Highlight code that triggered database queries in logs.
|
|
47
|
+
config.active_record.verbose_query_logs = true
|
|
48
|
+
|
|
49
|
+
# Append comments with runtime information tags to SQL queries in logs.
|
|
50
|
+
config.active_record.query_log_tags_enabled = true
|
|
51
|
+
|
|
52
|
+
# Highlight code that enqueued background job in logs.
|
|
53
|
+
config.active_job.verbose_enqueue_logs = true
|
|
54
|
+
|
|
55
|
+
# Raises error for missing translations.
|
|
56
|
+
# config.i18n.raise_on_missing_translations = true
|
|
57
|
+
|
|
58
|
+
# Annotate rendered view with file names.
|
|
59
|
+
config.action_view.annotate_rendered_view_with_filenames = true
|
|
60
|
+
|
|
61
|
+
# Uncomment if you wish to allow Action Cable access from any origin.
|
|
62
|
+
# config.action_cable.disable_request_forgery_protection = true
|
|
63
|
+
|
|
64
|
+
# Raise error when a before_action's only/except options reference missing actions.
|
|
65
|
+
config.action_controller.raise_on_missing_callback_actions = true
|
|
66
|
+
|
|
67
|
+
# Apply autocorrection by RuboCop to files generated by `bin/rails generate`.
|
|
68
|
+
# config.generators.apply_rubocop_autocorrect_after_generate!
|
|
69
|
+
end
|
|
@@ -0,0 +1,87 @@
|
|
|
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
|
+
# Code is not reloaded between requests.
|
|
7
|
+
config.enable_reloading = false
|
|
8
|
+
|
|
9
|
+
# Eager load code on boot for better performance and memory savings (ignored by Rake tasks).
|
|
10
|
+
config.eager_load = true
|
|
11
|
+
|
|
12
|
+
# Full error reports are disabled.
|
|
13
|
+
config.consider_all_requests_local = false
|
|
14
|
+
|
|
15
|
+
# Turn on fragment caching in view templates.
|
|
16
|
+
config.action_controller.perform_caching = true
|
|
17
|
+
|
|
18
|
+
# Cache assets for far-future expiry since they are all digest stamped.
|
|
19
|
+
config.public_file_server.headers = { "cache-control" => "public, max-age=#{1.year.to_i}" }
|
|
20
|
+
|
|
21
|
+
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
|
22
|
+
# config.asset_host = "http://assets.example.com"
|
|
23
|
+
|
|
24
|
+
# Assume all access to the app is happening through a SSL-terminating reverse proxy.
|
|
25
|
+
config.assume_ssl = true
|
|
26
|
+
|
|
27
|
+
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
|
28
|
+
config.force_ssl = true
|
|
29
|
+
|
|
30
|
+
# Skip http-to-https redirect for the default health check endpoint.
|
|
31
|
+
# config.ssl_options = { redirect: { exclude: ->(request) { request.path == "/up" } } }
|
|
32
|
+
|
|
33
|
+
# Log to STDOUT with the current request id as a default log tag.
|
|
34
|
+
config.log_tags = [ :request_id ]
|
|
35
|
+
config.logger = ActiveSupport::TaggedLogging.logger(STDOUT)
|
|
36
|
+
|
|
37
|
+
# Change to "debug" to log everything (including potentially personally-identifiable information!)
|
|
38
|
+
config.log_level = ENV.fetch("RAILS_LOG_LEVEL", "info")
|
|
39
|
+
|
|
40
|
+
# Prevent health checks from clogging up the logs.
|
|
41
|
+
config.silence_healthcheck_path = "/up"
|
|
42
|
+
|
|
43
|
+
# Don't log any deprecations.
|
|
44
|
+
config.active_support.report_deprecations = false
|
|
45
|
+
|
|
46
|
+
# Replace the default in-process memory cache store with a durable alternative.
|
|
47
|
+
config.cache_store = :solid_cache_store
|
|
48
|
+
|
|
49
|
+
# Replace the default in-process and non-durable queuing backend for Active Job.
|
|
50
|
+
config.active_job.queue_adapter = :solid_queue
|
|
51
|
+
config.solid_queue.connects_to = { database: { writing: :queue } }
|
|
52
|
+
|
|
53
|
+
# Ignore bad email addresses and do not raise email delivery errors.
|
|
54
|
+
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
|
|
55
|
+
# config.action_mailer.raise_delivery_errors = false
|
|
56
|
+
|
|
57
|
+
# Set host to be used by links generated in mailer templates.
|
|
58
|
+
config.action_mailer.default_url_options = { host: "example.com" }
|
|
59
|
+
|
|
60
|
+
# Specify outgoing SMTP server. Remember to add smtp/* credentials via rails credentials:edit.
|
|
61
|
+
# config.action_mailer.smtp_settings = {
|
|
62
|
+
# user_name: Rails.application.credentials.dig(:smtp, :user_name),
|
|
63
|
+
# password: Rails.application.credentials.dig(:smtp, :password),
|
|
64
|
+
# address: "smtp.example.com",
|
|
65
|
+
# port: 587,
|
|
66
|
+
# authentication: :plain
|
|
67
|
+
# }
|
|
68
|
+
|
|
69
|
+
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
|
70
|
+
# the I18n.default_locale when a translation cannot be found).
|
|
71
|
+
config.i18n.fallbacks = true
|
|
72
|
+
|
|
73
|
+
# Do not dump schema after migrations.
|
|
74
|
+
config.active_record.dump_schema_after_migration = false
|
|
75
|
+
|
|
76
|
+
# Only use :id for inspections in production.
|
|
77
|
+
config.active_record.attributes_for_inspect = [ :id ]
|
|
78
|
+
|
|
79
|
+
# Enable DNS rebinding protection and other `Host` header attacks.
|
|
80
|
+
# config.hosts = [
|
|
81
|
+
# "example.com", # Allow requests from example.com
|
|
82
|
+
# /.*\.example\.com/ # Allow requests from subdomains like `www.example.com`
|
|
83
|
+
# ]
|
|
84
|
+
#
|
|
85
|
+
# Skip DNS rebinding protection for the default health check endpoint.
|
|
86
|
+
# config.host_authorization = { exclude: ->(request) { request.path == "/up" } }
|
|
87
|
+
end
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# The test environment is used exclusively to run your application's
|
|
2
|
+
# test suite. You never need to work with it otherwise. Remember that
|
|
3
|
+
# your test database is "scratch space" for the test suite and is wiped
|
|
4
|
+
# and recreated between test runs. Don't rely on the data there!
|
|
5
|
+
|
|
6
|
+
Rails.application.configure do
|
|
7
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
|
8
|
+
|
|
9
|
+
# While tests run files are not watched, reloading is not necessary.
|
|
10
|
+
config.enable_reloading = false
|
|
11
|
+
|
|
12
|
+
# Eager loading loads your entire application. When running a single test locally,
|
|
13
|
+
# this is usually not necessary, and can slow down your test suite. However, it's
|
|
14
|
+
# recommended that you enable it in continuous integration systems to ensure eager
|
|
15
|
+
# loading is working properly before deploying your code.
|
|
16
|
+
config.eager_load = ENV["CI"].present?
|
|
17
|
+
|
|
18
|
+
# Configure public file server for tests with cache-control for performance.
|
|
19
|
+
config.public_file_server.headers = { "cache-control" => "public, max-age=3600" }
|
|
20
|
+
|
|
21
|
+
# Show full error reports.
|
|
22
|
+
config.consider_all_requests_local = true
|
|
23
|
+
config.cache_store = :null_store
|
|
24
|
+
|
|
25
|
+
# Render exception templates for rescuable exceptions and raise for other exceptions.
|
|
26
|
+
config.action_dispatch.show_exceptions = :rescuable
|
|
27
|
+
|
|
28
|
+
# Disable request forgery protection in test environment.
|
|
29
|
+
config.action_controller.allow_forgery_protection = false
|
|
30
|
+
|
|
31
|
+
# Tell Action Mailer not to deliver emails to the real world.
|
|
32
|
+
# The :test delivery method accumulates sent emails in the
|
|
33
|
+
# ActionMailer::Base.deliveries array.
|
|
34
|
+
config.action_mailer.delivery_method = :test
|
|
35
|
+
|
|
36
|
+
# Set host to be used by links generated in mailer templates.
|
|
37
|
+
config.action_mailer.default_url_options = { host: "example.com" }
|
|
38
|
+
|
|
39
|
+
# Print deprecation notices to the stderr.
|
|
40
|
+
config.active_support.deprecation = :stderr
|
|
41
|
+
|
|
42
|
+
# Raises error for missing translations.
|
|
43
|
+
# config.i18n.raise_on_missing_translations = true
|
|
44
|
+
|
|
45
|
+
# Annotate rendered view with file names.
|
|
46
|
+
# config.action_view.annotate_rendered_view_with_filenames = true
|
|
47
|
+
|
|
48
|
+
# Raise error when a before_action's only/except options reference missing actions.
|
|
49
|
+
config.action_controller.raise_on_missing_callback_actions = true
|
|
50
|
+
end
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
|
2
|
+
|
|
3
|
+
# Version of your assets, change this if you want to expire all your assets.
|
|
4
|
+
Rails.application.config.assets.version = "1.0"
|
|
5
|
+
|
|
6
|
+
# Add additional assets to the asset load path.
|
|
7
|
+
# Rails.application.config.assets.paths << Emoji.images_path
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
|
2
|
+
|
|
3
|
+
# Define an application-wide content security policy.
|
|
4
|
+
# See the Securing Rails Applications Guide for more information:
|
|
5
|
+
# https://guides.rubyonrails.org/security.html#content-security-policy-header
|
|
6
|
+
|
|
7
|
+
# Rails.application.configure do
|
|
8
|
+
# config.content_security_policy do |policy|
|
|
9
|
+
# policy.default_src :self, :https
|
|
10
|
+
# policy.font_src :self, :https, :data
|
|
11
|
+
# policy.img_src :self, :https, :data
|
|
12
|
+
# policy.object_src :none
|
|
13
|
+
# policy.script_src :self, :https
|
|
14
|
+
# policy.style_src :self, :https
|
|
15
|
+
# # Specify URI for violation reports
|
|
16
|
+
# # policy.report_uri "/csp-violation-report-endpoint"
|
|
17
|
+
# end
|
|
18
|
+
#
|
|
19
|
+
# # Generate session nonces for permitted importmap, inline scripts, and inline styles.
|
|
20
|
+
# config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s }
|
|
21
|
+
# config.content_security_policy_nonce_directives = %w(script-src style-src)
|
|
22
|
+
#
|
|
23
|
+
# # Report violations without enforcing the policy.
|
|
24
|
+
# # config.content_security_policy_report_only = true
|
|
25
|
+
# end
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
|
2
|
+
|
|
3
|
+
# Configure parameters to be partially matched (e.g. passw matches password) and filtered from the log file.
|
|
4
|
+
# Use this to limit dissemination of sensitive information.
|
|
5
|
+
# See the ActiveSupport::ParameterFilter documentation for supported notations and behaviors.
|
|
6
|
+
Rails.application.config.filter_parameters += [
|
|
7
|
+
:passw, :email, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn, :cvv, :cvc
|
|
8
|
+
]
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
|
2
|
+
|
|
3
|
+
# Add new inflection rules using the following format. Inflections
|
|
4
|
+
# are locale specific, and you may define rules for as many different
|
|
5
|
+
# locales as you wish. All of these examples are active by default:
|
|
6
|
+
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
|
7
|
+
# inflect.plural /^(ox)$/i, "\\1en"
|
|
8
|
+
# inflect.singular /^(ox)en/i, "\\1"
|
|
9
|
+
# inflect.irregular "person", "people"
|
|
10
|
+
# inflect.uncountable %w( fish sheep )
|
|
11
|
+
# end
|
|
12
|
+
|
|
13
|
+
# These inflection rules are supported but not enabled by default:
|
|
14
|
+
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
|
15
|
+
# inflect.acronym "RESTful"
|
|
16
|
+
# end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Files in the config/locales directory are used for internationalization and
|
|
2
|
+
# are automatically loaded by Rails. If you want to use locales other than
|
|
3
|
+
# English, add the necessary files in this directory.
|
|
4
|
+
#
|
|
5
|
+
# To use the locales, use `I18n.t`:
|
|
6
|
+
#
|
|
7
|
+
# I18n.t "hello"
|
|
8
|
+
#
|
|
9
|
+
# In views, this is aliased to just `t`:
|
|
10
|
+
#
|
|
11
|
+
# <%= t("hello") %>
|
|
12
|
+
#
|
|
13
|
+
# To use a different locale, set it with `I18n.locale`:
|
|
14
|
+
#
|
|
15
|
+
# I18n.locale = :es
|
|
16
|
+
#
|
|
17
|
+
# This would use the information in config/locales/es.yml.
|
|
18
|
+
#
|
|
19
|
+
# To learn more about the API, please read the Rails Internationalization guide
|
|
20
|
+
# at https://guides.rubyonrails.org/i18n.html.
|
|
21
|
+
#
|
|
22
|
+
# Be aware that YAML interprets the following case-insensitive strings as
|
|
23
|
+
# booleans: `true`, `false`, `on`, `off`, `yes`, `no`. Therefore, these strings
|
|
24
|
+
# must be quoted to be interpreted as strings. For example:
|
|
25
|
+
#
|
|
26
|
+
# en:
|
|
27
|
+
# "yes": yup
|
|
28
|
+
# enabled: "ON"
|
|
29
|
+
|
|
30
|
+
en:
|
|
31
|
+
hello: "Hello world"
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# This configuration file will be evaluated by Puma. The top-level methods that
|
|
2
|
+
# are invoked here are part of Puma's configuration DSL. For more information
|
|
3
|
+
# about methods provided by the DSL, see https://puma.io/puma/Puma/DSL.html.
|
|
4
|
+
#
|
|
5
|
+
# Puma starts a configurable number of processes (workers) and each process
|
|
6
|
+
# serves each request in a thread from an internal thread pool.
|
|
7
|
+
#
|
|
8
|
+
# You can control the number of workers using ENV["WEB_CONCURRENCY"]. You
|
|
9
|
+
# should only set this value when you want to run 2 or more workers. The
|
|
10
|
+
# default is already 1.
|
|
11
|
+
#
|
|
12
|
+
# The ideal number of threads per worker depends both on how much time the
|
|
13
|
+
# application spends waiting for IO operations and on how much you wish to
|
|
14
|
+
# prioritize throughput over latency.
|
|
15
|
+
#
|
|
16
|
+
# As a rule of thumb, increasing the number of threads will increase how much
|
|
17
|
+
# traffic a given process can handle (throughput), but due to CRuby's
|
|
18
|
+
# Global VM Lock (GVL) it has diminishing returns and will degrade the
|
|
19
|
+
# response time (latency) of the application.
|
|
20
|
+
#
|
|
21
|
+
# The default is set to 3 threads as it's deemed a decent compromise between
|
|
22
|
+
# throughput and latency for the average Rails application.
|
|
23
|
+
#
|
|
24
|
+
# Any libraries that use a connection pool or another resource pool should
|
|
25
|
+
# be configured to provide at least as many connections as the number of
|
|
26
|
+
# threads. This includes Active Record's `pool` parameter in `database.yml`.
|
|
27
|
+
threads_count = ENV.fetch("RAILS_MAX_THREADS", 3)
|
|
28
|
+
threads threads_count, threads_count
|
|
29
|
+
|
|
30
|
+
# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
|
|
31
|
+
port ENV.fetch("PORT", 3000)
|
|
32
|
+
|
|
33
|
+
# Allow puma to be restarted by `bin/rails restart` command.
|
|
34
|
+
plugin :tmp_restart
|
|
35
|
+
|
|
36
|
+
# Run the Solid Queue supervisor inside of Puma for single-server deployments
|
|
37
|
+
plugin :solid_queue if ENV["SOLID_QUEUE_IN_PUMA"]
|
|
38
|
+
|
|
39
|
+
# Specify the PID file. Defaults to tmp/pids/server.pid in development.
|
|
40
|
+
# In other environments, only set the PID file if requested.
|
|
41
|
+
pidfile ENV["PIDFILE"] if ENV["PIDFILE"]
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
default: &default
|
|
2
|
+
dispatchers:
|
|
3
|
+
- polling_interval: 1
|
|
4
|
+
batch_size: 500
|
|
5
|
+
workers:
|
|
6
|
+
- queues: "*"
|
|
7
|
+
threads: 3
|
|
8
|
+
processes: <%= ENV.fetch("JOB_CONCURRENCY", 1) %>
|
|
9
|
+
polling_interval: 0.1
|
|
10
|
+
|
|
11
|
+
development:
|
|
12
|
+
<<: *default
|
|
13
|
+
|
|
14
|
+
test:
|
|
15
|
+
<<: *default
|
|
16
|
+
|
|
17
|
+
production:
|
|
18
|
+
<<: *default
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# examples:
|
|
2
|
+
# periodic_cleanup:
|
|
3
|
+
# class: CleanSoftDeletedRecordsJob
|
|
4
|
+
# queue: background
|
|
5
|
+
# args: [ 1000, { batch_size: 500 } ]
|
|
6
|
+
# schedule: every hour
|
|
7
|
+
# periodic_cleanup_with_command:
|
|
8
|
+
# command: "SoftDeletedRecord.due.delete_all"
|
|
9
|
+
# priority: 2
|
|
10
|
+
# schedule: at 5am every day
|
|
11
|
+
|
|
12
|
+
production:
|
|
13
|
+
clear_solid_queue_finished_jobs:
|
|
14
|
+
command: "SolidQueue::Job.clear_finished_in_batches(sleep_between_batches: 0.3)"
|
|
15
|
+
schedule: every hour at minute 12
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
ActiveRecord::Schema[7.1].define(version: 1) do
|
|
2
|
+
create_table "solid_cable_messages", force: :cascade do |t|
|
|
3
|
+
t.binary "channel", limit: 1024, null: false
|
|
4
|
+
t.binary "payload", limit: 536870912, null: false
|
|
5
|
+
t.datetime "created_at", null: false
|
|
6
|
+
t.integer "channel_hash", limit: 8, null: false
|
|
7
|
+
t.index [ "channel" ], name: "index_solid_cable_messages_on_channel"
|
|
8
|
+
t.index [ "channel_hash" ], name: "index_solid_cable_messages_on_channel_hash"
|
|
9
|
+
t.index [ "created_at" ], name: "index_solid_cable_messages_on_created_at"
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
ActiveRecord::Schema[7.2].define(version: 1) do
|
|
2
|
+
create_table "solid_cache_entries", force: :cascade do |t|
|
|
3
|
+
t.binary "key", limit: 1024, null: false
|
|
4
|
+
t.binary "value", limit: 536870912, null: false
|
|
5
|
+
t.datetime "created_at", null: false
|
|
6
|
+
t.integer "key_hash", limit: 8, null: false
|
|
7
|
+
t.integer "byte_size", limit: 4, null: false
|
|
8
|
+
t.index [ "byte_size" ], name: "index_solid_cache_entries_on_byte_size"
|
|
9
|
+
t.index [ "key_hash", "byte_size" ], name: "index_solid_cache_entries_on_key_hash_and_byte_size"
|
|
10
|
+
t.index [ "key_hash" ], name: "index_solid_cache_entries_on_key_hash", unique: true
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
ActiveRecord::Schema[7.1].define(version: 1) do
|
|
2
|
+
create_table "solid_queue_blocked_executions", force: :cascade do |t|
|
|
3
|
+
t.bigint "job_id", null: false
|
|
4
|
+
t.string "queue_name", null: false
|
|
5
|
+
t.integer "priority", default: 0, null: false
|
|
6
|
+
t.string "concurrency_key", null: false
|
|
7
|
+
t.datetime "expires_at", null: false
|
|
8
|
+
t.datetime "created_at", null: false
|
|
9
|
+
t.index [ "concurrency_key", "priority", "job_id" ], name: "index_solid_queue_blocked_executions_for_release"
|
|
10
|
+
t.index [ "expires_at", "concurrency_key" ], name: "index_solid_queue_blocked_executions_for_maintenance"
|
|
11
|
+
t.index [ "job_id" ], name: "index_solid_queue_blocked_executions_on_job_id", unique: true
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
create_table "solid_queue_claimed_executions", force: :cascade do |t|
|
|
15
|
+
t.bigint "job_id", null: false
|
|
16
|
+
t.bigint "process_id"
|
|
17
|
+
t.datetime "created_at", null: false
|
|
18
|
+
t.index [ "job_id" ], name: "index_solid_queue_claimed_executions_on_job_id", unique: true
|
|
19
|
+
t.index [ "process_id", "job_id" ], name: "index_solid_queue_claimed_executions_on_process_id_and_job_id"
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
create_table "solid_queue_failed_executions", force: :cascade do |t|
|
|
23
|
+
t.bigint "job_id", null: false
|
|
24
|
+
t.text "error"
|
|
25
|
+
t.datetime "created_at", null: false
|
|
26
|
+
t.index [ "job_id" ], name: "index_solid_queue_failed_executions_on_job_id", unique: true
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
create_table "solid_queue_jobs", force: :cascade do |t|
|
|
30
|
+
t.string "queue_name", null: false
|
|
31
|
+
t.string "class_name", null: false
|
|
32
|
+
t.text "arguments"
|
|
33
|
+
t.integer "priority", default: 0, null: false
|
|
34
|
+
t.string "active_job_id"
|
|
35
|
+
t.datetime "scheduled_at"
|
|
36
|
+
t.datetime "finished_at"
|
|
37
|
+
t.string "concurrency_key"
|
|
38
|
+
t.datetime "created_at", null: false
|
|
39
|
+
t.datetime "updated_at", null: false
|
|
40
|
+
t.index [ "active_job_id" ], name: "index_solid_queue_jobs_on_active_job_id"
|
|
41
|
+
t.index [ "class_name" ], name: "index_solid_queue_jobs_on_class_name"
|
|
42
|
+
t.index [ "finished_at" ], name: "index_solid_queue_jobs_on_finished_at"
|
|
43
|
+
t.index [ "queue_name", "finished_at" ], name: "index_solid_queue_jobs_for_filtering"
|
|
44
|
+
t.index [ "scheduled_at", "finished_at" ], name: "index_solid_queue_jobs_for_alerting"
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
create_table "solid_queue_pauses", force: :cascade do |t|
|
|
48
|
+
t.string "queue_name", null: false
|
|
49
|
+
t.datetime "created_at", null: false
|
|
50
|
+
t.index [ "queue_name" ], name: "index_solid_queue_pauses_on_queue_name", unique: true
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
create_table "solid_queue_processes", force: :cascade do |t|
|
|
54
|
+
t.string "kind", null: false
|
|
55
|
+
t.datetime "last_heartbeat_at", null: false
|
|
56
|
+
t.bigint "supervisor_id"
|
|
57
|
+
t.integer "pid", null: false
|
|
58
|
+
t.string "hostname"
|
|
59
|
+
t.text "metadata"
|
|
60
|
+
t.datetime "created_at", null: false
|
|
61
|
+
t.string "name", null: false
|
|
62
|
+
t.index [ "last_heartbeat_at" ], name: "index_solid_queue_processes_on_last_heartbeat_at"
|
|
63
|
+
t.index [ "name", "supervisor_id" ], name: "index_solid_queue_processes_on_name_and_supervisor_id", unique: true
|
|
64
|
+
t.index [ "supervisor_id" ], name: "index_solid_queue_processes_on_supervisor_id"
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
create_table "solid_queue_ready_executions", force: :cascade do |t|
|
|
68
|
+
t.bigint "job_id", null: false
|
|
69
|
+
t.string "queue_name", null: false
|
|
70
|
+
t.integer "priority", default: 0, null: false
|
|
71
|
+
t.datetime "created_at", null: false
|
|
72
|
+
t.index [ "job_id" ], name: "index_solid_queue_ready_executions_on_job_id", unique: true
|
|
73
|
+
t.index [ "priority", "job_id" ], name: "index_solid_queue_poll_all"
|
|
74
|
+
t.index [ "queue_name", "priority", "job_id" ], name: "index_solid_queue_poll_by_queue"
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
create_table "solid_queue_recurring_executions", force: :cascade do |t|
|
|
78
|
+
t.bigint "job_id", null: false
|
|
79
|
+
t.string "task_key", null: false
|
|
80
|
+
t.datetime "run_at", null: false
|
|
81
|
+
t.datetime "created_at", null: false
|
|
82
|
+
t.index [ "job_id" ], name: "index_solid_queue_recurring_executions_on_job_id", unique: true
|
|
83
|
+
t.index [ "task_key", "run_at" ], name: "index_solid_queue_recurring_executions_on_task_key_and_run_at", unique: true
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
create_table "solid_queue_recurring_tasks", force: :cascade do |t|
|
|
87
|
+
t.string "key", null: false
|
|
88
|
+
t.string "schedule", null: false
|
|
89
|
+
t.string "command", limit: 2048
|
|
90
|
+
t.string "class_name"
|
|
91
|
+
t.text "arguments"
|
|
92
|
+
t.string "queue_name"
|
|
93
|
+
t.integer "priority", default: 0
|
|
94
|
+
t.boolean "static", default: true, null: false
|
|
95
|
+
t.text "description"
|
|
96
|
+
t.datetime "created_at", null: false
|
|
97
|
+
t.datetime "updated_at", null: false
|
|
98
|
+
t.index [ "key" ], name: "index_solid_queue_recurring_tasks_on_key", unique: true
|
|
99
|
+
t.index [ "static" ], name: "index_solid_queue_recurring_tasks_on_static"
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
create_table "solid_queue_scheduled_executions", force: :cascade do |t|
|
|
103
|
+
t.bigint "job_id", null: false
|
|
104
|
+
t.string "queue_name", null: false
|
|
105
|
+
t.integer "priority", default: 0, null: false
|
|
106
|
+
t.datetime "scheduled_at", null: false
|
|
107
|
+
t.datetime "created_at", null: false
|
|
108
|
+
t.index [ "job_id" ], name: "index_solid_queue_scheduled_executions_on_job_id", unique: true
|
|
109
|
+
t.index [ "scheduled_at", "priority", "job_id" ], name: "index_solid_queue_dispatch_all"
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
create_table "solid_queue_semaphores", force: :cascade do |t|
|
|
113
|
+
t.string "key", null: false
|
|
114
|
+
t.integer "value", default: 1, null: false
|
|
115
|
+
t.datetime "expires_at", null: false
|
|
116
|
+
t.datetime "created_at", null: false
|
|
117
|
+
t.datetime "updated_at", null: false
|
|
118
|
+
t.index [ "expires_at" ], name: "index_solid_queue_semaphores_on_expires_at"
|
|
119
|
+
t.index [ "key", "value" ], name: "index_solid_queue_semaphores_on_key_and_value"
|
|
120
|
+
t.index [ "key" ], name: "index_solid_queue_semaphores_on_key", unique: true
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
add_foreign_key "solid_queue_blocked_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
|
|
124
|
+
add_foreign_key "solid_queue_claimed_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
|
|
125
|
+
add_foreign_key "solid_queue_failed_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
|
|
126
|
+
add_foreign_key "solid_queue_ready_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
|
|
127
|
+
add_foreign_key "solid_queue_recurring_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
|
|
128
|
+
add_foreign_key "solid_queue_scheduled_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
|
|
129
|
+
end
|