Skip to content

Commit

Permalink
[CP] Fix assets precompile
Browse files Browse the repository at this point in the history
  • Loading branch information
CapCap authored and aptos-bot committed May 11, 2022
1 parent d2e364d commit f66df69
Show file tree
Hide file tree
Showing 6 changed files with 114 additions and 81 deletions.
7 changes: 6 additions & 1 deletion ecosystem/platform/server/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ RECAPTCHA_SECRET_KEY=
# Google Analytics
GOOGLE_ANALYTICS_ID="G-CWW2TW4HSD"

RAILS_ENV=dev
RAILS_ENV=development

SECRET_KEY_BASE=18ff7d41b9da02d394434e2eb140611516707334b7d7a7e15cf8b567061f30e9400a82e61aa772b9e6ccb72853932769d03bbbb9d78f62333c8f7adb95cc727d

# Mailchimp emails
SMTP_HOST=smtp.mandrillapp.com
SMTP_PORT=587
MAILCHIMP_API_KEY=
4 changes: 3 additions & 1 deletion ecosystem/platform/server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ COPY . /usr/src/app
# this is a fake secret key just to get it to compile the assets
ENV SECRET_KEY_BASE=18ff7d41b9da02d394434e2eb140611516707334b7d7a7e15cf8b567061f30e9400a82e61aa772b9e6ccb72853932769d03bbbb9d78f62333c8f7adb95cc727d

RUN bundle exec rake assets:precompile
# Yes, this should run twice
# https://github.com/rails/tailwindcss-rails/issues/158
RUN bundle exec rake assets:precompile && bundle exec rake assets:precompile

EXPOSE 3000
CMD ["bundle", "exec", "rails", "s", "-b", "0.0.0.0"]
6 changes: 5 additions & 1 deletion ecosystem/platform/server/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ gem 'bootsnap', require: false
# Use Sass to process CSS
gem 'sassc-rails'

# mailchimp
# https://github.com/mailchimp/mailchimp-transactional-ruby/
gem 'MailchimpTransactional'

# Use Active Storage variants [https://guides.rubyonrails.org/active_storage_overview.html#transforming-images]
# gem "image_processing", "~> 1.2"

Expand Down Expand Up @@ -106,4 +110,4 @@ group :test do
gem 'webdrivers'
end

gem "recaptcha", "~> 5.10"
gem 'recaptcha', '~> 5.10'
5 changes: 5 additions & 0 deletions ecosystem/platform/server/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
GEM
remote: https://rubygems.org/
specs:
MailchimpTransactional (1.0.47)
excon (>= 0.76.0, < 1)
json (~> 2.1, >= 2.1.0)
actioncable (7.0.2.4)
actionpack (= 7.0.2.4)
activesupport (= 7.0.2.4)
Expand Down Expand Up @@ -122,6 +125,7 @@ GEM
dotenv (= 2.7.6)
railties (>= 3.2)
erubi (1.10.0)
excon (0.92.3)
factory_bot (6.2.1)
activesupport (>= 5.0.0)
factory_bot_rails (6.2.0)
Expand Down Expand Up @@ -388,6 +392,7 @@ PLATFORMS
x86_64-linux

DEPENDENCIES
MailchimpTransactional
activeadmin
bootsnap
brakeman
Expand Down
23 changes: 19 additions & 4 deletions ecosystem/platform/server/config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
config.eager_load = true

# Full error reports are disabled and caching is turned on.
config.consider_all_requests_local = false
config.consider_all_requests_local = false
config.action_controller.perform_caching = true

# Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
Expand All @@ -30,7 +30,8 @@
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?

# Compress CSS using a preprocessor.
# config.assets.css_compressor = :sass
# Must set up dart-sass before re-enabling
config.assets.css_compressor = nil

# Do not fallback to assets pipeline if a precompiled asset is missed.
config.assets.compile = false
Expand Down Expand Up @@ -68,6 +69,20 @@
# config.active_job.queue_name_prefix = "cp_production"

config.action_mailer.perform_caching = false
config.action_mailer.default_url_options = { host: 'community.aptoslabs.com', protocol: 'https' }
config.action_mailer.delivery_method = :smtp
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true
config.action_mailer.smtp_settings = {
address: ENV.fetch('SMTP_HOST', nil),
port: ENV.fetch('SMTP_PORT', nil),
enable_starttls_auto: true, # detects and uses STARTTLS
user_name: '[email protected]',
password: ENV.fetch('MAILCHIMP_API_KEY', nil), # SMTP password is any valid API key
authentication: 'login', # Mandrill supports 'plain' or 'login'
domain: 'aptoslabs.com'
}
config.action_mailer.preview_path = "#{Rails.root}/tmp/mailers/previews"

# Ignore bad email addresses and do not raise email delivery errors.
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
Expand All @@ -88,9 +103,9 @@
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new "app-name")

if ENV['RAILS_LOG_TO_STDOUT'].present?
logger = ActiveSupport::Logger.new($stdout)
logger = ActiveSupport::Logger.new($stdout)
logger.formatter = config.log_formatter
config.logger = ActiveSupport::TaggedLogging.new(logger)
config.logger = ActiveSupport::TaggedLogging.new(logger)
end

# Do not dump schema after migrations.
Expand Down
150 changes: 76 additions & 74 deletions ecosystem/platform/server/db/schema.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f66df69

Please sign in to comment.