Rails Ubuntu / passenger / capistrano应用程序资产未部署
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Rails Ubuntu / passenger / capistrano应用程序资产未部署相关的知识,希望对你有一定的参考价值。
我的资产没有任何更新。 我使用的设置与以前相同,但是现在当我更改任何'.html.erb'文件或'.scss'文件时,将它们添加到git并进行部署时它们不会出现他们与capistrano。 知道这可能发生什么吗?
也许我应该在要部署到的远程服务器上重新安装所有内容?
我正在使用:
Rails 4.2.5.1
红宝石2.2.3p173
production.rb:
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both threaded web servers
# and those relying on copy on write to perform better.
# Rake tasks automatically ignore this option for performance.
config.eager_load = true
# Full error reports are disabled and caching is turned on.
config.consider_all_requests_local = false
config.action_controller.perform_caching = false
# Enable Rack::Cache to put a simple HTTP cache in front of your application
# Add `rack-cache` to your Gemfile before enabling this.
# For large-scale production use, consider using a caching reverse proxy like
# nginx, varnish or squid.
# config.action_dispatch.rack_cache = true
# Disable serving static files from the `/public` folder by default since
# Apache or NGINX already handles this.
config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?
#config.serve_static_files = false
# Compress javascripts and CSS.
config.assets.js_compressor = :uglifier
#config.assets.css_compressor = :sass
# Do not fallback to assets pipeline if a precompiled asset is missed.
config.assets.compile = false
config.assets.initialize_on_precompile = false
# Asset digests allow you to set far-future HTTP expiration dates on all assets,
# yet still be able to expire them through the digest params.
config.assets.digest = true
end
我还使用RAILS_ENV=production rake asssets:precompile
在部署资产之前对其进行编译。
答案
您可以尝试在本地预编译资产,提交并再次部署。
rake assets:precompile
这不是最佳实践,但是在需要时我已经做了。 还要在部署期间检查堆栈跟踪。 通常,您的CSS或JS某处存在错误,导致资产无法编译。
以上是关于Rails Ubuntu / passenger / capistrano应用程序资产未部署的主要内容,如果未能解决你的问题,请参考以下文章
用capistrano+Nginx+Passenger+MYSQL部署rails到VPS。
在 Ubuntu 上使用 nginx 和Passenger 时在哪里放置环境变量
Rails,Passenger,Nginx,我得到“403 Forbidden”,但为啥呢?
Rails + Elastic Beanstalk + Passenger:更改乘客配置