fiver 0.0alpha

Sign up to get free protection for your applications and to get access to all the features.
Files changed (105) hide show
  1. checksums.yaml +7 -0
  2. data/.browserslistrc +1 -0
  3. data/.gitignore +57 -0
  4. data/.orchestration.yml +4 -0
  5. data/.rspec +3 -0
  6. data/.rspec_status +18 -0
  7. data/.rubocop.yml +10 -0
  8. data/.ruby-version +1 -0
  9. data/.travis.yml +6 -0
  10. data/Gemfile +36 -0
  11. data/Gemfile.lock +292 -0
  12. data/LICENSE +7 -0
  13. data/LICENSE.txt +21 -0
  14. data/Makefile +27 -0
  15. data/README.md +11 -0
  16. data/Rakefile +8 -0
  17. data/app/assets/config/manifest.js +2 -0
  18. data/app/assets/images/.keep +0 -0
  19. data/app/assets/stylesheets/application.css +15 -0
  20. data/app/channels/application_cable/channel.rb +6 -0
  21. data/app/channels/application_cable/connection.rb +6 -0
  22. data/app/controllers/application_controller.rb +4 -0
  23. data/app/controllers/concerns/.keep +0 -0
  24. data/app/helpers/application_helper.rb +5 -0
  25. data/app/javascript/channels/consumer.js +6 -0
  26. data/app/javascript/channels/index.js +5 -0
  27. data/app/javascript/packs/application.js +17 -0
  28. data/app/javascript/packs/hello_react.jsx +26 -0
  29. data/app/jobs/application_job.rb +9 -0
  30. data/app/mailers/application_mailer.rb +6 -0
  31. data/app/models/application_record.rb +6 -0
  32. data/app/models/concerns/.keep +0 -0
  33. data/app/views/layouts/application.html.erb +15 -0
  34. data/app/views/layouts/mailer.html.erb +13 -0
  35. data/app/views/layouts/mailer.text.erb +1 -0
  36. data/babel.config.js +87 -0
  37. data/bin/bundle +114 -0
  38. data/bin/console +14 -0
  39. data/bin/rails +9 -0
  40. data/bin/rake +9 -0
  41. data/bin/setup +8 -0
  42. data/bin/spring +17 -0
  43. data/bin/webpack +18 -0
  44. data/bin/webpack-dev-server +18 -0
  45. data/bin/yarn +11 -0
  46. data/config.ru +7 -0
  47. data/config/application.rb +18 -0
  48. data/config/boot.rb +6 -0
  49. data/config/cable.yml +10 -0
  50. data/config/credentials.yml.enc +1 -0
  51. data/config/database.yml +25 -0
  52. data/config/environment.rb +7 -0
  53. data/config/environments/development.rb +64 -0
  54. data/config/environments/production.rb +114 -0
  55. data/config/environments/test.rb +52 -0
  56. data/config/initializers/application_controller_renderer.rb +9 -0
  57. data/config/initializers/assets.rb +16 -0
  58. data/config/initializers/backtrace_silencers.rb +8 -0
  59. data/config/initializers/content_security_policy.rb +31 -0
  60. data/config/initializers/cookies_serializer.rb +7 -0
  61. data/config/initializers/filter_parameter_logging.rb +6 -0
  62. data/config/initializers/inflections.rb +17 -0
  63. data/config/initializers/mime_types.rb +5 -0
  64. data/config/initializers/wrap_parameters.rb +16 -0
  65. data/config/locales/en.yml +33 -0
  66. data/config/puma.rb +40 -0
  67. data/config/rabbitmq.yml +8 -0
  68. data/config/routes.rb +5 -0
  69. data/config/spring.rb +8 -0
  70. data/config/storage.yml +34 -0
  71. data/config/unicorn.rb +19 -0
  72. data/config/webpack/development.js +5 -0
  73. data/config/webpack/environment.js +3 -0
  74. data/config/webpack/production.js +5 -0
  75. data/config/webpack/test.js +5 -0
  76. data/config/webpacker.yml +97 -0
  77. data/db/schema.rb +15 -0
  78. data/db/seeds.rb +8 -0
  79. data/fiver.gemspec +26 -0
  80. data/lib/assets/.keep +0 -0
  81. data/lib/fiver.rb +12 -0
  82. data/lib/fiver/version.rb +5 -0
  83. data/lib/tasks/.keep +0 -0
  84. data/log/.keep +0 -0
  85. data/orchestration/Dockerfile +34 -0
  86. data/orchestration/Makefile +511 -0
  87. data/orchestration/docker-compose.development.yml +14 -0
  88. data/orchestration/docker-compose.production.yml +33 -0
  89. data/orchestration/docker-compose.test.yml +14 -0
  90. data/orchestration/entrypoint.sh +17 -0
  91. data/package.json +20 -0
  92. data/postcss.config.js +12 -0
  93. data/public/404.html +67 -0
  94. data/public/422.html +67 -0
  95. data/public/500.html +66 -0
  96. data/public/apple-touch-icon-precomposed.png +0 -0
  97. data/public/apple-touch-icon.png +0 -0
  98. data/public/favicon.ico +0 -0
  99. data/public/robots.txt +1 -0
  100. data/storage/.keep +0 -0
  101. data/tmp/.keep +0 -0
  102. data/tmp/pids/.keep +0 -0
  103. data/vendor/.keep +0 -0
  104. data/yarn.lock +7696 -0
  105. metadata +148 -0
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Be sure to restart your server when you modify this file.
4
+
5
+ # Version of your assets, change this if you want to expire all your assets.
6
+ Rails.application.config.assets.version = '1.0'
7
+
8
+ # Add additional assets to the asset load path.
9
+ # Rails.application.config.assets.paths << Emoji.images_path
10
+ # Add Yarn node_modules folder to the asset load path.
11
+ Rails.application.config.assets.paths << Rails.root.join('node_modules')
12
+
13
+ # Precompile additional assets.
14
+ # application.js, application.css, and all non-JS/CSS in the app/assets
15
+ # folder are already added.
16
+ # Rails.application.config.assets.precompile += %w( admin.js admin.css )
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+ # Be sure to restart your server when you modify this file.
3
+
4
+ # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
5
+ # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
6
+
7
+ # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
8
+ # Rails.backtrace_cleaner.remove_silencers!
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+ # Be sure to restart your server when you modify this file.
3
+
4
+ # Define an application-wide content security policy
5
+ # For further information see the following documentation
6
+ # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
7
+
8
+ # Rails.application.config.content_security_policy do |policy|
9
+ # policy.default_src :self, :https
10
+ # policy.font_src :self, :https, :data
11
+ # policy.img_src :self, :https, :data
12
+ # policy.object_src :none
13
+ # policy.script_src :self, :https
14
+ # policy.style_src :self, :https
15
+ # # If you are using webpack-dev-server then specify webpack-dev-server host
16
+ # policy.connect_src :self, :https, "http://localhost:3035", "ws://localhost:3035" if Rails.env.development?
17
+
18
+ # # Specify URI for violation reports
19
+ # # policy.report_uri "/csp-violation-report-endpoint"
20
+ # end
21
+
22
+ # If you are using UJS then enable automatic nonce generation
23
+ # Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) }
24
+
25
+ # Set the nonce only to specific directives
26
+ # Rails.application.config.content_security_policy_nonce_directives = %w(script-src)
27
+
28
+ # Report CSP violations to a specified URI
29
+ # For further information see the following documentation:
30
+ # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only
31
+ # Rails.application.config.content_security_policy_report_only = true
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Be sure to restart your server when you modify this file.
4
+
5
+ # Specify a serializer for the signed and encrypted cookie jars.
6
+ # Valid options are :json, :marshal, and :hybrid.
7
+ Rails.application.config.action_dispatch.cookies_serializer = :json
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Be sure to restart your server when you modify this file.
4
+
5
+ # Configure sensitive parameters which will be filtered from the log file.
6
+ Rails.application.config.filter_parameters += [:password]
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+ # Be sure to restart your server when you modify this file.
3
+
4
+ # Add new inflection rules using the following format. Inflections
5
+ # are locale specific, and you may define rules for as many different
6
+ # locales as you wish. All of these examples are active by default:
7
+ # ActiveSupport::Inflector.inflections(:en) do |inflect|
8
+ # inflect.plural /^(ox)$/i, '\1en'
9
+ # inflect.singular /^(ox)en/i, '\1'
10
+ # inflect.irregular 'person', 'people'
11
+ # inflect.uncountable %w( fish sheep )
12
+ # end
13
+
14
+ # These inflection rules are supported but not enabled by default:
15
+ # ActiveSupport::Inflector.inflections(:en) do |inflect|
16
+ # inflect.acronym 'RESTful'
17
+ # end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+ # Be sure to restart your server when you modify this file.
3
+
4
+ # Add new mime types for use in respond_to blocks:
5
+ # Mime::Type.register "text/richtext", :rtf
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Be sure to restart your server when you modify this file.
4
+
5
+ # This file contains settings for ActionController::ParamsWrapper which
6
+ # is enabled by default.
7
+
8
+ # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
9
+ ActiveSupport.on_load(:action_controller) do
10
+ wrap_parameters format: [:json]
11
+ end
12
+
13
+ # To enable root element in JSON for ActiveRecord objects.
14
+ # ActiveSupport.on_load(:active_record) do
15
+ # self.include_root_in_json = true
16
+ # end
@@ -0,0 +1,33 @@
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
+ # The following keys must be escaped otherwise they will not be retrieved by
20
+ # the default I18n backend:
21
+ #
22
+ # true, false, on, off, yes, no
23
+ #
24
+ # Instead, surround them with single quotes.
25
+ #
26
+ # en:
27
+ # 'true': 'foo'
28
+ #
29
+ # To learn more, please read the Rails Internationalization guide
30
+ # available at https://guides.rubyonrails.org/i18n.html.
31
+
32
+ en:
33
+ hello: "Hello world"
data/config/puma.rb ADDED
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Puma can serve each request in a thread from an internal thread pool.
4
+ # The `threads` method setting takes two numbers: a minimum and maximum.
5
+ # Any libraries that use thread pools should be configured to match
6
+ # the maximum value specified for Puma. Default is set to 5 threads for minimum
7
+ # and maximum; this matches the default thread size of Active Record.
8
+ #
9
+ max_threads_count = ENV.fetch('RAILS_MAX_THREADS', 5)
10
+ min_threads_count = ENV.fetch('RAILS_MIN_THREADS') { max_threads_count }
11
+ threads min_threads_count, max_threads_count
12
+
13
+ # Specifies the `port` that Puma will listen on to receive requests; default is 3000.
14
+ #
15
+ port ENV.fetch('PORT', 3000)
16
+
17
+ # Specifies the `environment` that Puma will run in.
18
+ #
19
+ environment ENV.fetch('RAILS_ENV', 'development')
20
+
21
+ # Specifies the `pidfile` that Puma will use.
22
+ pidfile ENV.fetch('PIDFILE', 'tmp/pids/server.pid')
23
+
24
+ # Specifies the number of `workers` to boot in clustered mode.
25
+ # Workers are forked web server processes. If using threads and workers together
26
+ # the concurrency of the application would be max `threads` * `workers`.
27
+ # Workers do not work on JRuby or Windows (both of which do not support
28
+ # processes).
29
+ #
30
+ # workers ENV.fetch("WEB_CONCURRENCY") { 2 }
31
+
32
+ # Use the `preload_app!` method when specifying a `workers` number.
33
+ # This directive tells Puma to first boot the application and load code
34
+ # before forking the application. This takes advantage of Copy On Write
35
+ # process behavior so workers use less memory.
36
+ #
37
+ # preload_app!
38
+
39
+ # Allow puma to be restarted by `rails restart` command.
40
+ plugin :tmp_restart
@@ -0,0 +1,8 @@
1
+ development:
2
+ url: <%= ENV.fetch('RABBITMQ_URL', 'amqp://127.0.0.1:50489') %>
3
+
4
+ test:
5
+ url: <%= ENV.fetch('RABBITMQ_URL', 'amqp://127.0.0.1:50488') %>
6
+
7
+ production:
8
+ url: <%= ENV['RABBITMQ_URL'] %>
data/config/routes.rb ADDED
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ Rails.application.routes.draw do
4
+ # For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html
5
+ end
data/config/spring.rb ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ Spring.watch(
4
+ '.ruby-version',
5
+ '.rbenv-vars',
6
+ 'tmp/restart.txt',
7
+ 'tmp/caching-dev.txt'
8
+ )
@@ -0,0 +1,34 @@
1
+ test:
2
+ service: Disk
3
+ root: <%= Rails.root.join("tmp/storage") %>
4
+
5
+ local:
6
+ service: Disk
7
+ root: <%= Rails.root.join("storage") %>
8
+
9
+ # Use rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key)
10
+ # amazon:
11
+ # service: S3
12
+ # access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %>
13
+ # secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %>
14
+ # region: us-east-1
15
+ # bucket: your_own_bucket
16
+
17
+ # Remember not to checkin your GCS keyfile to a repository
18
+ # google:
19
+ # service: GCS
20
+ # project: your_project
21
+ # credentials: <%= Rails.root.join("path/to/gcs.keyfile") %>
22
+ # bucket: your_own_bucket
23
+
24
+ # Use rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key)
25
+ # microsoft:
26
+ # service: AzureStorage
27
+ # storage_account_name: your_account_name
28
+ # storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %>
29
+ # container: your_container_name
30
+
31
+ # mirror:
32
+ # service: Mirror
33
+ # primary: local
34
+ # mirrors: [ amazon, google, microsoft ]
data/config/unicorn.rb ADDED
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ listen "0.0.0.0:#{ENV.fetch('WEB_PORT', '8080')}", tcp_nopush: true
4
+
5
+ pid '/app/tmp/pids/server.pid'
6
+
7
+ preload_app ENV.key?('WEB_PRELOAD_APP')
8
+
9
+ timeout ENV.fetch('WEB_TIMEOUT', 60).to_i
10
+
11
+ worker_processes ENV.fetch('WEB_CONCURRENCY', 8).to_i
12
+
13
+ before_fork do |_server, _worker|
14
+ ActiveRecord::Base.connection.disconnect! if defined?(ActiveRecord)
15
+ end
16
+
17
+ after_fork do |_server, _worker|
18
+ ActiveRecord::Base.establish_connection if defined?(ActiveRecord)
19
+ end
@@ -0,0 +1,5 @@
1
+ process.env.NODE_ENV = process.env.NODE_ENV || 'development'
2
+
3
+ const environment = require('./environment')
4
+
5
+ module.exports = environment.toWebpackConfig()
@@ -0,0 +1,3 @@
1
+ const { environment } = require('@rails/webpacker')
2
+
3
+ module.exports = environment
@@ -0,0 +1,5 @@
1
+ process.env.NODE_ENV = process.env.NODE_ENV || 'production'
2
+
3
+ const environment = require('./environment')
4
+
5
+ module.exports = environment.toWebpackConfig()
@@ -0,0 +1,5 @@
1
+ process.env.NODE_ENV = process.env.NODE_ENV || 'development'
2
+
3
+ const environment = require('./environment')
4
+
5
+ module.exports = environment.toWebpackConfig()
@@ -0,0 +1,97 @@
1
+ # Note: You must restart bin/webpack-dev-server for changes to take effect
2
+
3
+ default: &default
4
+ source_path: app/javascript
5
+ source_entry_path: packs
6
+ public_root_path: public
7
+ public_output_path: packs
8
+ cache_path: tmp/cache/webpacker
9
+ check_yarn_integrity: false
10
+ webpack_compile_output: true
11
+
12
+ # Additional paths webpack should lookup modules
13
+ # ['app/assets', 'engine/foo/app/assets']
14
+ resolved_paths: []
15
+
16
+ # Reload manifest.json on all requests so we reload latest compiled packs
17
+ cache_manifest: false
18
+
19
+ # Extract and emit a css file
20
+ extract_css: false
21
+
22
+ static_assets_extensions:
23
+ - .jpg
24
+ - .jpeg
25
+ - .png
26
+ - .gif
27
+ - .tiff
28
+ - .ico
29
+ - .svg
30
+ - .eot
31
+ - .otf
32
+ - .ttf
33
+ - .woff
34
+ - .woff2
35
+
36
+ extensions:
37
+ - .jsx
38
+ - .mjs
39
+ - .js
40
+ - .sass
41
+ - .scss
42
+ - .css
43
+ - .module.sass
44
+ - .module.scss
45
+ - .module.css
46
+ - .png
47
+ - .svg
48
+ - .gif
49
+ - .jpeg
50
+ - .jpg
51
+
52
+ development:
53
+ <<: *default
54
+ compile: true
55
+
56
+ # Verifies that correct packages and versions are installed by inspecting package.json, yarn.lock, and node_modules
57
+ check_yarn_integrity: true
58
+
59
+ # Reference: https://webpack.js.org/configuration/dev-server/
60
+ dev_server:
61
+ https: false
62
+ host: localhost
63
+ port: 3035
64
+ public: localhost:3035
65
+ hmr: false
66
+ # Inline should be set to true if using HMR
67
+ inline: true
68
+ overlay: true
69
+ compress: true
70
+ disable_host_check: true
71
+ use_local_ip: false
72
+ quiet: false
73
+ pretty: false
74
+ headers:
75
+ 'Access-Control-Allow-Origin': '*'
76
+ watch_options:
77
+ ignored: '**/node_modules/**'
78
+
79
+
80
+ test:
81
+ <<: *default
82
+ compile: true
83
+
84
+ # Compile test packs to a separate directory
85
+ public_output_path: packs-test
86
+
87
+ production:
88
+ <<: *default
89
+
90
+ # Production depends on precompilation of packs prior to booting for performance.
91
+ compile: false
92
+
93
+ # Extract and emit a css file
94
+ extract_css: true
95
+
96
+ # Cache manifest.json for performance
97
+ cache_manifest: true
data/db/schema.rb ADDED
@@ -0,0 +1,15 @@
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
+ # This file is the source Rails uses to define your schema when running `rails
6
+ # db:schema:load`. When creating a new database, `rails db:schema:load` tends to
7
+ # be faster and is potentially less error prone than running all of your
8
+ # migrations from scratch. Old migrations may fail to apply correctly if those
9
+ # migrations use external dependencies or application code.
10
+ #
11
+ # It's strongly recommended that you check this file into your version control system.
12
+
13
+ ActiveRecord::Schema.define(version: 0) do
14
+
15
+ end
data/db/seeds.rb ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+ # This file should contain all the record creation needed to seed the database with its default values.
3
+ # The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup).
4
+ #
5
+ # Examples:
6
+ #
7
+ # movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
8
+ # Character.create(name: 'Luke', movie: movies.first)
data/fiver.gemspec ADDED
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'lib/fiver/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'fiver'
7
+ spec.version = Fiver::VERSION
8
+ spec.authors = ['Bob Farrell']
9
+ spec.email = ['git@bob.frl']
10
+
11
+ spec.summary = 'Sneakers/ActiveJob/RabbitMQ dashboard'
12
+ spec.description = 'Monitor and manage jobs in a live Sneakers/ActiveJob queue system'
13
+ spec.homepage = 'https://github.com/bobf/fiver'
14
+ spec.license = 'MIT'
15
+ spec.required_ruby_version = Gem::Requirement.new('>= 2.7.0')
16
+
17
+ spec.metadata['homepage_uri'] = spec.homepage
18
+ spec.metadata['source_code_uri'] = spec.homepage
19
+
20
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
21
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
22
+ end
23
+ spec.bindir = 'bin'
24
+ spec.executables = []
25
+ spec.require_paths = ['lib']
26
+ end