sidekiq-unique-jobs 5.0.2 → 5.0.4

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of sidekiq-unique-jobs might be problematic. Click here for more details.

Files changed (201) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +4 -1
  3. data/Appraisals +1 -1
  4. data/CHANGELOG.md +9 -0
  5. data/CODE_OF_CONDUCT.md +74 -0
  6. data/Gemfile +1 -1
  7. data/LICENSE.txt +21 -0
  8. data/bin/bench +1 -1
  9. data/lib/sidekiq-unique-jobs.rb +3 -1
  10. data/lib/sidekiq/simulator.rb +4 -10
  11. data/lib/sidekiq_unique_jobs/cli.rb +2 -0
  12. data/lib/sidekiq_unique_jobs/client/middleware.rb +2 -0
  13. data/lib/sidekiq_unique_jobs/config.rb +2 -0
  14. data/lib/sidekiq_unique_jobs/constants.rb +19 -17
  15. data/lib/sidekiq_unique_jobs/core_ext.rb +2 -0
  16. data/lib/sidekiq_unique_jobs/lock.rb +2 -0
  17. data/lib/sidekiq_unique_jobs/lock/until_and_while_executing.rb +2 -0
  18. data/lib/sidekiq_unique_jobs/lock/until_executed.rb +3 -1
  19. data/lib/sidekiq_unique_jobs/lock/until_executing.rb +2 -0
  20. data/lib/sidekiq_unique_jobs/lock/until_timeout.rb +2 -0
  21. data/lib/sidekiq_unique_jobs/lock/while_executing.rb +2 -0
  22. data/lib/sidekiq_unique_jobs/middleware.rb +2 -0
  23. data/lib/sidekiq_unique_jobs/normalizer.rb +2 -0
  24. data/lib/sidekiq_unique_jobs/options_with_fallback.rb +2 -0
  25. data/lib/sidekiq_unique_jobs/run_lock_failed.rb +2 -0
  26. data/lib/sidekiq_unique_jobs/script_mock.rb +2 -0
  27. data/lib/sidekiq_unique_jobs/scripts.rb +15 -10
  28. data/lib/sidekiq_unique_jobs/scripts/acquire_lock.rb +2 -0
  29. data/lib/sidekiq_unique_jobs/scripts/release_lock.rb +2 -0
  30. data/lib/sidekiq_unique_jobs/server/middleware.rb +2 -0
  31. data/lib/sidekiq_unique_jobs/sidekiq_unique_ext.rb +2 -0
  32. data/lib/sidekiq_unique_jobs/testing.rb +2 -0
  33. data/lib/sidekiq_unique_jobs/testing/sidekiq_overrides.rb +2 -0
  34. data/lib/sidekiq_unique_jobs/timeout_calculator.rb +2 -0
  35. data/lib/sidekiq_unique_jobs/unique_args.rb +3 -1
  36. data/lib/sidekiq_unique_jobs/unlockable.rb +2 -0
  37. data/lib/sidekiq_unique_jobs/util.rb +5 -3
  38. data/lib/sidekiq_unique_jobs/version.rb +3 -1
  39. data/sidekiq-unique-jobs.gemspec +27 -23
  40. metadata +44 -200
  41. data/LICENSE +0 -13
  42. data/circle.yml +0 -41
  43. data/gemfiles/sidekiq_4.0.gemfile +0 -22
  44. data/gemfiles/sidekiq_4.1.gemfile +0 -22
  45. data/gemfiles/sidekiq_4.2.gemfile +0 -22
  46. data/gemfiles/sidekiq_5.0.gemfile +0 -22
  47. data/gemfiles/sidekiq_develop.gemfile +0 -22
  48. data/rails_example/.env +0 -12
  49. data/rails_example/.env.test +0 -12
  50. data/rails_example/.gitignore +0 -13
  51. data/rails_example/.rspec +0 -2
  52. data/rails_example/Gemfile +0 -38
  53. data/rails_example/Procfile +0 -2
  54. data/rails_example/README.rdoc +0 -28
  55. data/rails_example/Rakefile +0 -6
  56. data/rails_example/app/assets/images/.keep +0 -0
  57. data/rails_example/app/assets/javascripts/application.js +0 -16
  58. data/rails_example/app/assets/stylesheets/application.css +0 -15
  59. data/rails_example/app/channels/appearance_channel.rb +0 -17
  60. data/rails_example/app/channels/application_cable/channel.rb +0 -4
  61. data/rails_example/app/channels/application_cable/connection.rb +0 -9
  62. data/rails_example/app/channels/post_channel.rb +0 -5
  63. data/rails_example/app/controllers/application_controller.rb +0 -5
  64. data/rails_example/app/controllers/concerns/.keep +0 -0
  65. data/rails_example/app/controllers/work_controller.rb +0 -39
  66. data/rails_example/app/helpers/application_helper.rb +0 -2
  67. data/rails_example/app/mailers/.keep +0 -0
  68. data/rails_example/app/models/.keep +0 -0
  69. data/rails_example/app/models/application_record.rb +0 -3
  70. data/rails_example/app/models/concerns/.keep +0 -0
  71. data/rails_example/app/models/guest.rb +0 -18
  72. data/rails_example/app/models/post.rb +0 -2
  73. data/rails_example/app/views/layouts/application.html.erb +0 -15
  74. data/rails_example/app/workers/simple_worker.rb +0 -15
  75. data/rails_example/app/workers/slow_until_executing_worker.rb +0 -15
  76. data/rails_example/app/workers/spawn_simple_worker.rb +0 -10
  77. data/rails_example/app/workers/while_executing_worker.rb +0 -12
  78. data/rails_example/app/workers/without_args_worker.rb +0 -16
  79. data/rails_example/app/workers/without_argument_worker.rb +0 -12
  80. data/rails_example/bin/bundle +0 -3
  81. data/rails_example/bin/check_or_setup_db +0 -56
  82. data/rails_example/bin/docker-setup +0 -20
  83. data/rails_example/bin/rails +0 -4
  84. data/rails_example/bin/rake +0 -4
  85. data/rails_example/bin/setup +0 -34
  86. data/rails_example/bin/update +0 -29
  87. data/rails_example/cable.ru +0 -6
  88. data/rails_example/common-services.yml +0 -52
  89. data/rails_example/config.ru +0 -4
  90. data/rails_example/config/application.rb +0 -27
  91. data/rails_example/config/boot.rb +0 -3
  92. data/rails_example/config/cable.yml +0 -9
  93. data/rails_example/config/database.docker.yml +0 -12
  94. data/rails_example/config/database.yml +0 -19
  95. data/rails_example/config/environment.rb +0 -5
  96. data/rails_example/config/environments/development.rb +0 -54
  97. data/rails_example/config/environments/production.rb +0 -86
  98. data/rails_example/config/environments/test.rb +0 -42
  99. data/rails_example/config/initializers/application_controller_renderer.rb +0 -6
  100. data/rails_example/config/initializers/assets.rb +0 -11
  101. data/rails_example/config/initializers/backtrace_silencers.rb +0 -9
  102. data/rails_example/config/initializers/cookies_serializer.rb +0 -5
  103. data/rails_example/config/initializers/filter_parameter_logging.rb +0 -4
  104. data/rails_example/config/initializers/inflections.rb +0 -16
  105. data/rails_example/config/initializers/mime_types.rb +0 -4
  106. data/rails_example/config/initializers/new_framework_defaults.rb +0 -23
  107. data/rails_example/config/initializers/session_store.rb +0 -3
  108. data/rails_example/config/initializers/sidekiq.rb +0 -13
  109. data/rails_example/config/initializers/wrap_parameters.rb +0 -14
  110. data/rails_example/config/locales/en.yml +0 -23
  111. data/rails_example/config/puma.rb +0 -38
  112. data/rails_example/config/routes.rb +0 -8
  113. data/rails_example/config/secrets.yml +0 -22
  114. data/rails_example/config/sidekiq.yml +0 -6
  115. data/rails_example/config/spring.rb +0 -6
  116. data/rails_example/db/migrate/20160724111322_create_posts.rb +0 -12
  117. data/rails_example/db/schema.rb +0 -25
  118. data/rails_example/db/seeds.rb +0 -7
  119. data/rails_example/dev-entrypoint.sh +0 -55
  120. data/rails_example/dev.env +0 -12
  121. data/rails_example/docker-compose.yml +0 -71
  122. data/rails_example/docker/rails.Dockerfile +0 -27
  123. data/rails_example/lib/assets/.keep +0 -0
  124. data/rails_example/lib/tasks/.keep +0 -0
  125. data/rails_example/log/.keep +0 -0
  126. data/rails_example/public/404.html +0 -67
  127. data/rails_example/public/422.html +0 -67
  128. data/rails_example/public/500.html +0 -66
  129. data/rails_example/public/favicon.ico +0 -0
  130. data/rails_example/public/robots.txt +0 -5
  131. data/rails_example/simple.ru +0 -12
  132. data/rails_example/spec/controllers/work_controller_mock_spec.rb +0 -91
  133. data/rails_example/spec/controllers/work_controller_spec.rb +0 -77
  134. data/rails_example/spec/factories/posts.rb +0 -8
  135. data/rails_example/spec/models/post_spec.rb +0 -4
  136. data/rails_example/spec/rails_helper.rb +0 -20
  137. data/rails_example/spec/spec_helper.rb +0 -20
  138. data/rails_example/spec/support/sidekiq_meta.rb +0 -12
  139. data/rails_example/spec/workers/simple_worker_spec.rb +0 -4
  140. data/rails_example/vendor/assets/javascripts/.keep +0 -0
  141. data/rails_example/vendor/assets/stylesheets/.keep +0 -0
  142. data/spec/jobs/another_unique_job.rb +0 -13
  143. data/spec/jobs/custom_queue_job.rb +0 -5
  144. data/spec/jobs/custom_queue_job_with_filter_method.rb +0 -7
  145. data/spec/jobs/custom_queue_job_with_filter_proc.rb +0 -10
  146. data/spec/jobs/expiring_job.rb +0 -4
  147. data/spec/jobs/inline_worker.rb +0 -8
  148. data/spec/jobs/just_a_worker.rb +0 -7
  149. data/spec/jobs/long_running_job.rb +0 -6
  150. data/spec/jobs/main_job.rb +0 -7
  151. data/spec/jobs/my_job.rb +0 -12
  152. data/spec/jobs/my_unique_job.rb +0 -11
  153. data/spec/jobs/my_unique_job_with_filter_method.rb +0 -17
  154. data/spec/jobs/my_unique_job_with_filter_proc.rb +0 -15
  155. data/spec/jobs/notify_worker.rb +0 -10
  156. data/spec/jobs/plain_class.rb +0 -3
  157. data/spec/jobs/simple_worker.rb +0 -11
  158. data/spec/jobs/spawn_simple_worker.rb +0 -8
  159. data/spec/jobs/test_class.rb +0 -3
  160. data/spec/jobs/unique_job_with_conditional_parameter.rb +0 -14
  161. data/spec/jobs/unique_job_with_filter_method.rb +0 -18
  162. data/spec/jobs/unique_job_with_nil_unique_args.rb +0 -16
  163. data/spec/jobs/unique_job_with_no_unique_args_method.rb +0 -12
  164. data/spec/jobs/unique_job_withthout_unique_args_parameter.rb +0 -14
  165. data/spec/jobs/unique_on_all_queues_job.rb +0 -13
  166. data/spec/jobs/until_and_while_executing_job.rb +0 -7
  167. data/spec/jobs/until_executed_job.rb +0 -17
  168. data/spec/jobs/until_executing_job.rb +0 -7
  169. data/spec/jobs/until_global_timeout_job.rb +0 -8
  170. data/spec/jobs/until_timeout_job.rb +0 -8
  171. data/spec/jobs/while_executing_job.rb +0 -12
  172. data/spec/jobs/without_argument_job.rb +0 -9
  173. data/spec/lib/sidekiq_unique_jobs/cli_spec.rb +0 -183
  174. data/spec/lib/sidekiq_unique_jobs/client/middleware_spec.rb +0 -316
  175. data/spec/lib/sidekiq_unique_jobs/config_spec.rb +0 -84
  176. data/spec/lib/sidekiq_unique_jobs/core_ext_spec.rb +0 -25
  177. data/spec/lib/sidekiq_unique_jobs/lock/until_and_while_executing_spec.rb +0 -42
  178. data/spec/lib/sidekiq_unique_jobs/lock/until_executed_spec.rb +0 -37
  179. data/spec/lib/sidekiq_unique_jobs/lock/until_timeout_spec.rb +0 -26
  180. data/spec/lib/sidekiq_unique_jobs/lock/while_executing_spec.rb +0 -86
  181. data/spec/lib/sidekiq_unique_jobs/normalizer_spec.rb +0 -21
  182. data/spec/lib/sidekiq_unique_jobs/options_with_fallback_spec.rb +0 -113
  183. data/spec/lib/sidekiq_unique_jobs/queue_lock_timeout_calculator_spec.rb +0 -47
  184. data/spec/lib/sidekiq_unique_jobs/run_lock_timeout_calculator_spec.rb +0 -36
  185. data/spec/lib/sidekiq_unique_jobs/script_mock_spec.rb +0 -88
  186. data/spec/lib/sidekiq_unique_jobs/scripts/acquire_lock_spec.rb +0 -50
  187. data/spec/lib/sidekiq_unique_jobs/scripts/release_lock_spec.rb +0 -41
  188. data/spec/lib/sidekiq_unique_jobs/scripts_spec.rb +0 -68
  189. data/spec/lib/sidekiq_unique_jobs/server/middleware_spec.rb +0 -78
  190. data/spec/lib/sidekiq_unique_jobs/sidekiq_testing_enabled_spec.rb +0 -164
  191. data/spec/lib/sidekiq_unique_jobs/sidekiq_unique_ext_spec.rb +0 -75
  192. data/spec/lib/sidekiq_unique_jobs/sidekiq_unique_jobs_spec.rb +0 -41
  193. data/spec/lib/sidekiq_unique_jobs/timeout_calculator_spec.rb +0 -70
  194. data/spec/lib/sidekiq_unique_jobs/unique_args_spec.rb +0 -257
  195. data/spec/lib/sidekiq_unique_jobs/unlockable_spec.rb +0 -37
  196. data/spec/lib/sidekiq_unique_jobs/util_spec.rb +0 -81
  197. data/spec/spec_helper.rb +0 -92
  198. data/spec/support/matchers/redis_matchers.rb +0 -29
  199. data/spec/support/ruby_meta.rb +0 -17
  200. data/spec/support/sidekiq_meta.rb +0 -30
  201. data/spec/support/unique_macros.rb +0 -71
File without changes
@@ -1,3 +0,0 @@
1
- class ApplicationRecord < ActiveRecord::Base
2
- self.abstract_class = true
3
- end
File without changes
@@ -1,18 +0,0 @@
1
- class Guest
2
- GUEST_NAME = 'Guest Visitor'.freeze
3
- GUEST_EMAIL = 'unknown@domain.com'.freeze
4
-
5
- def name
6
- GUEST_NAME
7
- end
8
-
9
- def email
10
- GUEST_EMAIL
11
- end
12
-
13
- def appear; end
14
-
15
- def disappear; end
16
-
17
- def away; end
18
- end
@@ -1,2 +0,0 @@
1
- class Post < ApplicationRecord
2
- end
@@ -1,15 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>RailsExample</title>
5
- <%= stylesheet_link_tag 'application', media: 'all' %>
6
- <%= javascript_include_tag 'application' %>
7
- <%= csrf_meta_tags %>
8
- </head>
9
- <body>
10
- <%= link_to 'Duplicate', duplicate_work_path %>
11
-
12
- <%= yield %>
13
-
14
- </body>
15
- </html>
@@ -1,15 +0,0 @@
1
- class SimpleWorker
2
- include Sidekiq::Worker
3
- sidekiq_options unique: :until_executed,
4
- queue: :default,
5
- unique_args: (lambda do |args|
6
- [args.first]
7
- end)
8
-
9
- def perform(some_args)
10
- Sidekiq::Logging.with_context(self.class.name) do
11
- SidekiqUniqueJobs.logger.debug { "#{__method__}(#{some_args})" }
12
- end
13
- sleep 1
14
- end
15
- end
@@ -1,15 +0,0 @@
1
- class SlowUntilExecutingWorker
2
- include Sidekiq::Worker
3
- sidekiq_options unique: :until_executing,
4
- queue: :default,
5
- unique_args: (lambda do |args|
6
- [args.first]
7
- end)
8
-
9
- def perform(some_args)
10
- Sidekiq::Logging.with_context(self.class.name) do
11
- SidekiqUniqueJobs.logger.debug { "#{__method__}(#{some_args})" }
12
- end
13
- sleep 15
14
- end
15
- end
@@ -1,10 +0,0 @@
1
- class SpawnSimpleWorker
2
- include Sidekiq::Worker
3
-
4
- def perform(spawn_arg)
5
- Sidekiq::Logging.with_context(self.class.name) do
6
- logger.debug { "#{__method__}(#{spawn_arg})" }
7
- end
8
- SimpleWorker.perform_async spawn_arg
9
- end
10
- end
@@ -1,12 +0,0 @@
1
- class WhileExecutingWorker
2
- include Sidekiq::Worker
3
-
4
- sidekiq_options unique: :while_executing
5
-
6
- def perform(_one, _two)
7
- Sidekiq::Logging.with_context(self.class.name) do
8
- logger.debug { "#{__method__}(#{some_args})" }
9
- end
10
- sleep 10
11
- end
12
- end
@@ -1,16 +0,0 @@
1
- class WithoutArgsWorker
2
- include Sidekiq::Worker
3
- sidekiq_options queue: :default,
4
- retry: true,
5
- backtrace: true,
6
- unique: :until_executed,
7
- unique_args: :custom_args
8
-
9
- def perform(_conditional = nil)
10
- sleep 2
11
- end
12
-
13
- def self.custom_args
14
- puts 'testing'
15
- end
16
- end
@@ -1,12 +0,0 @@
1
- class WithoutArgumentWorker
2
- include Sidekiq::Worker
3
- sidekiq_options unique: :until_executed,
4
- log_duplicate_payload: true
5
-
6
- def perform
7
- Sidekiq::Logging.with_context(self.class.name) do
8
- logger.debug { __method__.to_s }
9
- end
10
- sleep 20
11
- end
12
- end
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env ruby
2
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
- load Gem.bin_path('bundler', 'bundle')
@@ -1,56 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- # This script is used in the development environment with Docker to check if the
4
- # app database exists, and runs the database setup if it doesn't, as it is the
5
- # case when the project runs for the first time on the development machine.
6
- #
7
- # We are using this custom script instead of running the
8
- # `rake db:version || rake db:setup` commands, as that currently leaves a
9
- # couple of small ruby zombie processes running in the app container:
10
- require 'rubygems'
11
- require 'rake'
12
- require 'bundler'
13
-
14
- Bundler.setup(:default)
15
-
16
- require 'active_record'
17
- require 'pg'
18
-
19
- exit begin
20
- connection_tries ||= 3
21
- ActiveRecord::Base.establish_connection && ActiveRecord::Migrator.current_version
22
- 0
23
- rescue PG::ConnectionBad
24
- unless (connection_tries -= 1).zero?
25
- puts "Retrying DB connection #{connection_tries} more times..."
26
- sleep ENV.fetch('APP_SETUP_WAIT', '5').to_i
27
- retry
28
- end
29
- 1
30
- rescue ActiveRecord::NoDatabaseError, ActiveRecord::AdapterNotSpecified
31
- include ActiveRecord::Tasks
32
-
33
- DatabaseTasks.root = File.expand_path '../..', __FILE__
34
- DatabaseTasks.db_dir = File.join DatabaseTasks.root, 'db'
35
- DatabaseTasks.env = ENV.fetch 'ENV', ENV.fetch('RAILS_ENV', 'development')
36
-
37
- # The App database seeder:
38
- DatabaseTasks.seed_loader = (Class.new do
39
- def load_seed
40
- seed_file_path = File.join DatabaseTasks.db_dir, 'seeds.rb'
41
- raise "Seed file '#{seed_file_path}' does not exist" unless File.file?(seed_file_path)
42
- load seed_file_path
43
- end
44
- end).new
45
-
46
- # Add model dirs to the autoload_paths for the seeder to run smoothly:
47
- ActiveSupport::Dependencies.autoload_paths << File.join(DatabaseTasks.root, 'app', 'models', 'concerns')
48
- ActiveSupport::Dependencies.autoload_paths << File.join(DatabaseTasks.root, 'app', 'models')
49
-
50
- return 2 unless DatabaseTasks.create_current
51
- return 3 unless DatabaseTasks.load_schema_current
52
- return 4 unless DatabaseTasks.load_seed
53
- 0
54
- ensure
55
- ActiveRecord::Base.clear_all_connections!
56
- end
@@ -1,20 +0,0 @@
1
- #!/bin/bash
2
-
3
- set -e
4
-
5
- # ln -s ../ gems/sidekiq-unique-jobs
6
- cp -f config/database.docker.yml config/database.yml
7
- # cp -f config/application.docker.yml config/application.yml
8
-
9
- # build app image
10
- docker-compose build
11
-
12
- # start mysql and redis in background
13
- docker-compose start postgres
14
- docker-compose start redis
15
-
16
- # setup database
17
- docker-compose run web rake db:create db:migrate
18
-
19
- # ensure all containers are up and running
20
- docker-compose up
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env ruby
2
- APP_PATH = File.expand_path('../config/application', __dir__)
3
- require_relative '../config/boot'
4
- require 'rails/commands'
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require_relative '../config/boot'
3
- require 'rake'
4
- Rake.application.run
@@ -1,34 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require 'pathname'
3
- require 'fileutils'
4
- include FileUtils
5
-
6
- # path to your application root.
7
- APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
8
-
9
- def system!(*args)
10
- system(*args) || abort("\n== Command #{args} failed ==")
11
- end
12
-
13
- chdir APP_ROOT do
14
- # This script is a starting point to setup your application.
15
- # Add necessary setup steps to this file.
16
-
17
- puts '== Installing dependencies =='
18
- system! 'gem install bundler --conservative'
19
- system('bundle check') || system!('bundle install')
20
-
21
- # puts "\n== Copying sample files =="
22
- # unless File.exist?('config/database.yml')
23
- # cp 'config/database.yml.sample', 'config/database.yml'
24
- # end
25
-
26
- puts "\n== Preparing database =="
27
- system! 'bin/rails db:setup'
28
-
29
- puts "\n== Removing old logs and tempfiles =="
30
- system! 'bin/rails log:clear tmp:clear'
31
-
32
- puts "\n== Restarting application server =="
33
- system! 'bin/rails restart'
34
- end
@@ -1,29 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require 'pathname'
3
- require 'fileutils'
4
- include FileUtils
5
-
6
- # path to your application root.
7
- APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
8
-
9
- def system!(*args)
10
- system(*args) || abort("\n== Command #{args} failed ==")
11
- end
12
-
13
- chdir APP_ROOT do
14
- # This script is a way to update your development environment automatically.
15
- # Add necessary update steps to this file.
16
-
17
- puts '== Installing dependencies =='
18
- system! 'gem install bundler --conservative'
19
- system('bundle check') || system!('bundle install')
20
-
21
- puts "\n== Updating database =="
22
- system! 'bin/rails db:migrate'
23
-
24
- puts "\n== Removing old logs and tempfiles =="
25
- system! 'bin/rails log:clear tmp:clear'
26
-
27
- puts "\n== Restarting application server =="
28
- system! 'bin/rails restart'
29
- end
@@ -1,6 +0,0 @@
1
- # This file is used by Rack-based servers to start the application.
2
-
3
- require ::File.expand_path('../config/environment', __FILE__)
4
- Rails.application.eager_load!
5
-
6
- run ActionCable.server
@@ -1,52 +0,0 @@
1
- version: '2'
2
- services:
3
- rails:
4
- image: ruby:2.3
5
- # build:
6
- # context: .
7
- # dockerfile: docker/rails.Dockerfile
8
- # We'll specify a dotenv file for docker-compose to load more environment
9
- # variables into our app containers. This dotenv file would normally contain
10
- # sensitive data (API keys & secrets, etc) which SHOULD NOT be committed into
11
- # Git.
12
- # Keep in mind that any changes in this file will require a container restart
13
- # in order to be available on the app containers:
14
- env_file:
15
- - dev.env
16
- # Specify environment variables available for our app containers. We'll leave
17
- # a YML anchor in case we need to override or add more variables if needed on
18
- # each app container:
19
- environment: &app_environment
20
- # We'll overwrite the PATH environment variable to include the 'bin/'
21
- # directory, for the entrypoint script to find the app's executables:
22
- PATH: /usr/src/app/bin:/usr/local/bundle/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
23
-
24
- # We'll set the REDIS_URL environment variable for the app to connect
25
- # to our redis container:
26
- REDIS_URL: redis://redis:6379
27
-
28
- DATABASE_URL: postgresql://postgres:3x4mpl3@postgres:5432/rails_example_dev
29
-
30
- # We'll set the RAILS_ENV and RACK_ENV environment variables to
31
- # 'development', so our app containers will start in 'development' mode
32
- # on this compose project:
33
- RAILS_ENV: development
34
- RACK_ENV: development
35
- cpu_shares: 4
36
- # Specify the directory from where all commands sent to the container will be
37
- # issued to where the code is mounted:
38
- working_dir: /usr/src/app
39
-
40
- # Keep the stdin open, so we can attach to our app container's process
41
- # and do things such as byebug, etc:
42
- stdin_open: true
43
-
44
- # Enable sending signals (CTRL+C, CTRL+P + CTRL+Q) into the container:
45
- tty: true
46
- volumes:
47
- # Mount our app code directory (".") into our app containers at the
48
- # "/usr/src/app" folder:
49
- - .:/usr/src/app
50
-
51
- # Mount the 'gems' volume on the folder that stores bundled gems:
52
- - gems:/usr/local/bundle
@@ -1,4 +0,0 @@
1
- # This file is used by Rack-based servers to start the application.
2
-
3
- require ::File.expand_path('../config/environment', __FILE__)
4
- run Rails.application
@@ -1,27 +0,0 @@
1
- require_relative 'boot'
2
-
3
- require 'bigdecimal'
4
- require 'bigdecimal/util'
5
- require 'rails/all'
6
-
7
- # Require the gems listed in Gemfile, including any gems
8
- # you've limited to :test, :development, or :production.
9
- Bundler.require(*Rails.groups)
10
-
11
- module RailsExample
12
- class Application < Rails::Application
13
- # Settings in config/environments/* take precedence over those specified here.
14
- # Application configuration should go into files in config/initializers
15
- # -- all .rb files in that directory are automatically loaded.
16
-
17
- # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
18
- # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
19
- config.time_zone = 'CET'
20
-
21
- # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
22
- # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
23
- # config.i18n.default_locale = :de
24
-
25
- # config.active_record.schema_format = :sql
26
- end
27
- end
@@ -1,3 +0,0 @@
1
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
2
-
3
- require 'bundler/setup' # Set up gems listed in the Gemfile.
@@ -1,9 +0,0 @@
1
- development:
2
- adapter: async
3
-
4
- test:
5
- adapter: async
6
-
7
- production:
8
- adapter: redis
9
- url: redis://localhost:6379/1
@@ -1,12 +0,0 @@
1
- development:
2
- adapter: postgresql
3
- database: rails_example_dev
4
- pool: 5
5
- timeout: 5000
6
-
7
- test:
8
- adapter: postgresql
9
- database: rails_example_test
10
- pool: 5
11
- timeout: 5000
12
-
@@ -1,19 +0,0 @@
1
- defaults: &defaults
2
- encoding: unicode
3
- adapter: postgresql
4
- host: <%= ENV.fetch('DB_HOST') { 'localhost' } %>
5
- port: <%= ENV.fetch('DB_PORT') { 5432 } %>
6
- username: <%= ENV.fetch('DB_USERNAME') { 'mhenrixon' } %>
7
- password: <%= ENV.fetch('DB_PASSWORD') { nil } %>
8
- pool: <%= ENV.fetch('DB_POOL') { 25 } %>
9
- timeout: <%= ENV.fetch('DB_TIMEOUT') { 5000 } %>
10
- reaping_frequency: <%= ENV.fetch('DB_REAPING_FREQUENCY') { 5000 } %>
11
-
12
- development:
13
- <<: *defaults
14
- database: rails_example_dev
15
-
16
- test:
17
- <<: *defaults
18
- database: rails_example_test
19
-