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,13 +0,0 @@
|
|
1
|
-
Sidekiq.default_worker_options = {
|
2
|
-
backtrace: true,
|
3
|
-
retry: false
|
4
|
-
}
|
5
|
-
|
6
|
-
Sidekiq.configure_server do |config|
|
7
|
-
config.redis = { url: ENV['REDIS_URL'] }
|
8
|
-
# config.error_handlers << Proc.new { |ex, context| Airbrake.notify_or_ignore(ex, parameters: context) }
|
9
|
-
end
|
10
|
-
|
11
|
-
Sidekiq.configure_client do |config|
|
12
|
-
config.redis = { url: ENV['REDIS_URL'] }
|
13
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
2
|
-
|
3
|
-
# This file contains settings for ActionController::ParamsWrapper which
|
4
|
-
# is enabled by default.
|
5
|
-
|
6
|
-
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
7
|
-
ActiveSupport.on_load(:action_controller) do
|
8
|
-
wrap_parameters format: [:json]
|
9
|
-
end
|
10
|
-
|
11
|
-
# To enable root element in JSON for ActiveRecord objects.
|
12
|
-
# ActiveSupport.on_load(:active_record) do
|
13
|
-
# self.include_root_in_json = true
|
14
|
-
# end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
# Files in the config/locales directory are used for internationalization
|
2
|
-
# and are automatically loaded by Rails. If you want to use locales other
|
3
|
-
# than English, add the necessary files in this directory.
|
4
|
-
#
|
5
|
-
# To use the locales, use `I18n.t`:
|
6
|
-
#
|
7
|
-
# I18n.t 'hello'
|
8
|
-
#
|
9
|
-
# In views, this is aliased to just `t`:
|
10
|
-
#
|
11
|
-
# <%= t('hello') %>
|
12
|
-
#
|
13
|
-
# To use a different locale, set it with `I18n.locale`:
|
14
|
-
#
|
15
|
-
# I18n.locale = :es
|
16
|
-
#
|
17
|
-
# This would use the information in config/locales/es.yml.
|
18
|
-
#
|
19
|
-
# To learn more, please read the Rails Internationalization guide
|
20
|
-
# available at http://guides.rubyonrails.org/i18n.html.
|
21
|
-
|
22
|
-
en:
|
23
|
-
hello: "Hello world"
|
@@ -1,38 +0,0 @@
|
|
1
|
-
threads_count = ENV.fetch('RAILS_MAX_THREADS') { 5 }.to_i
|
2
|
-
threads threads_count, threads_count
|
3
|
-
port ENV.fetch('PORT') { 3000 }
|
4
|
-
environment ENV.fetch('RAILS_ENV') { 'development' }
|
5
|
-
# daemonize false
|
6
|
-
|
7
|
-
# Store the pid of the server in the file at "path".
|
8
|
-
#
|
9
|
-
# pidfile '/u/apps/lolcat/tmp/pids/puma.pid'
|
10
|
-
|
11
|
-
# Use "path" as the file to store the server info state. This is
|
12
|
-
# used by "pumactl" to query and control the server.
|
13
|
-
#
|
14
|
-
# state_path '/u/apps/lolcat/tmp/pids/puma.state'
|
15
|
-
|
16
|
-
# Use the `preload_app!` method when specifying a `workers` number.
|
17
|
-
# This directive tells Puma to first boot the application and load code
|
18
|
-
# before forking the application. This takes advantage of Copy On Write
|
19
|
-
# process behavior so workers use less memory. If you use this option
|
20
|
-
# you need to make sure to reconnect any threads in the `on_worker_boot`
|
21
|
-
# block.
|
22
|
-
#
|
23
|
-
# workers ENV.fetch("WEB_CONCURRENCY") { 2 }
|
24
|
-
# preload_app!
|
25
|
-
|
26
|
-
# The code in the `on_worker_boot` will be called if you are using
|
27
|
-
# clustered mode by specifying a number of `workers`. After each worker
|
28
|
-
# process is booted this block will be run, if you are using `preload_app!`
|
29
|
-
# option you will want to use this block to reconnect to any threads
|
30
|
-
# or connections that may have been created at application boot, Ruby
|
31
|
-
# cannot share connections between processes.
|
32
|
-
#
|
33
|
-
# on_worker_boot do
|
34
|
-
# ActiveRecord::Base.establish_connection if defined?(ActiveRecord)
|
35
|
-
# end
|
36
|
-
|
37
|
-
# Allow puma to be restarted by `rails restart` command.
|
38
|
-
# plugin :tmp_restart
|
@@ -1,22 +0,0 @@
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
2
|
-
|
3
|
-
# Your secret key is used for verifying the integrity of signed cookies.
|
4
|
-
# If you change this key, all old signed cookies will become invalid!
|
5
|
-
|
6
|
-
# Make sure the secret is at least 30 characters and all random,
|
7
|
-
# no regular words or you'll be exposed to dictionary attacks.
|
8
|
-
# You can use `rails secret` to generate a secure secret key.
|
9
|
-
|
10
|
-
# Make sure the secrets in this file are kept private
|
11
|
-
# if you're sharing your code publicly.
|
12
|
-
|
13
|
-
development:
|
14
|
-
secret_key_base: f5771482e38ac985be78a1668b8a155f3be99b707cea923e7f0e55a649f78bb2e9debd08f49f57ba2f3da4ffcfc73a18bd43054e0f704c2513735e57cf612cf0
|
15
|
-
|
16
|
-
test:
|
17
|
-
secret_key_base: cb65c5fd20b500e74f0971e1f2eb440c9965e16ff469542ed2077b523c4eeb2fd890a5aae8dc063fba7ef97c5a5a65fdfa5fddea5b8f650916719abcd83861e0
|
18
|
-
|
19
|
-
# Do not keep production secrets in the repository,
|
20
|
-
# instead read values from the environment.
|
21
|
-
production:
|
22
|
-
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
|
data/rails_example/config.ru
DELETED
data/rails_example/db/schema.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
# This file is auto-generated from the current state of the database. Instead
|
2
|
-
# of editing this file, please use the migrations feature of Active Record to
|
3
|
-
# incrementally modify your database, and then regenerate this schema definition.
|
4
|
-
#
|
5
|
-
# Note that this schema.rb definition is the authoritative source for your
|
6
|
-
# database schema. If you need to create the application database on another
|
7
|
-
# system, you should be using db:schema:load, not running all the migrations
|
8
|
-
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
9
|
-
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
10
|
-
#
|
11
|
-
# It's strongly recommended that you check this file into your version control system.
|
12
|
-
|
13
|
-
ActiveRecord::Schema.define(version: 20_160_724_111_322) do
|
14
|
-
# These are extensions that must be enabled in order to support this database
|
15
|
-
enable_extension 'plpgsql'
|
16
|
-
|
17
|
-
create_table 'posts', force: :cascade do |t|
|
18
|
-
t.string 'title'
|
19
|
-
t.text 'body'
|
20
|
-
t.string 'excerpt'
|
21
|
-
t.integer 'read_count'
|
22
|
-
t.datetime 'created_at', null: false
|
23
|
-
t.datetime 'updated_at', null: false
|
24
|
-
end
|
25
|
-
end
|
data/rails_example/db/seeds.rb
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
# This file should contain all the record creation needed to seed the database with its default values.
|
2
|
-
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
|
3
|
-
#
|
4
|
-
# Examples:
|
5
|
-
#
|
6
|
-
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
|
7
|
-
# Mayor.create(name: 'Emanuel', city: cities.first)
|
@@ -1,55 +0,0 @@
|
|
1
|
-
#! /bin/bash
|
2
|
-
|
3
|
-
# The Docker App Container's development entrypoint.
|
4
|
-
# This is a script used by the project's Docker development environment to
|
5
|
-
# setup the app containers and databases upon runnning.
|
6
|
-
set -e
|
7
|
-
|
8
|
-
: ${APP_PATH:="/usr/src/app"}
|
9
|
-
: ${APP_TEMP_PATH:="$APP_PATH/tmp"}
|
10
|
-
: ${APP_SETUP_LOCK:="$APP_TEMP_PATH/setup.lock"}
|
11
|
-
: ${APP_SETUP_WAIT:="5"}
|
12
|
-
|
13
|
-
# 1: Define the functions lock and unlock our app containers setup processes:
|
14
|
-
function lock_setup { mkdir -p $APP_TEMP_PATH && touch $APP_SETUP_LOCK; }
|
15
|
-
function unlock_setup { rm -rf $APP_SETUP_LOCK; }
|
16
|
-
function wait_setup { echo "Waiting for app setup to finish..."; sleep $APP_SETUP_WAIT; }
|
17
|
-
|
18
|
-
# 2: 'Unlock' the setup process if the script exits prematurely:
|
19
|
-
trap unlock_setup HUP INT QUIT KILL TERM EXIT
|
20
|
-
|
21
|
-
# 3: Wait until the setup 'lock' file no longer exists:
|
22
|
-
while [ -f $APP_SETUP_LOCK ]; do wait_setup; done
|
23
|
-
|
24
|
-
# 4: 'Lock' the setup process, to prevent a race condition when the project's
|
25
|
-
# app containers will try to install gems and setup the database concurrently:
|
26
|
-
lock_setup
|
27
|
-
|
28
|
-
# 5: Check or install the app dependencies via Bundler:
|
29
|
-
bundle check || bundle install --jobs 8 --retry 5
|
30
|
-
|
31
|
-
# 6: Check if the database exists, or setup the database if it doesn't, as it is
|
32
|
-
# the case when the project runs for the first time.
|
33
|
-
#
|
34
|
-
# We'll use a custom script `check-or-setup-db` (inside our app's `bin` folder),
|
35
|
-
# instead of running `rake db:version || rake db:setup`, as running that command
|
36
|
-
# (at least on rails 4.2.4) will leave a couple of small ruby zombie processes
|
37
|
-
# running in the container:
|
38
|
-
# check_or_setup_db
|
39
|
-
bin/rails db:version || bin/rails db:setup
|
40
|
-
bin/rails db:migrate
|
41
|
-
|
42
|
-
# 7: 'Unlock' the setup process:
|
43
|
-
unlock_setup
|
44
|
-
|
45
|
-
# 8: Specify a default command, in case it wasn't issued:
|
46
|
-
# if [ -z "$1" ]; then set -- rails server -p 3000 -b 0.0.0.0 "$@"; fi
|
47
|
-
|
48
|
-
# 9: If the command to execute is 'rails server', then force it to write the
|
49
|
-
# pid file into a non-shared container directory. Suddenly killing and removing
|
50
|
-
# app containers without this would leave a pidfile in the project's tmp dir,
|
51
|
-
# preventing the app container from starting up on further attempts:
|
52
|
-
# if [[ "$1" = "rails" && ("$2" = "s" || "$2" = "server") ]]; then set -- "$@" -P $PID_FILE; fi
|
53
|
-
|
54
|
-
# 10: Execute the given or default command:
|
55
|
-
exec "$@"
|
data/rails_example/dev.env
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
SECRET_KEY_BASE=10167c7f7654ed02b3557b05b88ece1866a9748a2e8e064016f76cb74ddae38264f7403ba65f301d63c21d770e0ee2ac6906f245e904b3b140d12297f67e0db1
|
2
|
-
APP_DOMAIN=localhost
|
3
|
-
APP_WEB_URL=http://localhost:3000
|
4
|
-
APP_CABLE_URL=ws://localhost:28080
|
5
|
-
WEB_CONSOLE_WHITELISTED_IPS=127.0.0.1 ::1 127.0.0.0/8 ::1
|
6
|
-
DB_HOST=postgres
|
7
|
-
DB_PORT=5432
|
8
|
-
DB_USERNAME=postgres
|
9
|
-
DB_PASSWORD=3x4mpl3
|
10
|
-
DB_POOL=25
|
11
|
-
DB_TIMEOUT=5000
|
12
|
-
DB_REAPING_FREQUENCY=10
|
@@ -1,27 +0,0 @@
|
|
1
|
-
FROM ruby:2.3
|
2
|
-
MAINTAINER Mika Hel <mikael@zoolutions.se>
|
3
|
-
|
4
|
-
# ENV BUILD_PACKAGES bash curl-dev ruby-dev build-base git libc-dev linux-headers
|
5
|
-
# ENV RUBY_PACKAGES ruby ruby-io-console openssl-dev postgresql-dev ruby-bundler libxml2-dev libxslt-dev
|
6
|
-
|
7
|
-
# RUN apk update \
|
8
|
-
# && apk upgrade \
|
9
|
-
# && apk add $BUILD_PACKAGES \
|
10
|
-
# && apk add $RUBY_PACKAGES \
|
11
|
-
# && rm -rf /var/cache/apk/* \
|
12
|
-
# && mkdir -p /usr/src/app \
|
13
|
-
# && bundle config --global jobs 8
|
14
|
-
|
15
|
-
# WORKDIR /usr/src/app
|
16
|
-
|
17
|
-
# COPY Gemfile /usr/src/app/
|
18
|
-
# COPY Gemfile.lock /usr/src/app/
|
19
|
-
|
20
|
-
# ENV BUNDLE_GEMFILE /usr/src/app/Gemfile
|
21
|
-
# ENV BUNDLE_JOBS 8
|
22
|
-
# ENV BUNDLE_RETRY 5
|
23
|
-
# ENV BUNDLE_PATH /usr/local/bundle
|
24
|
-
|
25
|
-
# RUN bundle install --jobs 8 --retry 5
|
26
|
-
|
27
|
-
# COPY . /usr/src/app
|
@@ -1,90 +0,0 @@
|
|
1
|
-
version: '2'
|
2
|
-
volumes:
|
3
|
-
postgres-data:
|
4
|
-
driver: local
|
5
|
-
redis-data:
|
6
|
-
driver: local
|
7
|
-
gems:
|
8
|
-
driver: local
|
9
|
-
|
10
|
-
networks:
|
11
|
-
front-tier:
|
12
|
-
driver: bridge
|
13
|
-
back-tier:
|
14
|
-
driver: bridge
|
15
|
-
|
16
|
-
services:
|
17
|
-
jobs: &app
|
18
|
-
extends:
|
19
|
-
file: common-services.yml
|
20
|
-
service: rails
|
21
|
-
entrypoint: /usr/src/app/dev-entrypoint.sh
|
22
|
-
command: bundle exec sidekiq -c 25
|
23
|
-
networks:
|
24
|
-
- back-tier
|
25
|
-
depends_on:
|
26
|
-
- postgres
|
27
|
-
- redis
|
28
|
-
|
29
|
-
web:
|
30
|
-
extends:
|
31
|
-
file: common-services.yml
|
32
|
-
service: rails
|
33
|
-
entrypoint: /usr/src/app/dev-entrypoint.sh
|
34
|
-
command: bundle exec puma --bind tcp://0.0.0.0:3000
|
35
|
-
ports:
|
36
|
-
- 3000:3000
|
37
|
-
networks:
|
38
|
-
- front-tier
|
39
|
-
- back-tier
|
40
|
-
depends_on:
|
41
|
-
- postgres
|
42
|
-
- redis
|
43
|
-
|
44
|
-
cable:
|
45
|
-
extends:
|
46
|
-
file: common-services.yml
|
47
|
-
service: rails
|
48
|
-
entrypoint: /usr/src/app/dev-entrypoint.sh
|
49
|
-
command: bundle exec puma --bind tcp://0.0.0.0:28080 cable.ru
|
50
|
-
ports:
|
51
|
-
- 28080:28080
|
52
|
-
networks:
|
53
|
-
- front-tier
|
54
|
-
- back-tier
|
55
|
-
depends_on:
|
56
|
-
- postgres
|
57
|
-
- redis
|
58
|
-
|
59
|
-
redis:
|
60
|
-
image: redis
|
61
|
-
ports:
|
62
|
-
# We'll bind our host's port 6379 to redis's port 6379, so we can use
|
63
|
-
# Redis Desktop Manager (or other tools) with it:
|
64
|
-
- 6379:6379
|
65
|
-
volumes:
|
66
|
-
# We'll store the redis data in the 'redis-data' volume we defined:
|
67
|
-
- redis-data:/var/lib/redis
|
68
|
-
command: redis-server --appendonly yes
|
69
|
-
# Make the redis service available only on the "back-tier" network:
|
70
|
-
# NOTE: See networks comment on the postgres service above.
|
71
|
-
networks: [ "back-tier" ]
|
72
|
-
|
73
|
-
|
74
|
-
postgres:
|
75
|
-
image: postgres
|
76
|
-
ports:
|
77
|
-
# We'll bind our host's port 5432 to postgres's port 5432, so we can use
|
78
|
-
# our database IDEs with it:
|
79
|
-
- 5432:5432
|
80
|
-
volumes:
|
81
|
-
# We'll store the postgres data in the 'postgres-data' volume we defined:
|
82
|
-
- postgres-data:/var/lib/postgresql/data
|
83
|
-
networks:
|
84
|
-
# Make the database service available only on the "back-tier" network:
|
85
|
-
# NOTE: Although the service is available only on the "back-tier" network,
|
86
|
-
# the host-to-container port binding we've defined for development
|
87
|
-
# purposes will allow connection from the development host.
|
88
|
-
- back-tier
|
89
|
-
environment:
|
90
|
-
POSTGRES_PASSWORD: 3x4mpl3
|
File without changes
|
File without changes
|
data/rails_example/log/.keep
DELETED
File without changes
|
@@ -1,67 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>The page you were looking for doesn't exist (404)</title>
|
5
|
-
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
-
<style>
|
7
|
-
body {
|
8
|
-
background-color: #EFEFEF;
|
9
|
-
color: #2E2F30;
|
10
|
-
text-align: center;
|
11
|
-
font-family: arial, sans-serif;
|
12
|
-
margin: 0;
|
13
|
-
}
|
14
|
-
|
15
|
-
div.dialog {
|
16
|
-
width: 95%;
|
17
|
-
max-width: 33em;
|
18
|
-
margin: 4em auto 0;
|
19
|
-
}
|
20
|
-
|
21
|
-
div.dialog > div {
|
22
|
-
border: 1px solid #CCC;
|
23
|
-
border-right-color: #999;
|
24
|
-
border-left-color: #999;
|
25
|
-
border-bottom-color: #BBB;
|
26
|
-
border-top: #B00100 solid 4px;
|
27
|
-
border-top-left-radius: 9px;
|
28
|
-
border-top-right-radius: 9px;
|
29
|
-
background-color: white;
|
30
|
-
padding: 7px 12% 0;
|
31
|
-
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
32
|
-
}
|
33
|
-
|
34
|
-
h1 {
|
35
|
-
font-size: 100%;
|
36
|
-
color: #730E15;
|
37
|
-
line-height: 1.5em;
|
38
|
-
}
|
39
|
-
|
40
|
-
div.dialog > p {
|
41
|
-
margin: 0 0 1em;
|
42
|
-
padding: 1em;
|
43
|
-
background-color: #F7F7F7;
|
44
|
-
border: 1px solid #CCC;
|
45
|
-
border-right-color: #999;
|
46
|
-
border-left-color: #999;
|
47
|
-
border-bottom-color: #999;
|
48
|
-
border-bottom-left-radius: 4px;
|
49
|
-
border-bottom-right-radius: 4px;
|
50
|
-
border-top-color: #DADADA;
|
51
|
-
color: #666;
|
52
|
-
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
53
|
-
}
|
54
|
-
</style>
|
55
|
-
</head>
|
56
|
-
|
57
|
-
<body>
|
58
|
-
<!-- This file lives in public/404.html -->
|
59
|
-
<div class="dialog">
|
60
|
-
<div>
|
61
|
-
<h1>The page you were looking for doesn't exist.</h1>
|
62
|
-
<p>You may have mistyped the address or the page may have moved.</p>
|
63
|
-
</div>
|
64
|
-
<p>If you are the application owner check the logs for more information.</p>
|
65
|
-
</div>
|
66
|
-
</body>
|
67
|
-
</html>
|
@@ -1,67 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>The change you wanted was rejected (422)</title>
|
5
|
-
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
-
<style>
|
7
|
-
body {
|
8
|
-
background-color: #EFEFEF;
|
9
|
-
color: #2E2F30;
|
10
|
-
text-align: center;
|
11
|
-
font-family: arial, sans-serif;
|
12
|
-
margin: 0;
|
13
|
-
}
|
14
|
-
|
15
|
-
div.dialog {
|
16
|
-
width: 95%;
|
17
|
-
max-width: 33em;
|
18
|
-
margin: 4em auto 0;
|
19
|
-
}
|
20
|
-
|
21
|
-
div.dialog > div {
|
22
|
-
border: 1px solid #CCC;
|
23
|
-
border-right-color: #999;
|
24
|
-
border-left-color: #999;
|
25
|
-
border-bottom-color: #BBB;
|
26
|
-
border-top: #B00100 solid 4px;
|
27
|
-
border-top-left-radius: 9px;
|
28
|
-
border-top-right-radius: 9px;
|
29
|
-
background-color: white;
|
30
|
-
padding: 7px 12% 0;
|
31
|
-
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
32
|
-
}
|
33
|
-
|
34
|
-
h1 {
|
35
|
-
font-size: 100%;
|
36
|
-
color: #730E15;
|
37
|
-
line-height: 1.5em;
|
38
|
-
}
|
39
|
-
|
40
|
-
div.dialog > p {
|
41
|
-
margin: 0 0 1em;
|
42
|
-
padding: 1em;
|
43
|
-
background-color: #F7F7F7;
|
44
|
-
border: 1px solid #CCC;
|
45
|
-
border-right-color: #999;
|
46
|
-
border-left-color: #999;
|
47
|
-
border-bottom-color: #999;
|
48
|
-
border-bottom-left-radius: 4px;
|
49
|
-
border-bottom-right-radius: 4px;
|
50
|
-
border-top-color: #DADADA;
|
51
|
-
color: #666;
|
52
|
-
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
53
|
-
}
|
54
|
-
</style>
|
55
|
-
</head>
|
56
|
-
|
57
|
-
<body>
|
58
|
-
<!-- This file lives in public/422.html -->
|
59
|
-
<div class="dialog">
|
60
|
-
<div>
|
61
|
-
<h1>The change you wanted was rejected.</h1>
|
62
|
-
<p>Maybe you tried to change something you didn't have access to.</p>
|
63
|
-
</div>
|
64
|
-
<p>If you are the application owner check the logs for more information.</p>
|
65
|
-
</div>
|
66
|
-
</body>
|
67
|
-
</html>
|
@@ -1,66 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>We're sorry, but something went wrong (500)</title>
|
5
|
-
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
-
<style>
|
7
|
-
body {
|
8
|
-
background-color: #EFEFEF;
|
9
|
-
color: #2E2F30;
|
10
|
-
text-align: center;
|
11
|
-
font-family: arial, sans-serif;
|
12
|
-
margin: 0;
|
13
|
-
}
|
14
|
-
|
15
|
-
div.dialog {
|
16
|
-
width: 95%;
|
17
|
-
max-width: 33em;
|
18
|
-
margin: 4em auto 0;
|
19
|
-
}
|
20
|
-
|
21
|
-
div.dialog > div {
|
22
|
-
border: 1px solid #CCC;
|
23
|
-
border-right-color: #999;
|
24
|
-
border-left-color: #999;
|
25
|
-
border-bottom-color: #BBB;
|
26
|
-
border-top: #B00100 solid 4px;
|
27
|
-
border-top-left-radius: 9px;
|
28
|
-
border-top-right-radius: 9px;
|
29
|
-
background-color: white;
|
30
|
-
padding: 7px 12% 0;
|
31
|
-
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
32
|
-
}
|
33
|
-
|
34
|
-
h1 {
|
35
|
-
font-size: 100%;
|
36
|
-
color: #730E15;
|
37
|
-
line-height: 1.5em;
|
38
|
-
}
|
39
|
-
|
40
|
-
div.dialog > p {
|
41
|
-
margin: 0 0 1em;
|
42
|
-
padding: 1em;
|
43
|
-
background-color: #F7F7F7;
|
44
|
-
border: 1px solid #CCC;
|
45
|
-
border-right-color: #999;
|
46
|
-
border-left-color: #999;
|
47
|
-
border-bottom-color: #999;
|
48
|
-
border-bottom-left-radius: 4px;
|
49
|
-
border-bottom-right-radius: 4px;
|
50
|
-
border-top-color: #DADADA;
|
51
|
-
color: #666;
|
52
|
-
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
53
|
-
}
|
54
|
-
</style>
|
55
|
-
</head>
|
56
|
-
|
57
|
-
<body>
|
58
|
-
<!-- This file lives in public/500.html -->
|
59
|
-
<div class="dialog">
|
60
|
-
<div>
|
61
|
-
<h1>We're sorry, but something went wrong.</h1>
|
62
|
-
</div>
|
63
|
-
<p>If you are the application owner check the logs for more information.</p>
|
64
|
-
</div>
|
65
|
-
</body>
|
66
|
-
</html>
|
File without changes
|
data/rails_example/simple.ru
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
# Easiest way to run Sidekiq::Web.
|
2
|
-
# Run with "bundle exec rackup simple.ru"
|
3
|
-
|
4
|
-
require 'sidekiq'
|
5
|
-
|
6
|
-
# A Web process always runs as client, no need to configure server
|
7
|
-
Sidekiq.configure_client do |config|
|
8
|
-
config.redis = { url: 'redis://localhost:6379/0', size: 1, namespace: 'foo' }
|
9
|
-
end
|
10
|
-
|
11
|
-
require 'sidekiq/web'
|
12
|
-
run Sidekiq::Web
|