Skip to content

Commit b22a391

Browse files
author
Udalov Igor
committed
Setup local_production
1 parent 1817e21 commit b22a391

File tree

4 files changed

+109
-1
lines changed

4 files changed

+109
-1
lines changed

Procfile.lp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
web: bin/rails s -p 3000 -e local_production
2+
webpacker: ./bin/webpack-dev-server
3+
job: bin/rake jobs:work

bin/startup

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@ def system!(*args)
1111
end
1212

1313
chdir APP_ROOT do
14+
env = ENV.fetch('RAILS_ENV', 'development')
1415
puts "== STARTING UP =="
15-
system! "foreman start -f Procfile.dev"
16+
17+
if env == 'local_production'
18+
system! "bundle exec rake assets:precompile"
19+
system! "foreman start -f Procfile.lp"
20+
else
21+
system! "foreman start -f Procfile.dev"
22+
end
1623
end

config/application.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,5 +53,7 @@ class Application < Rails::Application
5353
end
5454
ReservedWords.all = [ReservedWords::BASE_WORDS + top_routes].flatten.compact.uniq
5555
end
56+
57+
config.skylight.environments << 'local_production'
5658
end
5759
end
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# rubocop:disable Metrics/BlockLength
2+
#
3+
def yarn_integrity_enabled?
4+
ENV.fetch("YARN_INTEGRITY_ENABLED", "true") == "true"
5+
end
6+
7+
Rails.application.configure do
8+
# Verifies that versions and hashed value of the package contents in the project's package.json
9+
config.webpacker.check_yarn_integrity = yarn_integrity_enabled?
10+
11+
# Settings specified here will take precedence over those in config/application.rb.
12+
13+
# In the development environment your application's code is reloaded on
14+
# every request. This slows down response time but is perfect for development
15+
# since you don't have to restart the web server when you make code changes.
16+
config.cache_classes = true
17+
18+
# Do not eager load code on boot.
19+
config.eager_load = true
20+
21+
# Show full error reports and disable caching.
22+
config.consider_all_requests_local = true
23+
24+
# Enable/disable caching. By default caching is disabled.
25+
config.action_controller.perform_caching = true
26+
27+
# Don't care if the mailer can't send.
28+
config.action_mailer.raise_delivery_errors = false
29+
30+
# Print deprecation notices to the Rails logger.
31+
config.active_support.deprecation = :log
32+
33+
# Raise an error on page load if there are pending migrations.
34+
config.active_record.migration_error = :page_load
35+
36+
# Debug mode disables concatenation and preprocessing of assets.
37+
# This option may cause significant delays in view rendering with a large
38+
# number of complex assets.
39+
config.assets.debug = false
40+
41+
# Asset digests allow you to set far-future HTTP expiration dates on all assets,
42+
# yet still be able to expire them through the digest params.
43+
config.assets.digest = false
44+
45+
# Supress logger output for asset requests.
46+
config.assets.quiet = true
47+
48+
# Do not fallback to assets pipeline if a precompiled asset is missed.
49+
config.assets.compile = true
50+
51+
# Adds additional error checking when serving assets at runtime.
52+
# Checks for improperly declared sprockets dependencies.
53+
# Raises helpful error messages.
54+
config.assets.raise_runtime_errors = true
55+
56+
config.action_mailer.perform_caching = false
57+
58+
config.app_domain = "localhost:3000"
59+
60+
config.action_mailer.default_url_options = { host: "localhost:3000" }
61+
config.action_mailer.delivery_method = :smtp
62+
config.action_mailer.perform_deliveries = true
63+
config.action_mailer.default_url_options = { host: config.app_domain }
64+
config.action_mailer.smtp_settings = {
65+
address: "smtp.gmail.com",
66+
port: "587",
67+
enable_starttls_auto: true,
68+
user_name: '<%= ENV["DEVELOPMENT_EMAIL_USERNAME"] %>',
69+
password: '<%= ENV["DEVELOPMENT_EMAIL_PASSWORD"] %>',
70+
authentication: :plain,
71+
domain: "localhost:3000"
72+
}
73+
74+
config.action_mailer.preview_path = "#{Rails.root}/spec/mailers/previews"
75+
76+
# Raises error for missing translations
77+
# config.action_view.raise_on_missing_translations = true
78+
79+
config.public_file_server.enabled = true
80+
81+
config.file_watcher = ActiveSupport::EventedFileUpdateChecker
82+
83+
# Install the Timber.io logger
84+
send_logs_to_timber = ENV["SEND_LOGS_TO_TIMBER"] || "false" # <---- set to false to stop sending dev logs to Timber.io
85+
log_device = send_logs_to_timber == "true" ? Timber::LogDevices::HTTP.new(ENV["TIMBER"]) : STDOUT
86+
logger = Timber::Logger.new(log_device)
87+
logger.level = config.log_level
88+
config.logger = ActiveSupport::TaggedLogging.new(logger)
89+
90+
config.after_initialize do
91+
Bullet.enable = true
92+
Bullet.console = true
93+
end
94+
end
95+
96+
# rubocop:enable Metrics/BlockLength

0 commit comments

Comments
 (0)