active_cached_resource 0.0.1.pre
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/.rspec +3 -0
- data/.rubocop.yml +22 -0
- data/.standard.yml +2 -0
- data/CHANGELOG.md +5 -0
- data/README.md +45 -0
- data/Rakefile +21 -0
- data/example/consumer/.dockerignore +41 -0
- data/example/consumer/.gitattributes +9 -0
- data/example/consumer/.gitignore +36 -0
- data/example/consumer/.kamal/hooks/docker-setup.sample +3 -0
- data/example/consumer/.kamal/hooks/post-deploy.sample +14 -0
- data/example/consumer/.kamal/hooks/post-proxy-reboot.sample +3 -0
- data/example/consumer/.kamal/hooks/pre-build.sample +51 -0
- data/example/consumer/.kamal/hooks/pre-connect.sample +47 -0
- data/example/consumer/.kamal/hooks/pre-deploy.sample +109 -0
- data/example/consumer/.kamal/hooks/pre-proxy-reboot.sample +3 -0
- data/example/consumer/.kamal/secrets +17 -0
- data/example/consumer/Dockerfile +65 -0
- data/example/consumer/Gemfile +17 -0
- data/example/consumer/Rakefile +6 -0
- data/example/consumer/app/controllers/application_controller.rb +2 -0
- data/example/consumer/app/controllers/concerns/.keep +0 -0
- data/example/consumer/app/jobs/application_job.rb +7 -0
- data/example/consumer/app/mailers/application_mailer.rb +4 -0
- data/example/consumer/app/models/application_record.rb +3 -0
- data/example/consumer/app/models/concerns/.keep +0 -0
- data/example/consumer/app/models/person.rb +9 -0
- data/example/consumer/app/views/layouts/mailer.html.erb +13 -0
- data/example/consumer/app/views/layouts/mailer.text.erb +1 -0
- data/example/consumer/bin/brakeman +7 -0
- data/example/consumer/bin/bundle +109 -0
- data/example/consumer/bin/dev +2 -0
- data/example/consumer/bin/docker-entrypoint +14 -0
- data/example/consumer/bin/jobs +6 -0
- data/example/consumer/bin/kamal +27 -0
- data/example/consumer/bin/rails +4 -0
- data/example/consumer/bin/rake +4 -0
- data/example/consumer/bin/rubocop +8 -0
- data/example/consumer/bin/setup +34 -0
- data/example/consumer/bin/thrust +5 -0
- data/example/consumer/config/application.rb +20 -0
- data/example/consumer/config/boot.rb +3 -0
- data/example/consumer/config/cache.yml +16 -0
- data/example/consumer/config/credentials.yml.enc +1 -0
- data/example/consumer/config/database.yml +14 -0
- data/example/consumer/config/deploy.yml +116 -0
- data/example/consumer/config/environment.rb +5 -0
- data/example/consumer/config/environments/development.rb +64 -0
- data/example/consumer/config/environments/production.rb +85 -0
- data/example/consumer/config/environments/test.rb +50 -0
- data/example/consumer/config/initializers/cors.rb +16 -0
- data/example/consumer/config/initializers/filter_parameter_logging.rb +8 -0
- data/example/consumer/config/initializers/inflections.rb +16 -0
- data/example/consumer/config/locales/en.yml +31 -0
- data/example/consumer/config/puma.rb +41 -0
- data/example/consumer/config/queue.yml +18 -0
- data/example/consumer/config/recurring.yml +10 -0
- data/example/consumer/config/routes.rb +10 -0
- data/example/consumer/config.ru +6 -0
- data/example/consumer/db/cache_schema.rb +14 -0
- data/example/consumer/db/queue_schema.rb +129 -0
- data/example/consumer/db/seeds.rb +0 -0
- data/example/consumer/lib/tasks/.keep +0 -0
- data/example/consumer/log/.keep +0 -0
- data/example/consumer/public/robots.txt +1 -0
- data/example/consumer/script/.keep +0 -0
- data/example/consumer/storage/.keep +0 -0
- data/example/consumer/tmp/.keep +0 -0
- data/example/consumer/tmp/cache/.keep +0 -0
- data/example/consumer/tmp/pids/.keep +0 -0
- data/example/consumer/tmp/storage/.keep +0 -0
- data/example/consumer/vendor/.keep +0 -0
- data/example/provider/.dockerignore +41 -0
- data/example/provider/.gitattributes +9 -0
- data/example/provider/.gitignore +32 -0
- data/example/provider/.kamal/hooks/docker-setup.sample +3 -0
- data/example/provider/.kamal/hooks/post-deploy.sample +14 -0
- data/example/provider/.kamal/hooks/post-proxy-reboot.sample +3 -0
- data/example/provider/.kamal/hooks/pre-build.sample +51 -0
- data/example/provider/.kamal/hooks/pre-connect.sample +47 -0
- data/example/provider/.kamal/hooks/pre-deploy.sample +109 -0
- data/example/provider/.kamal/hooks/pre-proxy-reboot.sample +3 -0
- data/example/provider/.kamal/secrets +17 -0
- data/example/provider/Dockerfile +65 -0
- data/example/provider/Gemfile +14 -0
- data/example/provider/Rakefile +6 -0
- data/example/provider/app/controllers/application_controller.rb +2 -0
- data/example/provider/app/controllers/concerns/.keep +0 -0
- data/example/provider/app/controllers/people_controller.rb +68 -0
- data/example/provider/app/jobs/application_job.rb +7 -0
- data/example/provider/app/mailers/application_mailer.rb +4 -0
- data/example/provider/app/models/address.rb +3 -0
- data/example/provider/app/models/application_record.rb +3 -0
- data/example/provider/app/models/company.rb +3 -0
- data/example/provider/app/models/concerns/.keep +0 -0
- data/example/provider/app/models/person.rb +6 -0
- data/example/provider/app/views/layouts/mailer.html.erb +13 -0
- data/example/provider/app/views/layouts/mailer.text.erb +1 -0
- data/example/provider/bin/brakeman +7 -0
- data/example/provider/bin/bundle +109 -0
- data/example/provider/bin/dev +2 -0
- data/example/provider/bin/docker-entrypoint +14 -0
- data/example/provider/bin/jobs +6 -0
- data/example/provider/bin/kamal +27 -0
- data/example/provider/bin/rails +4 -0
- data/example/provider/bin/rake +4 -0
- data/example/provider/bin/rubocop +8 -0
- data/example/provider/bin/setup +34 -0
- data/example/provider/bin/thrust +5 -0
- data/example/provider/config/application.rb +44 -0
- data/example/provider/config/boot.rb +3 -0
- data/example/provider/config/cache.yml +16 -0
- data/example/provider/config/credentials.yml.enc +1 -0
- data/example/provider/config/database.yml +20 -0
- data/example/provider/config/deploy.yml +116 -0
- data/example/provider/config/environment.rb +5 -0
- data/example/provider/config/environments/development.rb +64 -0
- data/example/provider/config/environments/production.rb +85 -0
- data/example/provider/config/environments/test.rb +50 -0
- data/example/provider/config/initializers/cors.rb +16 -0
- data/example/provider/config/initializers/filter_parameter_logging.rb +8 -0
- data/example/provider/config/initializers/inflections.rb +16 -0
- data/example/provider/config/locales/en.yml +31 -0
- data/example/provider/config/puma.rb +41 -0
- data/example/provider/config/queue.yml +18 -0
- data/example/provider/config/recurring.yml +10 -0
- data/example/provider/config/routes.rb +4 -0
- data/example/provider/config.ru +6 -0
- data/example/provider/db/cache_schema.rb +14 -0
- data/example/provider/db/migrate/20241202183937_create_people.rb +11 -0
- data/example/provider/db/migrate/20241202183955_create_addresses.rb +13 -0
- data/example/provider/db/migrate/20241202184017_create_companies.rb +14 -0
- data/example/provider/db/queue_schema.rb +129 -0
- data/example/provider/db/schema.rb +47 -0
- data/example/provider/db/seeds.rb +18 -0
- data/example/provider/lib/tasks/.keep +0 -0
- data/example/provider/log/.keep +0 -0
- data/example/provider/public/robots.txt +1 -0
- data/example/provider/script/.keep +0 -0
- data/example/provider/storage/.keep +0 -0
- data/example/provider/tmp/.keep +0 -0
- data/example/provider/tmp/pids/.keep +0 -0
- data/example/provider/tmp/storage/.keep +0 -0
- data/example/provider/vendor/.keep +0 -0
- data/lib/active_cached_resource/caching.rb +176 -0
- data/lib/active_cached_resource/caching_strategies/active_support_cache.rb +31 -0
- data/lib/active_cached_resource/caching_strategies/base.rb +114 -0
- data/lib/active_cached_resource/caching_strategies/sql_cache.rb +32 -0
- data/lib/active_cached_resource/configuration.rb +50 -0
- data/lib/active_cached_resource/logger.rb +22 -0
- data/lib/active_cached_resource/model.rb +33 -0
- data/lib/active_cached_resource/version.rb +12 -0
- data/lib/active_cached_resource.rb +64 -0
- data/lib/activeresource/.gitignore +15 -0
- data/lib/activeresource/README.md +283 -0
- data/lib/activeresource/examples/performance.rb +72 -0
- data/lib/activeresource/lib/active_resource/active_job_serializer.rb +26 -0
- data/lib/activeresource/lib/active_resource/associations/builder/association.rb +32 -0
- data/lib/activeresource/lib/active_resource/associations/builder/belongs_to.rb +16 -0
- data/lib/activeresource/lib/active_resource/associations/builder/has_many.rb +14 -0
- data/lib/activeresource/lib/active_resource/associations/builder/has_one.rb +14 -0
- data/lib/activeresource/lib/active_resource/associations.rb +175 -0
- data/lib/activeresource/lib/active_resource/base.rb +1741 -0
- data/lib/activeresource/lib/active_resource/callbacks.rb +22 -0
- data/lib/activeresource/lib/active_resource/collection.rb +214 -0
- data/lib/activeresource/lib/active_resource/connection.rb +298 -0
- data/lib/activeresource/lib/active_resource/custom_methods.rb +129 -0
- data/lib/activeresource/lib/active_resource/exceptions.rb +98 -0
- data/lib/activeresource/lib/active_resource/formats/json_format.rb +28 -0
- data/lib/activeresource/lib/active_resource/formats/xml_format.rb +27 -0
- data/lib/activeresource/lib/active_resource/formats.rb +24 -0
- data/lib/activeresource/lib/active_resource/http_mock.rb +386 -0
- data/lib/activeresource/lib/active_resource/inheriting_hash.rb +34 -0
- data/lib/activeresource/lib/active_resource/log_subscriber.rb +26 -0
- data/lib/activeresource/lib/active_resource/railtie.rb +31 -0
- data/lib/activeresource/lib/active_resource/reflection.rb +78 -0
- data/lib/activeresource/lib/active_resource/schema.rb +60 -0
- data/lib/activeresource/lib/active_resource/singleton.rb +111 -0
- data/lib/activeresource/lib/active_resource/threadsafe_attributes.rb +65 -0
- data/lib/activeresource/lib/active_resource/validations.rb +176 -0
- data/lib/activeresource/lib/active_resource.rb +49 -0
- data/lib/activeresource/lib/activeresource.rb +3 -0
- data/lib/activeresource/test/abstract_unit.rb +153 -0
- data/lib/activeresource/test/cases/active_job_serializer_test.rb +53 -0
- data/lib/activeresource/test/cases/association_test.rb +104 -0
- data/lib/activeresource/test/cases/associations/builder/belongs_to_test.rb +42 -0
- data/lib/activeresource/test/cases/associations/builder/has_many_test.rb +28 -0
- data/lib/activeresource/test/cases/associations/builder/has_one_test.rb +28 -0
- data/lib/activeresource/test/cases/authorization_test.rb +276 -0
- data/lib/activeresource/test/cases/base/custom_methods_test.rb +155 -0
- data/lib/activeresource/test/cases/base/equality_test.rb +53 -0
- data/lib/activeresource/test/cases/base/load_test.rb +249 -0
- data/lib/activeresource/test/cases/base/schema_test.rb +428 -0
- data/lib/activeresource/test/cases/base_errors_test.rb +129 -0
- data/lib/activeresource/test/cases/base_test.rb +1622 -0
- data/lib/activeresource/test/cases/callbacks_test.rb +155 -0
- data/lib/activeresource/test/cases/collection_test.rb +172 -0
- data/lib/activeresource/test/cases/connection_test.rb +357 -0
- data/lib/activeresource/test/cases/finder_test.rb +217 -0
- data/lib/activeresource/test/cases/format_test.rb +137 -0
- data/lib/activeresource/test/cases/http_mock_test.rb +213 -0
- data/lib/activeresource/test/cases/inheritence_test.rb +19 -0
- data/lib/activeresource/test/cases/inheriting_hash_test.rb +25 -0
- data/lib/activeresource/test/cases/log_subscriber_test.rb +63 -0
- data/lib/activeresource/test/cases/reflection_test.rb +65 -0
- data/lib/activeresource/test/cases/validations_test.rb +78 -0
- data/lib/activeresource/test/fixtures/address.rb +20 -0
- data/lib/activeresource/test/fixtures/beast.rb +16 -0
- data/lib/activeresource/test/fixtures/comment.rb +5 -0
- data/lib/activeresource/test/fixtures/customer.rb +5 -0
- data/lib/activeresource/test/fixtures/inventory.rb +14 -0
- data/lib/activeresource/test/fixtures/person.rb +15 -0
- data/lib/activeresource/test/fixtures/pet.rb +6 -0
- data/lib/activeresource/test/fixtures/post.rb +5 -0
- data/lib/activeresource/test/fixtures/product.rb +11 -0
- data/lib/activeresource/test/fixtures/project.rb +19 -0
- data/lib/activeresource/test/fixtures/proxy.rb +6 -0
- data/lib/activeresource/test/fixtures/sound.rb +11 -0
- data/lib/activeresource/test/fixtures/street_address.rb +6 -0
- data/lib/activeresource/test/fixtures/subscription_plan.rb +7 -0
- data/lib/activeresource/test/fixtures/weather.rb +21 -0
- data/lib/activeresource/test/setter_trap.rb +28 -0
- data/lib/activeresource/test/singleton_test.rb +138 -0
- data/lib/activeresource/test/threadsafe_attributes_test.rb +91 -0
- data/lib/generators/active_cached_resource/install_generator.rb +31 -0
- data/lib/generators/active_cached_resource/templates/migration.erb +16 -0
- data/sorbet/config +4 -0
- data/sorbet/rbi/annotations/.gitattributes +1 -0
- data/sorbet/rbi/annotations/activemodel.rbi +89 -0
- data/sorbet/rbi/annotations/activesupport.rbi +457 -0
- data/sorbet/rbi/annotations/minitest.rbi +119 -0
- data/sorbet/rbi/annotations/rainbow.rbi +269 -0
- data/sorbet/rbi/dsl/.gitattributes +1 -0
- data/sorbet/rbi/dsl/active_support/callbacks.rbi +21 -0
- data/sorbet/rbi/gems/.gitattributes +1 -0
- data/sorbet/rbi/gems/actioncable@8.0.0.rbi +252 -0
- data/sorbet/rbi/gems/actionmailbox@8.0.0.rbi +9 -0
- data/sorbet/rbi/gems/actionmailer@8.0.0.rbi +9 -0
- data/sorbet/rbi/gems/actionpack@8.0.0.rbi +20909 -0
- data/sorbet/rbi/gems/actiontext@8.0.0.rbi +9 -0
- data/sorbet/rbi/gems/actionview@8.0.0.rbi +16207 -0
- data/sorbet/rbi/gems/activejob@8.0.0.rbi +9 -0
- data/sorbet/rbi/gems/activemodel-serializers-xml@1.0.3.rbi +166 -0
- data/sorbet/rbi/gems/activemodel@8.0.0.rbi +6857 -0
- data/sorbet/rbi/gems/activerecord@8.0.0.rbi +42896 -0
- data/sorbet/rbi/gems/activeresource@6.1.4.rbi +3944 -0
- data/sorbet/rbi/gems/activestorage@8.0.0.rbi +9 -0
- data/sorbet/rbi/gems/activesupport@8.0.0.rbi +21251 -0
- data/sorbet/rbi/gems/ast@2.4.2.rbi +585 -0
- data/sorbet/rbi/gems/base64@0.2.0.rbi +509 -0
- data/sorbet/rbi/gems/benchmark@0.4.0.rbi +618 -0
- data/sorbet/rbi/gems/bigdecimal@3.1.8.rbi +78 -0
- data/sorbet/rbi/gems/builder@3.3.0.rbi +9 -0
- data/sorbet/rbi/gems/bump@0.10.0.rbi +169 -0
- data/sorbet/rbi/gems/byebug@11.1.3.rbi +3607 -0
- data/sorbet/rbi/gems/coderay@1.1.3.rbi +3427 -0
- data/sorbet/rbi/gems/concurrent-ruby@1.3.4.rbi +11645 -0
- data/sorbet/rbi/gems/connection_pool@2.4.1.rbi +9 -0
- data/sorbet/rbi/gems/crass@1.0.6.rbi +623 -0
- data/sorbet/rbi/gems/date@3.4.0.rbi +75 -0
- data/sorbet/rbi/gems/diff-lcs@1.5.1.rbi +1131 -0
- data/sorbet/rbi/gems/docile@1.4.1.rbi +377 -0
- data/sorbet/rbi/gems/drb@2.2.1.rbi +1347 -0
- data/sorbet/rbi/gems/erubi@1.13.0.rbi +150 -0
- data/sorbet/rbi/gems/globalid@1.2.1.rbi +9 -0
- data/sorbet/rbi/gems/i18n@1.14.6.rbi +2359 -0
- data/sorbet/rbi/gems/io-console@0.7.2.rbi +9 -0
- data/sorbet/rbi/gems/json@2.8.2.rbi +1901 -0
- data/sorbet/rbi/gems/language_server-protocol@3.17.0.3.rbi +14238 -0
- data/sorbet/rbi/gems/lint_roller@1.1.0.rbi +240 -0
- data/sorbet/rbi/gems/logger@1.6.1.rbi +920 -0
- data/sorbet/rbi/gems/loofah@2.23.1.rbi +1081 -0
- data/sorbet/rbi/gems/mail@2.8.1.rbi +9 -0
- data/sorbet/rbi/gems/marcel@1.0.4.rbi +9 -0
- data/sorbet/rbi/gems/method_source@1.1.0.rbi +304 -0
- data/sorbet/rbi/gems/mini_mime@1.1.5.rbi +9 -0
- data/sorbet/rbi/gems/minitest@5.25.2.rbi +1547 -0
- data/sorbet/rbi/gems/net-imap@0.5.1.rbi +9 -0
- data/sorbet/rbi/gems/net-pop@0.1.2.rbi +9 -0
- data/sorbet/rbi/gems/net-protocol@0.2.2.rbi +292 -0
- data/sorbet/rbi/gems/net-smtp@0.5.0.rbi +9 -0
- data/sorbet/rbi/gems/netrc@0.11.0.rbi +159 -0
- data/sorbet/rbi/gems/nio4r@2.7.4.rbi +9 -0
- data/sorbet/rbi/gems/nokogiri@1.16.7.rbi +7311 -0
- data/sorbet/rbi/gems/parallel@1.26.3.rbi +291 -0
- data/sorbet/rbi/gems/parser@3.3.6.0.rbi +5519 -0
- data/sorbet/rbi/gems/prism@1.2.0.rbi +39085 -0
- data/sorbet/rbi/gems/pry-byebug@3.10.1.rbi +1151 -0
- data/sorbet/rbi/gems/pry@0.14.2.rbi +10076 -0
- data/sorbet/rbi/gems/psych@5.2.0.rbi +1785 -0
- data/sorbet/rbi/gems/racc@1.8.1.rbi +162 -0
- data/sorbet/rbi/gems/rack-session@2.0.0.rbi +727 -0
- data/sorbet/rbi/gems/rack-test@2.1.0.rbi +747 -0
- data/sorbet/rbi/gems/rack@3.1.8.rbi +4905 -0
- data/sorbet/rbi/gems/rackup@2.2.1.rbi +230 -0
- data/sorbet/rbi/gems/rails-dom-testing@2.2.0.rbi +758 -0
- data/sorbet/rbi/gems/rails-html-sanitizer@1.6.0.rbi +785 -0
- data/sorbet/rbi/gems/rails@8.0.0.rbi +9 -0
- data/sorbet/rbi/gems/railties@8.0.0.rbi +6287 -0
- data/sorbet/rbi/gems/rainbow@3.1.1.rbi +403 -0
- data/sorbet/rbi/gems/rake@13.2.1.rbi +3091 -0
- data/sorbet/rbi/gems/rbi@0.2.1.rbi +4535 -0
- data/sorbet/rbi/gems/rdoc@6.8.1.rbi +12572 -0
- data/sorbet/rbi/gems/regexp_parser@2.9.2.rbi +3772 -0
- data/sorbet/rbi/gems/reline@0.5.12.rbi +2416 -0
- data/sorbet/rbi/gems/rexml@3.3.9.rbi +4858 -0
- data/sorbet/rbi/gems/rspec-core@3.13.2.rbi +11287 -0
- data/sorbet/rbi/gems/rspec-expectations@3.13.3.rbi +8183 -0
- data/sorbet/rbi/gems/rspec-mocks@3.13.2.rbi +5341 -0
- data/sorbet/rbi/gems/rspec-support@3.13.1.rbi +1630 -0
- data/sorbet/rbi/gems/rspec@3.13.0.rbi +83 -0
- data/sorbet/rbi/gems/rubocop-ast@1.36.1.rbi +7303 -0
- data/sorbet/rbi/gems/rubocop-performance@1.21.1.rbi +9 -0
- data/sorbet/rbi/gems/rubocop@1.65.1.rbi +58170 -0
- data/sorbet/rbi/gems/ruby-progressbar@1.13.0.rbi +1318 -0
- data/sorbet/rbi/gems/securerandom@0.3.2.rbi +395 -0
- data/sorbet/rbi/gems/simplecov-html@0.13.1.rbi +225 -0
- data/sorbet/rbi/gems/simplecov@0.22.0.rbi +2149 -0
- data/sorbet/rbi/gems/simplecov_json_formatter@0.1.4.rbi +9 -0
- data/sorbet/rbi/gems/spoom@1.5.0.rbi +4932 -0
- data/sorbet/rbi/gems/standard-custom@1.0.2.rbi +9 -0
- data/sorbet/rbi/gems/standard-performance@1.4.0.rbi +9 -0
- data/sorbet/rbi/gems/standard@1.40.0.rbi +929 -0
- data/sorbet/rbi/gems/stringio@3.1.2.rbi +9 -0
- data/sorbet/rbi/gems/tapioca@0.16.4.rbi +3597 -0
- data/sorbet/rbi/gems/thor@1.3.2.rbi +4378 -0
- data/sorbet/rbi/gems/timeout@0.4.2.rbi +151 -0
- data/sorbet/rbi/gems/tzinfo@2.0.6.rbi +5918 -0
- data/sorbet/rbi/gems/unicode-display_width@2.6.0.rbi +66 -0
- data/sorbet/rbi/gems/uri@1.0.2.rbi +2377 -0
- data/sorbet/rbi/gems/useragent@0.16.10.rbi +9 -0
- data/sorbet/rbi/gems/websocket-driver@0.7.6.rbi +9 -0
- data/sorbet/rbi/gems/websocket-extensions@0.1.5.rbi +9 -0
- data/sorbet/rbi/gems/yard-sorbet@0.9.0.rbi +435 -0
- data/sorbet/rbi/gems/yard@0.9.37.rbi +18504 -0
- data/sorbet/rbi/gems/zeitwerk@2.7.1.rbi +9 -0
- data/sorbet/tapioca/config.yml +13 -0
- data/sorbet/tapioca/require.rb +12 -0
- metadata +543 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# syntax=docker/dockerfile:1
|
|
2
|
+
# check=error=true
|
|
3
|
+
|
|
4
|
+
# This Dockerfile is designed for production, not development. Use with Kamal or build'n'run by hand:
|
|
5
|
+
# docker build -t provider .
|
|
6
|
+
# docker run -d -p 80:80 -e RAILS_MASTER_KEY=<value from config/master.key> --name provider provider
|
|
7
|
+
|
|
8
|
+
# For a containerized dev environment, see Dev Containers: https://guides.rubyonrails.org/getting_started_with_devcontainer.html
|
|
9
|
+
|
|
10
|
+
# Make sure RUBY_VERSION matches the Ruby version in .ruby-version
|
|
11
|
+
ARG RUBY_VERSION=3.2.2
|
|
12
|
+
FROM docker.io/library/ruby:$RUBY_VERSION-slim AS base
|
|
13
|
+
|
|
14
|
+
# Rails app lives here
|
|
15
|
+
WORKDIR /rails
|
|
16
|
+
|
|
17
|
+
# Install base packages
|
|
18
|
+
RUN apt-get update -qq && \
|
|
19
|
+
apt-get install --no-install-recommends -y curl libjemalloc2 sqlite3 && \
|
|
20
|
+
rm -rf /var/lib/apt/lists /var/cache/apt/archives
|
|
21
|
+
|
|
22
|
+
# Set production environment
|
|
23
|
+
ENV RAILS_ENV="production" \
|
|
24
|
+
BUNDLE_DEPLOYMENT="1" \
|
|
25
|
+
BUNDLE_PATH="/usr/local/bundle" \
|
|
26
|
+
BUNDLE_WITHOUT="development"
|
|
27
|
+
|
|
28
|
+
# Throw-away build stage to reduce size of final image
|
|
29
|
+
FROM base AS build
|
|
30
|
+
|
|
31
|
+
# Install packages needed to build gems
|
|
32
|
+
RUN apt-get update -qq && \
|
|
33
|
+
apt-get install --no-install-recommends -y build-essential git pkg-config && \
|
|
34
|
+
rm -rf /var/lib/apt/lists /var/cache/apt/archives
|
|
35
|
+
|
|
36
|
+
# Install application gems
|
|
37
|
+
COPY Gemfile Gemfile.lock ./
|
|
38
|
+
RUN bundle install && \
|
|
39
|
+
rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git
|
|
40
|
+
|
|
41
|
+
# Copy application code
|
|
42
|
+
COPY . .
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
# Final stage for app image
|
|
48
|
+
FROM base
|
|
49
|
+
|
|
50
|
+
# Copy built artifacts: gems, application
|
|
51
|
+
COPY --from=build "${BUNDLE_PATH}" "${BUNDLE_PATH}"
|
|
52
|
+
COPY --from=build /rails /rails
|
|
53
|
+
|
|
54
|
+
# Run and own only the runtime files as a non-root user for security
|
|
55
|
+
RUN groupadd --system --gid 1000 rails && \
|
|
56
|
+
useradd rails --uid 1000 --gid 1000 --create-home --shell /bin/bash && \
|
|
57
|
+
chown -R rails:rails db log storage tmp
|
|
58
|
+
USER 1000:1000
|
|
59
|
+
|
|
60
|
+
# Entrypoint prepares the database.
|
|
61
|
+
ENTRYPOINT ["/rails/bin/docker-entrypoint"]
|
|
62
|
+
|
|
63
|
+
# Start server via Thruster by default, this can be overwritten at runtime
|
|
64
|
+
EXPOSE 80
|
|
65
|
+
CMD ["./bin/thrust", "./bin/rails", "server"]
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
source "https://rubygems.org"
|
|
2
|
+
|
|
3
|
+
gem "rails", "~> 8.0.0"
|
|
4
|
+
gem "sqlite3", ">= 2.1"
|
|
5
|
+
gem "puma", ">= 5.0"
|
|
6
|
+
gem "tzinfo-data", platforms: %i[ windows jruby ]
|
|
7
|
+
gem "solid_cache"
|
|
8
|
+
gem "solid_queue"
|
|
9
|
+
gem "kamal", require: false
|
|
10
|
+
gem "thruster", require: false
|
|
11
|
+
|
|
12
|
+
group :development, :test do
|
|
13
|
+
gem "pry-byebug", "~> 3.10", ">= 3.10.1"
|
|
14
|
+
end
|
|
File without changes
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
class PeopleController < ApplicationController
|
|
2
|
+
include ActionController::HttpAuthentication::Basic::ControllerMethods
|
|
3
|
+
http_basic_authenticate_with name: "admin", password: "secret"
|
|
4
|
+
|
|
5
|
+
# Index expects a response with a 200 status code
|
|
6
|
+
# @see https://github.com/rails/activeresource#find
|
|
7
|
+
def index
|
|
8
|
+
persons = Person.includes(:addresses, :company)
|
|
9
|
+
render json: persons.as_json(include: { addresses: {}, company: {} })
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
# Show expects a single JSON object with a 200 status code
|
|
13
|
+
# If the record is not found, expects a 404 status code
|
|
14
|
+
# @see https://github.com/rails/activeresource#find
|
|
15
|
+
def show
|
|
16
|
+
person = Person.includes(:addresses, :company).find_by(id: params[:id])
|
|
17
|
+
if person
|
|
18
|
+
render json: person.as_json(include: { addresses: {}, company: {} })
|
|
19
|
+
else
|
|
20
|
+
head :not_found
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# Create expects an empty response with 201 status and a Location header
|
|
25
|
+
# @see https://github.com/rails/activeresource#update
|
|
26
|
+
def create
|
|
27
|
+
binding.pry
|
|
28
|
+
person = Person.new(person_params)
|
|
29
|
+
if person.save
|
|
30
|
+
head :created, location: person_url(person)
|
|
31
|
+
else
|
|
32
|
+
render json: person.errors, status: :unprocessable_entity
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# Update expects an empty response with a 204 status code
|
|
37
|
+
# @see https://github.com/rails/activeresource#update
|
|
38
|
+
def update
|
|
39
|
+
person = Person.find_by(id: params[:id])
|
|
40
|
+
if person&.update(person_params)
|
|
41
|
+
head :no_content
|
|
42
|
+
else
|
|
43
|
+
render json: person&.errors || { error: 'Person not found' }, status: :unprocessable_entity
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# Destroy expects an empty response with a 200 status code
|
|
48
|
+
# @see https://github.com/rails/activeresource#delete
|
|
49
|
+
def destroy
|
|
50
|
+
person = Person.find_by(id: params[:id])
|
|
51
|
+
if person&.destroy
|
|
52
|
+
head :ok
|
|
53
|
+
else
|
|
54
|
+
render json: person&.errors || { error: 'Person not found' }, status: :unprocessable_entity
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
private
|
|
59
|
+
|
|
60
|
+
# Strong parameters for Person
|
|
61
|
+
def person_params
|
|
62
|
+
params.require(:person).permit(
|
|
63
|
+
:first_name, :last_name, :age,
|
|
64
|
+
addresses_attributes: [:id, :street, :city, :state, :zip, :_destroy],
|
|
65
|
+
company_attributes: [:id, :name, :street, :city, :state, :zip, :_destroy]
|
|
66
|
+
)
|
|
67
|
+
end
|
|
68
|
+
end
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
class ApplicationJob < ActiveJob::Base
|
|
2
|
+
# Automatically retry jobs that encountered a deadlock
|
|
3
|
+
# retry_on ActiveRecord::Deadlocked
|
|
4
|
+
|
|
5
|
+
# Most jobs are safe to ignore if the underlying records are no longer available
|
|
6
|
+
# discard_on ActiveJob::DeserializationError
|
|
7
|
+
end
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= yield %>
|
|
@@ -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,44 @@
|
|
|
1
|
+
require_relative "boot"
|
|
2
|
+
|
|
3
|
+
require "rails"
|
|
4
|
+
# Pick the frameworks you want:
|
|
5
|
+
require "active_model/railtie"
|
|
6
|
+
require "active_job/railtie"
|
|
7
|
+
require "active_record/railtie"
|
|
8
|
+
# require "active_storage/engine"
|
|
9
|
+
require "action_controller/railtie"
|
|
10
|
+
require "action_mailer/railtie"
|
|
11
|
+
# require "action_mailbox/engine"
|
|
12
|
+
# require "action_text/engine"
|
|
13
|
+
require "action_view/railtie"
|
|
14
|
+
# require "action_cable/engine"
|
|
15
|
+
# require "rails/test_unit/railtie"
|
|
16
|
+
|
|
17
|
+
# Require the gems listed in Gemfile, including any gems
|
|
18
|
+
# you've limited to :test, :development, or :production.
|
|
19
|
+
Bundler.require(*Rails.groups)
|
|
20
|
+
|
|
21
|
+
module Provider
|
|
22
|
+
class Application < Rails::Application
|
|
23
|
+
# Initialize configuration defaults for originally generated Rails version.
|
|
24
|
+
config.load_defaults 8.0
|
|
25
|
+
|
|
26
|
+
# Please, add to the `ignore` list any other `lib` subdirectories that do
|
|
27
|
+
# not contain `.rb` files, or that should not be reloaded or eager loaded.
|
|
28
|
+
# Common ones are `templates`, `generators`, or `middleware`, for example.
|
|
29
|
+
config.autoload_lib(ignore: %w[assets tasks])
|
|
30
|
+
|
|
31
|
+
# Configuration for the application, engines, and railties goes here.
|
|
32
|
+
#
|
|
33
|
+
# These settings can be overridden in specific environments using the files
|
|
34
|
+
# in config/environments, which are processed later.
|
|
35
|
+
#
|
|
36
|
+
# config.time_zone = "Central Time (US & Canada)"
|
|
37
|
+
# config.eager_load_paths << Rails.root.join("extras")
|
|
38
|
+
|
|
39
|
+
# Only loads a smaller set of middleware suitable for API only apps.
|
|
40
|
+
# Middleware like session, flash, cookies can be added back manually.
|
|
41
|
+
# Skip views, helpers and assets when generating a new resource.
|
|
42
|
+
config.api_only = true
|
|
43
|
+
end
|
|
44
|
+
end
|
|
@@ -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
|
+
oLf/r/U+4Xw/JBFp8Z985fyzuzpHSmoLclxhjnOu/qCZTH01VcdOSt2YJKyhADvjlMjrhkK/InDPs5AtY3KdGH4xe8WY06m1a6iclC4OPaoKgiNKeGB9XK+G4yec8SBIGE9VHWu6Thb3IT0HFnxVSncoZqgtbOd5kek3w6HQ1nE2hsqNALlt6349SfyIXDTB+7wum8uvkA9cy+YwZat/jTlXxY86mvTYmam4XB6GbeLX2464ZaQv2W+3B08nubVWtKqh+z9ZNTvUQPfy+6iycZVJDDIJVNLNViiuHwFNisUNJrwCr7rUKN+p72c/sWR5rzcSqAfFxhs7HfY90Y0yae6rD6XwT00yrxIz0o9Pz70aZqWpc6/ot5imdEAgOU3ctjPnl5WGV4/oXcfJr7L4Ofg3PaVOoI79klwKEzt4Y0g9i7ualSUIxIRtu6xwdZlhTj69ffEFrb9AGCTuFCNFzIcN45jLduEUxW42O5RD4yJySNLqH4U5R7P4--STxlRDIaEzWJamko--OR6vwoRNehHeH1+fFTHTpQ==
|
|
@@ -0,0 +1,20 @@
|
|
|
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
|
+
database: storage/db.sqlite3
|
|
12
|
+
|
|
13
|
+
development:
|
|
14
|
+
<<: *default
|
|
15
|
+
|
|
16
|
+
test:
|
|
17
|
+
<<: *default
|
|
18
|
+
|
|
19
|
+
production:
|
|
20
|
+
<<: *default
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# Name of your application. Used to uniquely configure containers.
|
|
2
|
+
service: provider
|
|
3
|
+
|
|
4
|
+
# Name of the container image.
|
|
5
|
+
image: your-user/provider
|
|
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 provider-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
|
+
- "provider_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: ruby-3.2.2
|
|
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
|