big_session 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (186) hide show
  1. checksums.yaml +7 -0
  2. data/.circleci/config.yml +32 -0
  3. data/.rubocop.yml +10 -0
  4. data/Gemfile +8 -0
  5. data/LICENSE.txt +21 -0
  6. data/README.md +60 -0
  7. data/Rakefile +8 -0
  8. data/big_session.gemspec +44 -0
  9. data/bin/console +14 -0
  10. data/bin/setup +8 -0
  11. data/examples/landing_page_app_and_core_app/README.md +3 -0
  12. data/examples/landing_page_app_and_core_app/app_core/.ruby-version +1 -0
  13. data/examples/landing_page_app_and_core_app/app_core/Dockerfile +22 -0
  14. data/examples/landing_page_app_and_core_app/app_core/Gemfile +66 -0
  15. data/examples/landing_page_app_and_core_app/app_core/Gemfile.lock +236 -0
  16. data/examples/landing_page_app_and_core_app/app_core/README.md +24 -0
  17. data/examples/landing_page_app_and_core_app/app_core/Rakefile +6 -0
  18. data/examples/landing_page_app_and_core_app/app_core/app/assets/config/manifest.js +3 -0
  19. data/examples/landing_page_app_and_core_app/app_core/app/assets/images/.keep +0 -0
  20. data/examples/landing_page_app_and_core_app/app_core/app/assets/javascripts/application.js +16 -0
  21. data/examples/landing_page_app_and_core_app/app_core/app/assets/javascripts/cable.js +13 -0
  22. data/examples/landing_page_app_and_core_app/app_core/app/assets/javascripts/channels/.keep +0 -0
  23. data/examples/landing_page_app_and_core_app/app_core/app/assets/stylesheets/application.css +15 -0
  24. data/examples/landing_page_app_and_core_app/app_core/app/channels/application_cable/channel.rb +4 -0
  25. data/examples/landing_page_app_and_core_app/app_core/app/channels/application_cable/connection.rb +4 -0
  26. data/examples/landing_page_app_and_core_app/app_core/app/controllers/application_controller.rb +12 -0
  27. data/examples/landing_page_app_and_core_app/app_core/app/controllers/concerns/.keep +0 -0
  28. data/examples/landing_page_app_and_core_app/app_core/app/controllers/conversions_controller.rb +8 -0
  29. data/examples/landing_page_app_and_core_app/app_core/app/helpers/application_helper.rb +2 -0
  30. data/examples/landing_page_app_and_core_app/app_core/app/jobs/application_job.rb +2 -0
  31. data/examples/landing_page_app_and_core_app/app_core/app/mailers/application_mailer.rb +4 -0
  32. data/examples/landing_page_app_and_core_app/app_core/app/models/application_record.rb +3 -0
  33. data/examples/landing_page_app_and_core_app/app_core/app/models/concerns/.keep +0 -0
  34. data/examples/landing_page_app_and_core_app/app_core/app/views/layouts/application.html.erb +15 -0
  35. data/examples/landing_page_app_and_core_app/app_core/app/views/layouts/mailer.html.erb +13 -0
  36. data/examples/landing_page_app_and_core_app/app_core/app/views/layouts/mailer.text.erb +1 -0
  37. data/examples/landing_page_app_and_core_app/app_core/bin/bundle +3 -0
  38. data/examples/landing_page_app_and_core_app/app_core/bin/rails +9 -0
  39. data/examples/landing_page_app_and_core_app/app_core/bin/rake +9 -0
  40. data/examples/landing_page_app_and_core_app/app_core/bin/setup +36 -0
  41. data/examples/landing_page_app_and_core_app/app_core/bin/spring +17 -0
  42. data/examples/landing_page_app_and_core_app/app_core/bin/update +31 -0
  43. data/examples/landing_page_app_and_core_app/app_core/bin/yarn +11 -0
  44. data/examples/landing_page_app_and_core_app/app_core/config.ru +5 -0
  45. data/examples/landing_page_app_and_core_app/app_core/config/application.rb +19 -0
  46. data/examples/landing_page_app_and_core_app/app_core/config/boot.rb +4 -0
  47. data/examples/landing_page_app_and_core_app/app_core/config/cable.yml +10 -0
  48. data/examples/landing_page_app_and_core_app/app_core/config/credentials.yml.enc +1 -0
  49. data/examples/landing_page_app_and_core_app/app_core/config/database.yml +88 -0
  50. data/examples/landing_page_app_and_core_app/app_core/config/environment.rb +5 -0
  51. data/examples/landing_page_app_and_core_app/app_core/config/environments/development.rb +78 -0
  52. data/examples/landing_page_app_and_core_app/app_core/config/environments/production.rb +94 -0
  53. data/examples/landing_page_app_and_core_app/app_core/config/environments/test.rb +46 -0
  54. data/examples/landing_page_app_and_core_app/app_core/config/initializers/application_controller_renderer.rb +8 -0
  55. data/examples/landing_page_app_and_core_app/app_core/config/initializers/assets.rb +14 -0
  56. data/examples/landing_page_app_and_core_app/app_core/config/initializers/backtrace_silencers.rb +7 -0
  57. data/examples/landing_page_app_and_core_app/app_core/config/initializers/big_session.rb +7 -0
  58. data/examples/landing_page_app_and_core_app/app_core/config/initializers/content_security_policy.rb +25 -0
  59. data/examples/landing_page_app_and_core_app/app_core/config/initializers/cookies_serializer.rb +5 -0
  60. data/examples/landing_page_app_and_core_app/app_core/config/initializers/filter_parameter_logging.rb +4 -0
  61. data/examples/landing_page_app_and_core_app/app_core/config/initializers/inflections.rb +16 -0
  62. data/examples/landing_page_app_and_core_app/app_core/config/initializers/mime_types.rb +4 -0
  63. data/examples/landing_page_app_and_core_app/app_core/config/initializers/wrap_parameters.rb +14 -0
  64. data/examples/landing_page_app_and_core_app/app_core/config/locales/en.yml +33 -0
  65. data/examples/landing_page_app_and_core_app/app_core/config/puma.rb +34 -0
  66. data/examples/landing_page_app_and_core_app/app_core/config/routes.rb +4 -0
  67. data/examples/landing_page_app_and_core_app/app_core/config/spring.rb +6 -0
  68. data/examples/landing_page_app_and_core_app/app_core/config/storage.yml +34 -0
  69. data/examples/landing_page_app_and_core_app/app_core/db/seeds.rb +7 -0
  70. data/examples/landing_page_app_and_core_app/app_core/entrypoint.sh +8 -0
  71. data/examples/landing_page_app_and_core_app/app_core/lib/assets/.keep +0 -0
  72. data/examples/landing_page_app_and_core_app/app_core/lib/tasks/.keep +0 -0
  73. data/examples/landing_page_app_and_core_app/app_core/log/.keep +0 -0
  74. data/examples/landing_page_app_and_core_app/app_core/package.json +5 -0
  75. data/examples/landing_page_app_and_core_app/app_core/public/404.html +67 -0
  76. data/examples/landing_page_app_and_core_app/app_core/public/422.html +67 -0
  77. data/examples/landing_page_app_and_core_app/app_core/public/500.html +66 -0
  78. data/examples/landing_page_app_and_core_app/app_core/public/apple-touch-icon-precomposed.png +0 -0
  79. data/examples/landing_page_app_and_core_app/app_core/public/apple-touch-icon.png +0 -0
  80. data/examples/landing_page_app_and_core_app/app_core/public/favicon.ico +0 -0
  81. data/examples/landing_page_app_and_core_app/app_core/public/robots.txt +1 -0
  82. data/examples/landing_page_app_and_core_app/app_core/storage/.keep +0 -0
  83. data/examples/landing_page_app_and_core_app/app_core/test/application_system_test_case.rb +5 -0
  84. data/examples/landing_page_app_and_core_app/app_core/test/controllers/.keep +0 -0
  85. data/examples/landing_page_app_and_core_app/app_core/test/fixtures/.keep +0 -0
  86. data/examples/landing_page_app_and_core_app/app_core/test/fixtures/files/.keep +0 -0
  87. data/examples/landing_page_app_and_core_app/app_core/test/helpers/.keep +0 -0
  88. data/examples/landing_page_app_and_core_app/app_core/test/integration/.keep +0 -0
  89. data/examples/landing_page_app_and_core_app/app_core/test/mailers/.keep +0 -0
  90. data/examples/landing_page_app_and_core_app/app_core/test/models/.keep +0 -0
  91. data/examples/landing_page_app_and_core_app/app_core/test/system/.keep +0 -0
  92. data/examples/landing_page_app_and_core_app/app_core/test/test_helper.rb +10 -0
  93. data/examples/landing_page_app_and_core_app/app_core/tmp/.keep +0 -0
  94. data/examples/landing_page_app_and_core_app/app_core/vendor/.keep +0 -0
  95. data/examples/landing_page_app_and_core_app/app_lp/.ruby-version +1 -0
  96. data/examples/landing_page_app_and_core_app/app_lp/Dockerfile +22 -0
  97. data/examples/landing_page_app_and_core_app/app_lp/Gemfile +66 -0
  98. data/examples/landing_page_app_and_core_app/app_lp/Gemfile.lock +256 -0
  99. data/examples/landing_page_app_and_core_app/app_lp/README.md +24 -0
  100. data/examples/landing_page_app_and_core_app/app_lp/Rakefile +6 -0
  101. data/examples/landing_page_app_and_core_app/app_lp/app/assets/config/manifest.js +3 -0
  102. data/examples/landing_page_app_and_core_app/app_lp/app/assets/images/.keep +0 -0
  103. data/examples/landing_page_app_and_core_app/app_lp/app/assets/javascripts/application.js +16 -0
  104. data/examples/landing_page_app_and_core_app/app_lp/app/assets/javascripts/cable.js +13 -0
  105. data/examples/landing_page_app_and_core_app/app_lp/app/assets/javascripts/channels/.keep +0 -0
  106. data/examples/landing_page_app_and_core_app/app_lp/app/assets/stylesheets/application.css +15 -0
  107. data/examples/landing_page_app_and_core_app/app_lp/app/channels/application_cable/channel.rb +4 -0
  108. data/examples/landing_page_app_and_core_app/app_lp/app/channels/application_cable/connection.rb +4 -0
  109. data/examples/landing_page_app_and_core_app/app_lp/app/controllers/application_controller.rb +10 -0
  110. data/examples/landing_page_app_and_core_app/app_lp/app/controllers/concerns/.keep +0 -0
  111. data/examples/landing_page_app_and_core_app/app_lp/app/controllers/conversions_controller.rb +13 -0
  112. data/examples/landing_page_app_and_core_app/app_lp/app/controllers/lps_controller.rb +3 -0
  113. data/examples/landing_page_app_and_core_app/app_lp/app/helpers/application_helper.rb +2 -0
  114. data/examples/landing_page_app_and_core_app/app_lp/app/jobs/application_job.rb +2 -0
  115. data/examples/landing_page_app_and_core_app/app_lp/app/mailers/application_mailer.rb +4 -0
  116. data/examples/landing_page_app_and_core_app/app_lp/app/models/application_record.rb +3 -0
  117. data/examples/landing_page_app_and_core_app/app_lp/app/models/concerns/.keep +0 -0
  118. data/examples/landing_page_app_and_core_app/app_lp/app/views/layouts/application.html.erb +15 -0
  119. data/examples/landing_page_app_and_core_app/app_lp/app/views/layouts/mailer.html.erb +13 -0
  120. data/examples/landing_page_app_and_core_app/app_lp/app/views/layouts/mailer.text.erb +1 -0
  121. data/examples/landing_page_app_and_core_app/app_lp/app/views/lps/show.html.haml +5 -0
  122. data/examples/landing_page_app_and_core_app/app_lp/bin/bundle +3 -0
  123. data/examples/landing_page_app_and_core_app/app_lp/bin/rails +9 -0
  124. data/examples/landing_page_app_and_core_app/app_lp/bin/rake +9 -0
  125. data/examples/landing_page_app_and_core_app/app_lp/bin/setup +36 -0
  126. data/examples/landing_page_app_and_core_app/app_lp/bin/spring +17 -0
  127. data/examples/landing_page_app_and_core_app/app_lp/bin/update +31 -0
  128. data/examples/landing_page_app_and_core_app/app_lp/bin/yarn +11 -0
  129. data/examples/landing_page_app_and_core_app/app_lp/config.ru +5 -0
  130. data/examples/landing_page_app_and_core_app/app_lp/config/application.rb +19 -0
  131. data/examples/landing_page_app_and_core_app/app_lp/config/boot.rb +4 -0
  132. data/examples/landing_page_app_and_core_app/app_lp/config/cable.yml +10 -0
  133. data/examples/landing_page_app_and_core_app/app_lp/config/credentials.yml.enc +1 -0
  134. data/examples/landing_page_app_and_core_app/app_lp/config/database.yml +88 -0
  135. data/examples/landing_page_app_and_core_app/app_lp/config/environment.rb +5 -0
  136. data/examples/landing_page_app_and_core_app/app_lp/config/environments/development.rb +77 -0
  137. data/examples/landing_page_app_and_core_app/app_lp/config/environments/production.rb +94 -0
  138. data/examples/landing_page_app_and_core_app/app_lp/config/environments/test.rb +46 -0
  139. data/examples/landing_page_app_and_core_app/app_lp/config/initializers/application_controller_renderer.rb +8 -0
  140. data/examples/landing_page_app_and_core_app/app_lp/config/initializers/assets.rb +14 -0
  141. data/examples/landing_page_app_and_core_app/app_lp/config/initializers/backtrace_silencers.rb +7 -0
  142. data/examples/landing_page_app_and_core_app/app_lp/config/initializers/big_session.rb +7 -0
  143. data/examples/landing_page_app_and_core_app/app_lp/config/initializers/content_security_policy.rb +25 -0
  144. data/examples/landing_page_app_and_core_app/app_lp/config/initializers/cookies_serializer.rb +5 -0
  145. data/examples/landing_page_app_and_core_app/app_lp/config/initializers/filter_parameter_logging.rb +4 -0
  146. data/examples/landing_page_app_and_core_app/app_lp/config/initializers/inflections.rb +16 -0
  147. data/examples/landing_page_app_and_core_app/app_lp/config/initializers/mime_types.rb +4 -0
  148. data/examples/landing_page_app_and_core_app/app_lp/config/initializers/wrap_parameters.rb +14 -0
  149. data/examples/landing_page_app_and_core_app/app_lp/config/locales/en.yml +33 -0
  150. data/examples/landing_page_app_and_core_app/app_lp/config/puma.rb +34 -0
  151. data/examples/landing_page_app_and_core_app/app_lp/config/routes.rb +5 -0
  152. data/examples/landing_page_app_and_core_app/app_lp/config/spring.rb +6 -0
  153. data/examples/landing_page_app_and_core_app/app_lp/config/storage.yml +34 -0
  154. data/examples/landing_page_app_and_core_app/app_lp/db/seeds.rb +7 -0
  155. data/examples/landing_page_app_and_core_app/app_lp/entrypoint.sh +8 -0
  156. data/examples/landing_page_app_and_core_app/app_lp/lib/assets/.keep +0 -0
  157. data/examples/landing_page_app_and_core_app/app_lp/lib/tasks/.keep +0 -0
  158. data/examples/landing_page_app_and_core_app/app_lp/log/.keep +0 -0
  159. data/examples/landing_page_app_and_core_app/app_lp/package.json +5 -0
  160. data/examples/landing_page_app_and_core_app/app_lp/public/404.html +67 -0
  161. data/examples/landing_page_app_and_core_app/app_lp/public/422.html +67 -0
  162. data/examples/landing_page_app_and_core_app/app_lp/public/500.html +66 -0
  163. data/examples/landing_page_app_and_core_app/app_lp/public/apple-touch-icon-precomposed.png +0 -0
  164. data/examples/landing_page_app_and_core_app/app_lp/public/apple-touch-icon.png +0 -0
  165. data/examples/landing_page_app_and_core_app/app_lp/public/favicon.ico +0 -0
  166. data/examples/landing_page_app_and_core_app/app_lp/public/robots.txt +1 -0
  167. data/examples/landing_page_app_and_core_app/app_lp/storage/.keep +0 -0
  168. data/examples/landing_page_app_and_core_app/app_lp/test/application_system_test_case.rb +5 -0
  169. data/examples/landing_page_app_and_core_app/app_lp/test/controllers/.keep +0 -0
  170. data/examples/landing_page_app_and_core_app/app_lp/test/fixtures/.keep +0 -0
  171. data/examples/landing_page_app_and_core_app/app_lp/test/fixtures/files/.keep +0 -0
  172. data/examples/landing_page_app_and_core_app/app_lp/test/helpers/.keep +0 -0
  173. data/examples/landing_page_app_and_core_app/app_lp/test/integration/.keep +0 -0
  174. data/examples/landing_page_app_and_core_app/app_lp/test/mailers/.keep +0 -0
  175. data/examples/landing_page_app_and_core_app/app_lp/test/models/.keep +0 -0
  176. data/examples/landing_page_app_and_core_app/app_lp/test/system/.keep +0 -0
  177. data/examples/landing_page_app_and_core_app/app_lp/test/test_helper.rb +10 -0
  178. data/examples/landing_page_app_and_core_app/app_lp/tmp/.keep +0 -0
  179. data/examples/landing_page_app_and_core_app/app_lp/vendor/.keep +0 -0
  180. data/examples/landing_page_app_and_core_app/docker-compose.yml +26 -0
  181. data/lib/big_session.rb +15 -0
  182. data/lib/big_session/faraday.rb +35 -0
  183. data/lib/big_session/rack_middleware.rb +57 -0
  184. data/lib/big_session/session_id.rb +25 -0
  185. data/lib/big_session/version.rb +5 -0
  186. metadata +330 -0
@@ -0,0 +1,24 @@
1
+ # README
2
+
3
+ This README would normally document whatever steps are necessary to get the
4
+ application up and running.
5
+
6
+ Things you may want to cover:
7
+
8
+ * Ruby version
9
+
10
+ * System dependencies
11
+
12
+ * Configuration
13
+
14
+ * Database creation
15
+
16
+ * Database initialization
17
+
18
+ * How to run the test suite
19
+
20
+ * Services (job queues, cache servers, search engines, etc.)
21
+
22
+ * Deployment instructions
23
+
24
+ * ...
@@ -0,0 +1,6 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require_relative 'config/application'
5
+
6
+ Rails.application.load_tasks
@@ -0,0 +1,3 @@
1
+ //= link_tree ../images
2
+ //= link_directory ../javascripts .js
3
+ //= link_directory ../stylesheets .css
@@ -0,0 +1,16 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, or any plugin's
5
+ // vendor/assets/javascripts directory can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // compiled file. JavaScript code in this file should be added after the last require_* statement.
9
+ //
10
+ // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ //= require rails-ujs
14
+ //= require activestorage
15
+ //= require turbolinks
16
+ //= require_tree .
@@ -0,0 +1,13 @@
1
+ // Action Cable provides the framework to deal with WebSockets in Rails.
2
+ // You can generate new channels where WebSocket features live using the `rails generate channel` command.
3
+ //
4
+ //= require action_cable
5
+ //= require_self
6
+ //= require_tree ./channels
7
+
8
+ (function() {
9
+ this.App || (this.App = {});
10
+
11
+ App.cable = ActionCable.createConsumer();
12
+
13
+ }).call(this);
@@ -0,0 +1,15 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, or any plugin's
6
+ * vendor/assets/stylesheets directory can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
10
+ * files in this directory. Styles in this file should be added after the last require_* statement.
11
+ * It is generally better to create a new file per style scope.
12
+ *
13
+ *= require_tree .
14
+ *= require_self
15
+ */
@@ -0,0 +1,4 @@
1
+ module ApplicationCable
2
+ class Channel < ActionCable::Channel::Base
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module ApplicationCable
2
+ class Connection < ActionCable::Connection::Base
3
+ end
4
+ end
@@ -0,0 +1,10 @@
1
+ class ApplicationController < ActionController::Base
2
+ def append_info_to_payload(payload)
3
+ super
4
+
5
+ payload[:referer] = request.referer
6
+ payload[:user_agent] = request.user_agent
7
+ payload[:remote_ip] = request.remote_ip
8
+ payload[:big_session_id] = Thread.current.fetch('big_session_id', nil)
9
+ end
10
+ end
@@ -0,0 +1,13 @@
1
+ class ConversionsController < ApplicationController
2
+ def create
3
+ faraday = Faraday.new(url: 'http://app_core:3000/conversions') do |conn|
4
+ conn.use :big_session
5
+ conn.adapter Faraday.default_adapter
6
+ conn.request :url_encoded
7
+ end
8
+ res = faraday.post
9
+ if res.status == 200
10
+ #
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,3 @@
1
+ class LpsController < ApplicationController
2
+ def show; end
3
+ end
@@ -0,0 +1,2 @@
1
+ class ApplicationJob < ActiveJob::Base
2
+ end
@@ -0,0 +1,4 @@
1
+ class ApplicationMailer < ActionMailer::Base
2
+ default from: 'from@example.com'
3
+ layout 'mailer'
4
+ end
@@ -0,0 +1,3 @@
1
+ class ApplicationRecord < ActiveRecord::Base
2
+ self.abstract_class = true
3
+ end
@@ -0,0 +1,15 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>App</title>
5
+ <%= csrf_meta_tags %>
6
+ <%= csp_meta_tag %>
7
+
8
+ <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
9
+ <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
10
+ </head>
11
+
12
+ <body>
13
+ <%= yield %>
14
+ </body>
15
+ </html>
@@ -0,0 +1,13 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5
+ <style>
6
+ /* Email styles need to be inline */
7
+ </style>
8
+ </head>
9
+
10
+ <body>
11
+ <%= yield %>
12
+ </body>
13
+ </html>
@@ -0,0 +1,5 @@
1
+ %h1 lp
2
+ = form_tag(conversions_path, method: :post) do
3
+ = hidden_field :conversion_uid, 1
4
+ = submit_tag('conversion')
5
+
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
3
+ load Gem.bin_path('bundler', 'bundle')
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env ruby
2
+ begin
3
+ load File.expand_path('../spring', __FILE__)
4
+ rescue LoadError => e
5
+ raise unless e.message.include?('spring')
6
+ end
7
+ APP_PATH = File.expand_path('../config/application', __dir__)
8
+ require_relative '../config/boot'
9
+ require 'rails/commands'
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env ruby
2
+ begin
3
+ load File.expand_path('../spring', __FILE__)
4
+ rescue LoadError => e
5
+ raise unless e.message.include?('spring')
6
+ end
7
+ require_relative '../config/boot'
8
+ require 'rake'
9
+ Rake.application.run
@@ -0,0 +1,36 @@
1
+ #!/usr/bin/env ruby
2
+ require 'fileutils'
3
+ include FileUtils
4
+
5
+ # path to your application root.
6
+ APP_ROOT = File.expand_path('..', __dir__)
7
+
8
+ def system!(*args)
9
+ system(*args) || abort("\n== Command #{args} failed ==")
10
+ end
11
+
12
+ chdir APP_ROOT do
13
+ # This script is a starting point to setup your application.
14
+ # Add necessary setup steps to this file.
15
+
16
+ puts '== Installing dependencies =='
17
+ system! 'gem install bundler --conservative'
18
+ system('bundle check') || system!('bundle install')
19
+
20
+ # Install JavaScript dependencies if using Yarn
21
+ # system('bin/yarn')
22
+
23
+ # puts "\n== Copying sample files =="
24
+ # unless File.exist?('config/database.yml')
25
+ # cp 'config/database.yml.sample', 'config/database.yml'
26
+ # end
27
+
28
+ puts "\n== Preparing database =="
29
+ system! 'bin/rails db:setup'
30
+
31
+ puts "\n== Removing old logs and tempfiles =="
32
+ system! 'bin/rails log:clear tmp:clear'
33
+
34
+ puts "\n== Restarting application server =="
35
+ system! 'bin/rails restart'
36
+ end
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # This file loads Spring without using Bundler, in order to be fast.
4
+ # It gets overwritten when you run the `spring binstub` command.
5
+
6
+ unless defined?(Spring)
7
+ require 'rubygems'
8
+ require 'bundler'
9
+
10
+ lockfile = Bundler::LockfileParser.new(Bundler.default_lockfile.read)
11
+ spring = lockfile.specs.detect { |spec| spec.name == 'spring' }
12
+ if spring
13
+ Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path
14
+ gem 'spring', spring.version
15
+ require 'spring/binstub'
16
+ end
17
+ end
@@ -0,0 +1,31 @@
1
+ #!/usr/bin/env ruby
2
+ require 'fileutils'
3
+ include FileUtils
4
+
5
+ # path to your application root.
6
+ APP_ROOT = File.expand_path('..', __dir__)
7
+
8
+ def system!(*args)
9
+ system(*args) || abort("\n== Command #{args} failed ==")
10
+ end
11
+
12
+ chdir APP_ROOT do
13
+ # This script is a way to update your development environment automatically.
14
+ # Add necessary update steps to this file.
15
+
16
+ puts '== Installing dependencies =='
17
+ system! 'gem install bundler --conservative'
18
+ system('bundle check') || system!('bundle install')
19
+
20
+ # Install JavaScript dependencies if using Yarn
21
+ # system('bin/yarn')
22
+
23
+ puts "\n== Updating database =="
24
+ system! 'bin/rails db:migrate'
25
+
26
+ puts "\n== Removing old logs and tempfiles =="
27
+ system! 'bin/rails log:clear tmp:clear'
28
+
29
+ puts "\n== Restarting application server =="
30
+ system! 'bin/rails restart'
31
+ end
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env ruby
2
+ APP_ROOT = File.expand_path('..', __dir__)
3
+ Dir.chdir(APP_ROOT) do
4
+ begin
5
+ exec "yarnpkg", *ARGV
6
+ rescue Errno::ENOENT
7
+ $stderr.puts "Yarn executable was not detected in the system."
8
+ $stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install"
9
+ exit 1
10
+ end
11
+ end
@@ -0,0 +1,5 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require_relative 'config/environment'
4
+
5
+ run Rails.application
@@ -0,0 +1,19 @@
1
+ require_relative 'boot'
2
+
3
+ require 'rails/all'
4
+
5
+ # Require the gems listed in Gemfile, including any gems
6
+ # you've limited to :test, :development, or :production.
7
+ Bundler.require(*Rails.groups)
8
+
9
+ module App
10
+ class Application < Rails::Application
11
+ # Initialize configuration defaults for originally generated Rails version.
12
+ config.load_defaults 5.2
13
+
14
+ # Settings in config/environments/* take precedence over those specified here.
15
+ # Application configuration can go into files in config/initializers
16
+ # -- all .rb files in that directory are automatically loaded after loading
17
+ # the framework and any gems in your application.
18
+ end
19
+ end
@@ -0,0 +1,4 @@
1
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
2
+
3
+ require 'bundler/setup' # Set up gems listed in the Gemfile.
4
+ require 'bootsnap/setup' # Speed up boot time by caching expensive operations.
@@ -0,0 +1,10 @@
1
+ development:
2
+ adapter: async
3
+
4
+ test:
5
+ adapter: async
6
+
7
+ production:
8
+ adapter: redis
9
+ url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
10
+ channel_prefix: app_production
@@ -0,0 +1 @@
1
+ sah+vz0gJmUyEAXOjO0CdlM8TY9qtOzghKp1x4cfZon2SlTC0M5LD6ilbjlrm/zydkTDV1G1Nph7oBgyl/F6eQ4pXs+qTBwzAHtHL8Q+ktcQ814k89Fm5VyfZsNryhsag0W/MlDPpDSgSlM0P/JCmHPgulRpFzYAmzc2ktWCSUTbc83dku/S3wFDraeay/3hHIopMVmqVqOVxxyWMPRbxDBA6jqQ+0gmCzIYHVaB8GdxdI06qtOsq1ww4G6cMDEkQOo2SSl1M8ZKFgO9oBTswKa8W5HIlifd/uZqOgp9Q5HPKUHNH7Xe4bgQxNl0k4cc9qinrKuj8E5RwtOKs3spiR1Z1/OIQtTJsOVjM8Of/zGNyAQEbb2r+OwJhCe/IQg2MbpQXQY26pzzWnIF/UooD0vwc5cb67YO3UIW--QrY/c6Nc+7kOkWZq--6fmd5Lk49SUfys7jz1fOLw==
@@ -0,0 +1,88 @@
1
+ # PostgreSQL. Versions 9.1 and up are supported.
2
+ #
3
+ # Install the pg driver:
4
+ # gem install pg
5
+ # On OS X with Homebrew:
6
+ # gem install pg -- --with-pg-config=/usr/local/bin/pg_config
7
+ # On OS X with MacPorts:
8
+ # gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config
9
+ # On Windows:
10
+ # gem install pg
11
+ # Choose the win32 build.
12
+ # Install PostgreSQL and put its /bin directory on your path.
13
+ #
14
+ # Configure Using Gemfile
15
+ # gem 'pg'
16
+ #
17
+ default: &default
18
+ adapter: postgresql
19
+ encoding: unicode
20
+ # For details on connection pooling, see Rails configuration guide
21
+ # http://guides.rubyonrails.org/configuring.html#database-pooling
22
+ pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
23
+ host: db
24
+ username: postgres
25
+ password:
26
+
27
+ development:
28
+ <<: *default
29
+ database: app2_development
30
+
31
+ # The specified database role being used to connect to postgres.
32
+ # To create additional roles in postgres see `$ createuser --help`.
33
+ # When left blank, postgres will use the default role. This is
34
+ # the same name as the operating system user that initialized the database.
35
+ #username: app
36
+
37
+ # The password associated with the postgres role (username).
38
+ #password:
39
+
40
+ # Connect on a TCP socket. Omitted by default since the client uses a
41
+ # domain socket that doesn't need configuration. Windows does not have
42
+ # domain sockets, so uncomment these lines.
43
+ #host: localhost
44
+
45
+ # The TCP port the server listens on. Defaults to 5432.
46
+ # If your server runs on a different port number, change accordingly.
47
+ #port: 5432
48
+
49
+ # Schema search path. The server defaults to $user,public
50
+ #schema_search_path: myapp,sharedapp,public
51
+
52
+ # Minimum log levels, in increasing order:
53
+ # debug5, debug4, debug3, debug2, debug1,
54
+ # log, notice, warning, error, fatal, and panic
55
+ # Defaults to warning.
56
+ #min_messages: notice
57
+
58
+ # Warning: The database defined as "test" will be erased and
59
+ # re-generated from your development database when you run "rake".
60
+ # Do not set this db to the same as development or production.
61
+ test:
62
+ <<: *default
63
+ database: app2_test
64
+
65
+ # As with config/secrets.yml, you never want to store sensitive information,
66
+ # like your database password, in your source code. If your source code is
67
+ # ever seen by anyone, they now have access to your database.
68
+ #
69
+ # Instead, provide the password as a unix environment variable when you boot
70
+ # the app. Read http://guides.rubyonrails.org/configuring.html#configuring-a-database
71
+ # for a full rundown on how to provide these environment variables in a
72
+ # production deployment.
73
+ #
74
+ # On Heroku and other platform providers, you may have a full connection URL
75
+ # available as an environment variable. For example:
76
+ #
77
+ # DATABASE_URL="postgres://myuser:mypass@localhost/somedatabase"
78
+ #
79
+ # You can use this database configuration with:
80
+ #
81
+ # production:
82
+ # url: <%= ENV['DATABASE_URL'] %>
83
+ #
84
+ production:
85
+ <<: *default
86
+ database: app2_production
87
+ username: app2
88
+ password: <%= ENV['APP_DATABASE_PASSWORD'] %>