sidekiq-unique-jobs 4.0.18 → 7.1.28
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 +5 -5
- data/CHANGELOG.md +1889 -94
- data/LICENSE.txt +21 -0
- data/README.md +927 -119
- data/bin/uniquejobs +7 -0
- data/lib/sidekiq-unique-jobs.rb +2 -78
- data/lib/sidekiq_unique_jobs/batch_delete.rb +124 -0
- data/lib/sidekiq_unique_jobs/changelog.rb +78 -0
- data/lib/sidekiq_unique_jobs/cli.rb +79 -21
- data/lib/sidekiq_unique_jobs/config.rb +310 -14
- data/lib/sidekiq_unique_jobs/connection.rb +23 -0
- data/lib/sidekiq_unique_jobs/constants.rb +52 -16
- data/lib/sidekiq_unique_jobs/core_ext.rb +114 -33
- data/lib/sidekiq_unique_jobs/deprecation.rb +65 -0
- data/lib/sidekiq_unique_jobs/digests.rb +111 -0
- data/lib/sidekiq_unique_jobs/exceptions.rb +105 -0
- data/lib/sidekiq_unique_jobs/expiring_digests.rb +14 -0
- data/lib/sidekiq_unique_jobs/job.rb +58 -0
- data/lib/sidekiq_unique_jobs/json.rb +47 -0
- data/lib/sidekiq_unique_jobs/key.rb +98 -0
- data/lib/sidekiq_unique_jobs/lock/base_lock.rb +165 -0
- data/lib/sidekiq_unique_jobs/lock/client_validator.rb +28 -0
- data/lib/sidekiq_unique_jobs/lock/server_validator.rb +27 -0
- data/lib/sidekiq_unique_jobs/lock/until_and_while_executing.rb +65 -7
- data/lib/sidekiq_unique_jobs/lock/until_executed.rb +34 -64
- data/lib/sidekiq_unique_jobs/lock/until_executing.rb +37 -4
- data/lib/sidekiq_unique_jobs/lock/until_expired.rb +42 -0
- data/lib/sidekiq_unique_jobs/lock/validator.rb +96 -0
- data/lib/sidekiq_unique_jobs/lock/while_executing.rb +53 -35
- data/lib/sidekiq_unique_jobs/lock/while_executing_reject.rb +21 -0
- data/lib/sidekiq_unique_jobs/lock.rb +338 -6
- data/lib/sidekiq_unique_jobs/lock_args.rb +127 -0
- data/lib/sidekiq_unique_jobs/lock_config.rb +126 -0
- data/lib/sidekiq_unique_jobs/lock_digest.rb +79 -0
- data/lib/sidekiq_unique_jobs/lock_info.rb +68 -0
- data/lib/sidekiq_unique_jobs/lock_timeout.rb +62 -0
- data/lib/sidekiq_unique_jobs/lock_ttl.rb +77 -0
- data/lib/sidekiq_unique_jobs/locksmith.rb +383 -0
- data/lib/sidekiq_unique_jobs/logging/middleware_context.rb +44 -0
- data/lib/sidekiq_unique_jobs/logging.rb +236 -0
- data/lib/sidekiq_unique_jobs/lua/delete.lua +51 -0
- data/lib/sidekiq_unique_jobs/lua/delete_by_digest.lua +42 -0
- data/lib/sidekiq_unique_jobs/lua/delete_job_by_digest.lua +38 -0
- data/lib/sidekiq_unique_jobs/lua/find_digest_in_queues.lua +26 -0
- data/lib/sidekiq_unique_jobs/lua/lock.lua +99 -0
- data/lib/sidekiq_unique_jobs/lua/lock_until_expired.lua +92 -0
- data/lib/sidekiq_unique_jobs/lua/locked.lua +35 -0
- data/lib/sidekiq_unique_jobs/lua/queue.lua +87 -0
- data/lib/sidekiq_unique_jobs/lua/reap_orphans.lua +122 -0
- data/lib/sidekiq_unique_jobs/lua/shared/_common.lua +40 -0
- data/lib/sidekiq_unique_jobs/lua/shared/_current_time.lua +8 -0
- data/lib/sidekiq_unique_jobs/lua/shared/_delete_from_queue.lua +22 -0
- data/lib/sidekiq_unique_jobs/lua/shared/_delete_from_sorted_set.lua +18 -0
- data/lib/sidekiq_unique_jobs/lua/shared/_find_digest_in_process_set.lua +53 -0
- data/lib/sidekiq_unique_jobs/lua/shared/_find_digest_in_queues.lua +43 -0
- data/lib/sidekiq_unique_jobs/lua/shared/_find_digest_in_sorted_set.lua +24 -0
- data/lib/sidekiq_unique_jobs/lua/shared/_hgetall.lua +13 -0
- data/lib/sidekiq_unique_jobs/lua/shared/_upgrades.lua +3 -0
- data/lib/sidekiq_unique_jobs/lua/unlock.lua +107 -0
- data/lib/sidekiq_unique_jobs/lua/update_version.lua +40 -0
- data/lib/sidekiq_unique_jobs/lua/upgrade.lua +68 -0
- data/lib/sidekiq_unique_jobs/middleware/client.rb +42 -0
- data/lib/sidekiq_unique_jobs/middleware/server.rb +31 -0
- data/lib/sidekiq_unique_jobs/middleware.rb +34 -29
- data/lib/sidekiq_unique_jobs/normalizer.rb +11 -1
- data/lib/sidekiq_unique_jobs/on_conflict/log.rb +24 -0
- data/lib/sidekiq_unique_jobs/on_conflict/null_strategy.rb +16 -0
- data/lib/sidekiq_unique_jobs/on_conflict/raise.rb +17 -0
- data/lib/sidekiq_unique_jobs/on_conflict/reject.rb +118 -0
- data/lib/sidekiq_unique_jobs/on_conflict/replace.rb +82 -0
- data/lib/sidekiq_unique_jobs/on_conflict/reschedule.rb +35 -0
- data/lib/sidekiq_unique_jobs/on_conflict/strategy.rb +51 -0
- data/lib/sidekiq_unique_jobs/on_conflict.rb +44 -0
- data/lib/sidekiq_unique_jobs/options_with_fallback.rb +54 -31
- data/lib/sidekiq_unique_jobs/orphans/lua_reaper.rb +29 -0
- data/lib/sidekiq_unique_jobs/orphans/manager.rb +241 -0
- data/lib/sidekiq_unique_jobs/orphans/null_reaper.rb +24 -0
- data/lib/sidekiq_unique_jobs/orphans/observer.rb +42 -0
- data/lib/sidekiq_unique_jobs/orphans/reaper.rb +114 -0
- data/lib/sidekiq_unique_jobs/orphans/reaper_resurrector.rb +170 -0
- data/lib/sidekiq_unique_jobs/orphans/ruby_reaper.rb +298 -0
- data/lib/sidekiq_unique_jobs/redis/entity.rb +112 -0
- data/lib/sidekiq_unique_jobs/redis/hash.rb +56 -0
- data/lib/sidekiq_unique_jobs/redis/list.rb +32 -0
- data/lib/sidekiq_unique_jobs/redis/set.rb +32 -0
- data/lib/sidekiq_unique_jobs/redis/sorted_set.rb +86 -0
- data/lib/sidekiq_unique_jobs/redis/string.rb +51 -0
- data/lib/sidekiq_unique_jobs/redis.rb +11 -0
- data/lib/sidekiq_unique_jobs/reflectable.rb +26 -0
- data/lib/sidekiq_unique_jobs/reflections.rb +79 -0
- data/lib/sidekiq_unique_jobs/rspec/matchers/have_valid_sidekiq_options.rb +51 -0
- data/lib/sidekiq_unique_jobs/rspec/matchers.rb +26 -0
- data/lib/sidekiq_unique_jobs/script/caller.rb +127 -0
- data/lib/sidekiq_unique_jobs/script.rb +15 -0
- data/lib/sidekiq_unique_jobs/server.rb +61 -0
- data/lib/sidekiq_unique_jobs/sidekiq_unique_ext.rb +116 -104
- data/lib/sidekiq_unique_jobs/sidekiq_unique_jobs.rb +304 -0
- data/lib/sidekiq_unique_jobs/sidekiq_worker_methods.rb +84 -0
- data/lib/sidekiq_unique_jobs/testing.rb +115 -50
- data/lib/sidekiq_unique_jobs/timer_task.rb +299 -0
- data/lib/sidekiq_unique_jobs/timing.rb +58 -0
- data/lib/sidekiq_unique_jobs/unlockable.rb +29 -33
- data/lib/sidekiq_unique_jobs/update_version.rb +25 -0
- data/lib/sidekiq_unique_jobs/upgrade_locks.rb +155 -0
- data/lib/sidekiq_unique_jobs/version.rb +5 -1
- data/lib/sidekiq_unique_jobs/version_check.rb +114 -0
- data/lib/sidekiq_unique_jobs/web/helpers.rb +173 -0
- data/lib/sidekiq_unique_jobs/web/views/_paging.erb +10 -0
- data/lib/sidekiq_unique_jobs/web/views/changelogs.erb +54 -0
- data/lib/sidekiq_unique_jobs/web/views/lock.erb +108 -0
- data/lib/sidekiq_unique_jobs/web/views/locks.erb +54 -0
- data/lib/sidekiq_unique_jobs/web.rb +109 -0
- data/lib/sidekiq_unique_jobs.rb +81 -0
- data/lib/tasks/changelog.rake +23 -0
- metadata +173 -251
- data/.codeclimate.yml +0 -22
- data/.dockerignore +0 -4
- data/.editorconfig +0 -14
- data/.fasterer.yml +0 -23
- data/.gitignore +0 -14
- data/.rspec +0 -3
- data/.rubocop.yml +0 -45
- data/.simplecov +0 -12
- data/.travis.yml +0 -43
- data/Appraisals +0 -31
- data/Gemfile +0 -16
- data/LICENSE +0 -13
- data/Rakefile +0 -12
- data/bin/bench +0 -19
- data/bin/jobs +0 -6
- data/circle.yml +0 -38
- data/gemfiles/sidekiq_2.15.gemfile +0 -9
- data/gemfiles/sidekiq_2.16.gemfile +0 -9
- data/gemfiles/sidekiq_2.17.gemfile +0 -19
- data/gemfiles/sidekiq_3.0.gemfile +0 -19
- data/gemfiles/sidekiq_3.1.gemfile +0 -19
- data/gemfiles/sidekiq_3.2.gemfile +0 -19
- data/gemfiles/sidekiq_3.3.gemfile +0 -19
- data/gemfiles/sidekiq_4.0.gemfile +0 -19
- data/gemfiles/sidekiq_4.1.gemfile +0 -19
- data/gemfiles/sidekiq_develop.gemfile +0 -19
- data/lib/sidekiq/simulator.rb +0 -75
- data/lib/sidekiq_unique_jobs/client/middleware.rb +0 -41
- data/lib/sidekiq_unique_jobs/lock/until_timeout.rb +0 -15
- data/lib/sidekiq_unique_jobs/run_lock_failed.rb +0 -1
- data/lib/sidekiq_unique_jobs/script_mock.rb +0 -68
- data/lib/sidekiq_unique_jobs/scripts.rb +0 -49
- data/lib/sidekiq_unique_jobs/server/middleware.rb +0 -34
- data/lib/sidekiq_unique_jobs/testing/sidekiq_overrides.rb +0 -70
- data/lib/sidekiq_unique_jobs/timeout_calculator.rb +0 -65
- data/lib/sidekiq_unique_jobs/unique_args.rb +0 -134
- data/lib/sidekiq_unique_jobs/util.rb +0 -91
- data/rails_example/.env +0 -12
- data/rails_example/.gitignore +0 -13
- data/rails_example/.rspec +0 -2
- data/rails_example/Gemfile +0 -34
- 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 -13
- 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 -21
- 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 -12
- data/rails_example/app/workers/spawn_simple_worker.rb +0 -7
- data/rails_example/bin/bundle +0 -3
- data/rails_example/bin/check_or_setup_db +0 -57
- 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 -50
- 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 -6
- 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/config.ru +0 -4
- 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/rails.Dockerfile +0 -27
- data/rails_example/docker-compose.yml +0 -90
- 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_spec.rb +0 -172
- 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 -21
- 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/redis/acquire_lock.lua +0 -19
- data/redis/release_lock.lua +0 -16
- data/redis/synchronize.lua +0 -16
- data/sidekiq-unique-jobs.gemspec +0 -25
- data/spec/celluloid_with_fallback.rb +0 -18
- data/spec/jobs/another_unique_job.rb +0 -13
- data/spec/jobs/custom_queue_job.rb +0 -6
- 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 -8
- data/spec/jobs/long_running_job.rb +0 -7
- data/spec/jobs/main_job.rb +0 -8
- data/spec/jobs/my_job.rb +0 -12
- data/spec/jobs/my_unique_job.rb +0 -12
- 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 -4
- data/spec/jobs/simple_worker.rb +0 -11
- data/spec/jobs/spawn_simple_worker.rb +0 -8
- data/spec/jobs/test_class.rb +0 -4
- data/spec/jobs/unique_job_with_filter_method.rb +0 -18
- data/spec/jobs/unique_on_all_queues_job.rb +0 -13
- data/spec/jobs/until_and_while_executing_job.rb +0 -8
- data/spec/jobs/until_executed_job.rb +0 -17
- data/spec/jobs/until_executing_job.rb +0 -8
- 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/lib/sidekiq_unique_jobs/client/middleware_spec.rb +0 -321
- 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 -43
- 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 -84
- data/spec/lib/sidekiq_unique_jobs/scripts_spec.rb +0 -77
- data/spec/lib/sidekiq_unique_jobs/server/middleware_spec.rb +0 -83
- data/spec/lib/sidekiq_unique_jobs/sidekiq_testing_enabled_spec.rb +0 -181
- data/spec/lib/sidekiq_unique_jobs/sidekiq_unique_ext_spec.rb +0 -80
- 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 -131
- data/spec/lib/sidekiq_unique_jobs/unlockable_spec.rb +0 -4
- data/spec/lib/sidekiq_unique_jobs/util_spec.rb +0 -53
- data/spec/spec_helper.rb +0 -65
- data/spec/support/matchers/redis_matchers.rb +0 -19
- data/spec/support/ruby_meta.rb +0 -10
- data/spec/support/sidekiq_meta.rb +0 -31
- data/spec/support/unique_macros.rb +0 -71
@@ -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>
|
data/rails_example/bin/bundle
DELETED
@@ -1,57 +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
|
-
|
32
|
-
include ActiveRecord::Tasks
|
33
|
-
|
34
|
-
DatabaseTasks.root = File.expand_path '../..', __FILE__
|
35
|
-
DatabaseTasks.db_dir = File.join DatabaseTasks.root, 'db'
|
36
|
-
DatabaseTasks.env = ENV.fetch 'ENV', ENV.fetch('RAILS_ENV', 'development')
|
37
|
-
|
38
|
-
# The App database seeder:
|
39
|
-
DatabaseTasks.seed_loader = (Class.new do
|
40
|
-
def load_seed
|
41
|
-
seed_file_path = File.join DatabaseTasks.db_dir, 'seeds.rb'
|
42
|
-
raise "Seed file '#{seed_file_path}' does not exist" unless File.file?(seed_file_path)
|
43
|
-
load seed_file_path
|
44
|
-
end
|
45
|
-
end).new
|
46
|
-
|
47
|
-
# Add model dirs to the autoload_paths for the seeder to run smoothly:
|
48
|
-
ActiveSupport::Dependencies.autoload_paths << File.join(DatabaseTasks.root, 'app', 'models', 'concerns')
|
49
|
-
ActiveSupport::Dependencies.autoload_paths << File.join(DatabaseTasks.root, 'app', 'models')
|
50
|
-
|
51
|
-
return 2 unless DatabaseTasks.create_current
|
52
|
-
return 3 unless DatabaseTasks.load_schema_current
|
53
|
-
return 4 unless DatabaseTasks.load_seed
|
54
|
-
0
|
55
|
-
ensure
|
56
|
-
ActiveRecord::Base.clear_all_connections!
|
57
|
-
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,50 +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
|
-
# We'll set the RAILS_ENV and RACK_ENV environment variables to
|
29
|
-
# 'development', so our app containers will start in 'development' mode
|
30
|
-
# on this compose project:
|
31
|
-
RAILS_ENV: development
|
32
|
-
RACK_ENV: development
|
33
|
-
cpu_shares: 4
|
34
|
-
# Specify the directory from where all commands sent to the container will be
|
35
|
-
# issued to where the code is mounted:
|
36
|
-
working_dir: /usr/src/app
|
37
|
-
|
38
|
-
# Keep the stdin open, so we can attach to our app container's process
|
39
|
-
# and do things such as byebug, etc:
|
40
|
-
stdin_open: true
|
41
|
-
|
42
|
-
# Enable sending signals (CTRL+C, CTRL+P + CTRL+Q) into the container:
|
43
|
-
tty: true
|
44
|
-
volumes:
|
45
|
-
# Mount our app code directory (".") into our app containers at the
|
46
|
-
# "/usr/src/app" folder:
|
47
|
-
- .:/usr/src/app
|
48
|
-
|
49
|
-
# Mount the 'gems' volume on the folder that stores bundled gems:
|
50
|
-
- gems:/usr/local/bundle
|
@@ -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') { 'postgres' } %>
|
7
|
-
password: <%= ENV.fetch('DB_PASSWORD') { '' } %>
|
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
|
-
|
@@ -1,54 +0,0 @@
|
|
1
|
-
Rails.application.configure do
|
2
|
-
# Settings specified here will take precedence over those in config/application.rb.
|
3
|
-
|
4
|
-
# In the development environment your application's code is reloaded on
|
5
|
-
# every request. This slows down response time but is perfect for development
|
6
|
-
# since you don't have to restart the web server when you make code changes.
|
7
|
-
config.cache_classes = false
|
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/disable caching. By default caching is disabled.
|
16
|
-
if Rails.root.join('tmp/caching-dev.txt').exist?
|
17
|
-
config.action_controller.perform_caching = true
|
18
|
-
|
19
|
-
config.cache_store = :memory_store
|
20
|
-
config.public_file_server.headers = {
|
21
|
-
'Cache-Control' => 'public, max-age=172800'
|
22
|
-
}
|
23
|
-
else
|
24
|
-
config.action_controller.perform_caching = false
|
25
|
-
|
26
|
-
config.cache_store = :null_store
|
27
|
-
end
|
28
|
-
|
29
|
-
# Don't care if the mailer can't send.
|
30
|
-
config.action_mailer.raise_delivery_errors = false
|
31
|
-
|
32
|
-
config.action_mailer.perform_caching = false
|
33
|
-
|
34
|
-
# Print deprecation notices to the Rails logger.
|
35
|
-
config.active_support.deprecation = :log
|
36
|
-
|
37
|
-
# Raise an error on page load if there are pending migrations.
|
38
|
-
config.active_record.migration_error = :page_load
|
39
|
-
|
40
|
-
# Debug mode disables concatenation and preprocessing of assets.
|
41
|
-
# This option may cause significant delays in view rendering with a large
|
42
|
-
# number of complex assets.
|
43
|
-
config.assets.debug = true
|
44
|
-
|
45
|
-
# Suppress logger output for asset requests.
|
46
|
-
config.assets.quiet = true
|
47
|
-
|
48
|
-
# Raises error for missing translations
|
49
|
-
# config.action_view.raise_on_missing_translations = true
|
50
|
-
|
51
|
-
# Use an evented file watcher to asynchronously detect changes in source code,
|
52
|
-
# routes, locales, etc. This feature depends on the listen gem.
|
53
|
-
# config.file_watcher = ActiveSupport::EventedFileUpdateChecker
|
54
|
-
end
|
@@ -1,86 +0,0 @@
|
|
1
|
-
Rails.application.configure do
|
2
|
-
# Settings specified here will take precedence over those in config/application.rb.
|
3
|
-
|
4
|
-
# Code is not reloaded between requests.
|
5
|
-
config.cache_classes = true
|
6
|
-
|
7
|
-
# Eager load code on boot. This eager loads most of Rails and
|
8
|
-
# your application in memory, allowing both threaded web servers
|
9
|
-
# and those relying on copy on write to perform better.
|
10
|
-
# Rake tasks automatically ignore this option for performance.
|
11
|
-
config.eager_load = true
|
12
|
-
|
13
|
-
# Full error reports are disabled and caching is turned on.
|
14
|
-
config.consider_all_requests_local = false
|
15
|
-
config.action_controller.perform_caching = true
|
16
|
-
|
17
|
-
# Disable serving static files from the `/public` folder by default since
|
18
|
-
# Apache or NGINX already handles this.
|
19
|
-
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
|
20
|
-
|
21
|
-
# Compress JavaScripts and CSS.
|
22
|
-
config.assets.js_compressor = :uglifier
|
23
|
-
# config.assets.css_compressor = :sass
|
24
|
-
|
25
|
-
# Do not fallback to assets pipeline if a precompiled asset is missed.
|
26
|
-
config.assets.compile = false
|
27
|
-
|
28
|
-
# `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
|
29
|
-
|
30
|
-
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
31
|
-
# config.action_controller.asset_host = 'http://assets.example.com'
|
32
|
-
|
33
|
-
# Specifies the header that your server uses for sending files.
|
34
|
-
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
|
35
|
-
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
|
36
|
-
|
37
|
-
# Mount Action Cable outside main process or domain
|
38
|
-
# config.action_cable.mount_path = nil
|
39
|
-
# config.action_cable.url = 'wss://example.com/cable'
|
40
|
-
# config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
|
41
|
-
|
42
|
-
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
43
|
-
# config.force_ssl = true
|
44
|
-
|
45
|
-
# Use the lowest log level to ensure availability of diagnostic information
|
46
|
-
# when problems arise.
|
47
|
-
config.log_level = :debug
|
48
|
-
|
49
|
-
# Prepend all log lines with the following tags.
|
50
|
-
config.log_tags = [:request_id]
|
51
|
-
|
52
|
-
# Use a different cache store in production.
|
53
|
-
# config.cache_store = :mem_cache_store
|
54
|
-
|
55
|
-
# Use a real queuing backend for Active Job (and separate queues per environment)
|
56
|
-
# config.active_job.queue_adapter = :resque
|
57
|
-
# config.active_job.queue_name_prefix = "rails_example_#{Rails.env}"
|
58
|
-
config.action_mailer.perform_caching = false
|
59
|
-
|
60
|
-
# Ignore bad email addresses and do not raise email delivery errors.
|
61
|
-
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
|
62
|
-
# config.action_mailer.raise_delivery_errors = false
|
63
|
-
|
64
|
-
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
65
|
-
# the I18n.default_locale when a translation cannot be found).
|
66
|
-
config.i18n.fallbacks = true
|
67
|
-
|
68
|
-
# Send deprecation notices to registered listeners.
|
69
|
-
config.active_support.deprecation = :notify
|
70
|
-
|
71
|
-
# Use default logging formatter so that PID and timestamp are not suppressed.
|
72
|
-
config.log_formatter = ::Logger::Formatter.new
|
73
|
-
|
74
|
-
# Use a different logger for distributed setups.
|
75
|
-
# require 'syslog/logger'
|
76
|
-
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
|
77
|
-
|
78
|
-
if ENV['RAILS_LOG_TO_STDOUT'].present?
|
79
|
-
logger = ActiveSupport::Logger.new(STDOUT)
|
80
|
-
logger.formatter = config.log_formatter
|
81
|
-
config.logger = ActiveSupport::TaggedLogging.new(logger)
|
82
|
-
end
|
83
|
-
|
84
|
-
# Do not dump schema after migrations.
|
85
|
-
config.active_record.dump_schema_after_migration = false
|
86
|
-
end
|
@@ -1,42 +0,0 @@
|
|
1
|
-
Rails.application.configure do
|
2
|
-
# Settings specified here will take precedence over those in config/application.rb.
|
3
|
-
|
4
|
-
# The test environment is used exclusively to run your application's
|
5
|
-
# test suite. You never need to work with it otherwise. Remember that
|
6
|
-
# your test database is "scratch space" for the test suite and is wiped
|
7
|
-
# and recreated between test runs. Don't rely on the data there!
|
8
|
-
config.cache_classes = true
|
9
|
-
|
10
|
-
# Do not eager load code on boot. This avoids loading your whole application
|
11
|
-
# just for the purpose of running a single test. If you are using a tool that
|
12
|
-
# preloads Rails for running tests, you may have to set it to true.
|
13
|
-
config.eager_load = false
|
14
|
-
|
15
|
-
# Configure public file server for tests with Cache-Control for performance.
|
16
|
-
config.public_file_server.enabled = true
|
17
|
-
config.public_file_server.headers = {
|
18
|
-
'Cache-Control' => 'public, max-age=3600'
|
19
|
-
}
|
20
|
-
|
21
|
-
# Show full error reports and disable caching.
|
22
|
-
config.consider_all_requests_local = true
|
23
|
-
config.action_controller.perform_caching = false
|
24
|
-
|
25
|
-
# Raise exceptions instead of rendering exception templates.
|
26
|
-
config.action_dispatch.show_exceptions = false
|
27
|
-
|
28
|
-
# Disable request forgery protection in test environment.
|
29
|
-
config.action_controller.allow_forgery_protection = false
|
30
|
-
config.action_mailer.perform_caching = false
|
31
|
-
|
32
|
-
# Tell Action Mailer not to deliver emails to the real world.
|
33
|
-
# The :test delivery method accumulates sent emails in the
|
34
|
-
# ActionMailer::Base.deliveries array.
|
35
|
-
config.action_mailer.delivery_method = :test
|
36
|
-
|
37
|
-
# Print deprecation notices to the stderr.
|
38
|
-
config.active_support.deprecation = :stderr
|
39
|
-
|
40
|
-
# Raises error for missing translations
|
41
|
-
# config.action_view.raise_on_missing_translations = true
|
42
|
-
end
|
@@ -1,11 +0,0 @@
|
|
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
|
8
|
-
|
9
|
-
# Precompile additional assets.
|
10
|
-
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
|
11
|
-
# Rails.application.config.assets.precompile += %w( search.js )
|
@@ -1,9 +0,0 @@
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
2
|
-
|
3
|
-
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
|
4
|
-
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
|
5
|
-
|
6
|
-
# You can also remove all the silencers
|
7
|
-
# if you're trying to debug a problem that might stem
|
8
|
-
# from framework code.
|
9
|
-
# Rails.backtrace_cleaner.remove_silencers!
|
@@ -1,16 +0,0 @@
|
|
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
|
@@ -1,23 +0,0 @@
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
2
|
-
#
|
3
|
-
# This file contains migration options to ease your Rails 5.0 upgrade.
|
4
|
-
#
|
5
|
-
# Once upgraded flip defaults one by one to migrate to the new default.
|
6
|
-
#
|
7
|
-
# Read the Rails 5.0 release notes for more info on each option.
|
8
|
-
|
9
|
-
# Enable per-form CSRF tokens. Previous versions had false.
|
10
|
-
Rails.application.config.action_controller.per_form_csrf_tokens = false
|
11
|
-
|
12
|
-
# Enable origin-checking CSRF mitigation. Previous versions had false.
|
13
|
-
Rails.application.config.action_controller.forgery_protection_origin_check = false
|
14
|
-
|
15
|
-
# Make Ruby 2.4 preserve the timezone of the receiver when calling `to_time`.
|
16
|
-
# Previous versions had false.
|
17
|
-
ActiveSupport.to_time_preserves_timezone = false
|
18
|
-
|
19
|
-
# Require `belongs_to` associations by default. Previous versions had false.
|
20
|
-
Rails.application.config.active_record.belongs_to_required_by_default = false
|
21
|
-
|
22
|
-
# Do not halt callback chains when a callback returns false. Previous versions had true.
|
23
|
-
ActiveSupport.halt_callback_chains_on_return_false = true
|