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.
- checksums.yaml +4 -4
- data/.rubocop.yml +4 -1
- data/Appraisals +1 -1
- data/CHANGELOG.md +9 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +1 -1
- data/LICENSE.txt +21 -0
- data/bin/bench +1 -1
- data/lib/sidekiq-unique-jobs.rb +3 -1
- data/lib/sidekiq/simulator.rb +4 -10
- data/lib/sidekiq_unique_jobs/cli.rb +2 -0
- data/lib/sidekiq_unique_jobs/client/middleware.rb +2 -0
- data/lib/sidekiq_unique_jobs/config.rb +2 -0
- data/lib/sidekiq_unique_jobs/constants.rb +19 -17
- data/lib/sidekiq_unique_jobs/core_ext.rb +2 -0
- data/lib/sidekiq_unique_jobs/lock.rb +2 -0
- data/lib/sidekiq_unique_jobs/lock/until_and_while_executing.rb +2 -0
- data/lib/sidekiq_unique_jobs/lock/until_executed.rb +3 -1
- data/lib/sidekiq_unique_jobs/lock/until_executing.rb +2 -0
- data/lib/sidekiq_unique_jobs/lock/until_timeout.rb +2 -0
- data/lib/sidekiq_unique_jobs/lock/while_executing.rb +2 -0
- data/lib/sidekiq_unique_jobs/middleware.rb +2 -0
- data/lib/sidekiq_unique_jobs/normalizer.rb +2 -0
- data/lib/sidekiq_unique_jobs/options_with_fallback.rb +2 -0
- data/lib/sidekiq_unique_jobs/run_lock_failed.rb +2 -0
- data/lib/sidekiq_unique_jobs/script_mock.rb +2 -0
- data/lib/sidekiq_unique_jobs/scripts.rb +15 -10
- data/lib/sidekiq_unique_jobs/scripts/acquire_lock.rb +2 -0
- data/lib/sidekiq_unique_jobs/scripts/release_lock.rb +2 -0
- data/lib/sidekiq_unique_jobs/server/middleware.rb +2 -0
- data/lib/sidekiq_unique_jobs/sidekiq_unique_ext.rb +2 -0
- data/lib/sidekiq_unique_jobs/testing.rb +2 -0
- data/lib/sidekiq_unique_jobs/testing/sidekiq_overrides.rb +2 -0
- data/lib/sidekiq_unique_jobs/timeout_calculator.rb +2 -0
- data/lib/sidekiq_unique_jobs/unique_args.rb +3 -1
- data/lib/sidekiq_unique_jobs/unlockable.rb +2 -0
- data/lib/sidekiq_unique_jobs/util.rb +5 -3
- data/lib/sidekiq_unique_jobs/version.rb +3 -1
- data/sidekiq-unique-jobs.gemspec +27 -23
- metadata +44 -200
- data/LICENSE +0 -13
- data/circle.yml +0 -41
- data/gemfiles/sidekiq_4.0.gemfile +0 -22
- data/gemfiles/sidekiq_4.1.gemfile +0 -22
- data/gemfiles/sidekiq_4.2.gemfile +0 -22
- data/gemfiles/sidekiq_5.0.gemfile +0 -22
- data/gemfiles/sidekiq_develop.gemfile +0 -22
- data/rails_example/.env +0 -12
- data/rails_example/.env.test +0 -12
- data/rails_example/.gitignore +0 -13
- data/rails_example/.rspec +0 -2
- data/rails_example/Gemfile +0 -38
- data/rails_example/Procfile +0 -2
- data/rails_example/README.rdoc +0 -28
- data/rails_example/Rakefile +0 -6
- data/rails_example/app/assets/images/.keep +0 -0
- data/rails_example/app/assets/javascripts/application.js +0 -16
- data/rails_example/app/assets/stylesheets/application.css +0 -15
- data/rails_example/app/channels/appearance_channel.rb +0 -17
- data/rails_example/app/channels/application_cable/channel.rb +0 -4
- data/rails_example/app/channels/application_cable/connection.rb +0 -9
- data/rails_example/app/channels/post_channel.rb +0 -5
- data/rails_example/app/controllers/application_controller.rb +0 -5
- data/rails_example/app/controllers/concerns/.keep +0 -0
- data/rails_example/app/controllers/work_controller.rb +0 -39
- data/rails_example/app/helpers/application_helper.rb +0 -2
- data/rails_example/app/mailers/.keep +0 -0
- data/rails_example/app/models/.keep +0 -0
- data/rails_example/app/models/application_record.rb +0 -3
- data/rails_example/app/models/concerns/.keep +0 -0
- data/rails_example/app/models/guest.rb +0 -18
- data/rails_example/app/models/post.rb +0 -2
- data/rails_example/app/views/layouts/application.html.erb +0 -15
- data/rails_example/app/workers/simple_worker.rb +0 -15
- data/rails_example/app/workers/slow_until_executing_worker.rb +0 -15
- data/rails_example/app/workers/spawn_simple_worker.rb +0 -10
- data/rails_example/app/workers/while_executing_worker.rb +0 -12
- data/rails_example/app/workers/without_args_worker.rb +0 -16
- data/rails_example/app/workers/without_argument_worker.rb +0 -12
- data/rails_example/bin/bundle +0 -3
- data/rails_example/bin/check_or_setup_db +0 -56
- data/rails_example/bin/docker-setup +0 -20
- data/rails_example/bin/rails +0 -4
- data/rails_example/bin/rake +0 -4
- data/rails_example/bin/setup +0 -34
- data/rails_example/bin/update +0 -29
- data/rails_example/cable.ru +0 -6
- data/rails_example/common-services.yml +0 -52
- data/rails_example/config.ru +0 -4
- data/rails_example/config/application.rb +0 -27
- data/rails_example/config/boot.rb +0 -3
- data/rails_example/config/cable.yml +0 -9
- data/rails_example/config/database.docker.yml +0 -12
- data/rails_example/config/database.yml +0 -19
- data/rails_example/config/environment.rb +0 -5
- data/rails_example/config/environments/development.rb +0 -54
- data/rails_example/config/environments/production.rb +0 -86
- data/rails_example/config/environments/test.rb +0 -42
- data/rails_example/config/initializers/application_controller_renderer.rb +0 -6
- data/rails_example/config/initializers/assets.rb +0 -11
- data/rails_example/config/initializers/backtrace_silencers.rb +0 -9
- data/rails_example/config/initializers/cookies_serializer.rb +0 -5
- data/rails_example/config/initializers/filter_parameter_logging.rb +0 -4
- data/rails_example/config/initializers/inflections.rb +0 -16
- data/rails_example/config/initializers/mime_types.rb +0 -4
- data/rails_example/config/initializers/new_framework_defaults.rb +0 -23
- data/rails_example/config/initializers/session_store.rb +0 -3
- data/rails_example/config/initializers/sidekiq.rb +0 -13
- data/rails_example/config/initializers/wrap_parameters.rb +0 -14
- data/rails_example/config/locales/en.yml +0 -23
- data/rails_example/config/puma.rb +0 -38
- data/rails_example/config/routes.rb +0 -8
- data/rails_example/config/secrets.yml +0 -22
- data/rails_example/config/sidekiq.yml +0 -6
- data/rails_example/config/spring.rb +0 -6
- data/rails_example/db/migrate/20160724111322_create_posts.rb +0 -12
- data/rails_example/db/schema.rb +0 -25
- data/rails_example/db/seeds.rb +0 -7
- data/rails_example/dev-entrypoint.sh +0 -55
- data/rails_example/dev.env +0 -12
- data/rails_example/docker-compose.yml +0 -71
- data/rails_example/docker/rails.Dockerfile +0 -27
- data/rails_example/lib/assets/.keep +0 -0
- data/rails_example/lib/tasks/.keep +0 -0
- data/rails_example/log/.keep +0 -0
- data/rails_example/public/404.html +0 -67
- data/rails_example/public/422.html +0 -67
- data/rails_example/public/500.html +0 -66
- data/rails_example/public/favicon.ico +0 -0
- data/rails_example/public/robots.txt +0 -5
- data/rails_example/simple.ru +0 -12
- data/rails_example/spec/controllers/work_controller_mock_spec.rb +0 -91
- data/rails_example/spec/controllers/work_controller_spec.rb +0 -77
- data/rails_example/spec/factories/posts.rb +0 -8
- data/rails_example/spec/models/post_spec.rb +0 -4
- data/rails_example/spec/rails_helper.rb +0 -20
- data/rails_example/spec/spec_helper.rb +0 -20
- data/rails_example/spec/support/sidekiq_meta.rb +0 -12
- data/rails_example/spec/workers/simple_worker_spec.rb +0 -4
- data/rails_example/vendor/assets/javascripts/.keep +0 -0
- data/rails_example/vendor/assets/stylesheets/.keep +0 -0
- data/spec/jobs/another_unique_job.rb +0 -13
- data/spec/jobs/custom_queue_job.rb +0 -5
- data/spec/jobs/custom_queue_job_with_filter_method.rb +0 -7
- data/spec/jobs/custom_queue_job_with_filter_proc.rb +0 -10
- data/spec/jobs/expiring_job.rb +0 -4
- data/spec/jobs/inline_worker.rb +0 -8
- data/spec/jobs/just_a_worker.rb +0 -7
- data/spec/jobs/long_running_job.rb +0 -6
- data/spec/jobs/main_job.rb +0 -7
- data/spec/jobs/my_job.rb +0 -12
- data/spec/jobs/my_unique_job.rb +0 -11
- data/spec/jobs/my_unique_job_with_filter_method.rb +0 -17
- data/spec/jobs/my_unique_job_with_filter_proc.rb +0 -15
- data/spec/jobs/notify_worker.rb +0 -10
- data/spec/jobs/plain_class.rb +0 -3
- data/spec/jobs/simple_worker.rb +0 -11
- data/spec/jobs/spawn_simple_worker.rb +0 -8
- data/spec/jobs/test_class.rb +0 -3
- data/spec/jobs/unique_job_with_conditional_parameter.rb +0 -14
- data/spec/jobs/unique_job_with_filter_method.rb +0 -18
- data/spec/jobs/unique_job_with_nil_unique_args.rb +0 -16
- data/spec/jobs/unique_job_with_no_unique_args_method.rb +0 -12
- data/spec/jobs/unique_job_withthout_unique_args_parameter.rb +0 -14
- data/spec/jobs/unique_on_all_queues_job.rb +0 -13
- data/spec/jobs/until_and_while_executing_job.rb +0 -7
- data/spec/jobs/until_executed_job.rb +0 -17
- data/spec/jobs/until_executing_job.rb +0 -7
- data/spec/jobs/until_global_timeout_job.rb +0 -8
- data/spec/jobs/until_timeout_job.rb +0 -8
- data/spec/jobs/while_executing_job.rb +0 -12
- data/spec/jobs/without_argument_job.rb +0 -9
- data/spec/lib/sidekiq_unique_jobs/cli_spec.rb +0 -183
- data/spec/lib/sidekiq_unique_jobs/client/middleware_spec.rb +0 -316
- data/spec/lib/sidekiq_unique_jobs/config_spec.rb +0 -84
- data/spec/lib/sidekiq_unique_jobs/core_ext_spec.rb +0 -25
- data/spec/lib/sidekiq_unique_jobs/lock/until_and_while_executing_spec.rb +0 -42
- data/spec/lib/sidekiq_unique_jobs/lock/until_executed_spec.rb +0 -37
- data/spec/lib/sidekiq_unique_jobs/lock/until_timeout_spec.rb +0 -26
- data/spec/lib/sidekiq_unique_jobs/lock/while_executing_spec.rb +0 -86
- data/spec/lib/sidekiq_unique_jobs/normalizer_spec.rb +0 -21
- data/spec/lib/sidekiq_unique_jobs/options_with_fallback_spec.rb +0 -113
- data/spec/lib/sidekiq_unique_jobs/queue_lock_timeout_calculator_spec.rb +0 -47
- data/spec/lib/sidekiq_unique_jobs/run_lock_timeout_calculator_spec.rb +0 -36
- data/spec/lib/sidekiq_unique_jobs/script_mock_spec.rb +0 -88
- data/spec/lib/sidekiq_unique_jobs/scripts/acquire_lock_spec.rb +0 -50
- data/spec/lib/sidekiq_unique_jobs/scripts/release_lock_spec.rb +0 -41
- data/spec/lib/sidekiq_unique_jobs/scripts_spec.rb +0 -68
- data/spec/lib/sidekiq_unique_jobs/server/middleware_spec.rb +0 -78
- data/spec/lib/sidekiq_unique_jobs/sidekiq_testing_enabled_spec.rb +0 -164
- data/spec/lib/sidekiq_unique_jobs/sidekiq_unique_ext_spec.rb +0 -75
- data/spec/lib/sidekiq_unique_jobs/sidekiq_unique_jobs_spec.rb +0 -41
- data/spec/lib/sidekiq_unique_jobs/timeout_calculator_spec.rb +0 -70
- data/spec/lib/sidekiq_unique_jobs/unique_args_spec.rb +0 -257
- data/spec/lib/sidekiq_unique_jobs/unlockable_spec.rb +0 -37
- data/spec/lib/sidekiq_unique_jobs/util_spec.rb +0 -81
- data/spec/spec_helper.rb +0 -92
- data/spec/support/matchers/redis_matchers.rb +0 -29
- data/spec/support/ruby_meta.rb +0 -17
- data/spec/support/sidekiq_meta.rb +0 -30
- data/spec/support/unique_macros.rb +0 -71
File without changes
|
File without changes
|
@@ -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,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
|
data/rails_example/bin/bundle
DELETED
@@ -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
|
data/rails_example/bin/rails
DELETED
data/rails_example/bin/rake
DELETED
data/rails_example/bin/setup
DELETED
@@ -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
|
data/rails_example/bin/update
DELETED
@@ -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
|
data/rails_example/cable.ru
DELETED
@@ -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
|
data/rails_example/config.ru
DELETED
@@ -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,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
|
-
|