After changing css files I did a rake assets:precompile and pushed it up to git. Then did a new deploy with capistrano to my server. Now none of my assets or styles are showing up on my page http://162.243.102.157/.
The assets are on the production deployment server, but I can't seem to figure out why either passenger or Rails isn't serving and showing the assets to my website...?
My ruby -v is:
2.2.3p173
Rails -v:
4.2.5.2
capfile:
# Load DSL and set up stages
require 'capistrano/setup'
# Include default deployment tasks
require 'capistrano/deploy'
# Include tasks from other gems included in your Gemfile
#
# For documentation on these, see for example:
#
# https://github.com/capistrano/rvm
# https://github.com/capistrano/rbenv
# https://github.com/capistrano/chruby
# https://github.com/capistrano/bundler
# https://github.com/capistrano/rails
# https://github.com/capistrano/passenger
# If you are using rbenv add these lines:
require 'capistrano/rbenv'
set :rbenv_type, :user # or :system, depends on your rbenv setup
set :rbenv_ruby, '2.2.3'
require 'capistrano/bundler'
require 'capistrano/rails'
require 'capistrano/setup'
#require 'capistrano/deploy'
# require 'capistrano/rvm'
require 'capistrano/rbenv'
# require 'capistrano/chruby'
#require 'capistrano/rails/assets'
#require 'capistrano/rails/migrations'
require 'capistrano/passenger'
# Load custom tasks from `lib/capistrano/tasks` if you have any defined
Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }
Gemfile:
source 'https://rubygems.org'
ruby '2.2.3'
gem 'rake', '~> 10.5'
gem 'rails', '~> 4.2', '>= 4.2.5.1'
gem 'jquery-rails'
gem 'jquery-ui-rails'
# gem 'pg'
gem 'sqlite3'
gem 'mysql2', '~> 0.4.2'
# Use Bootstrap
gem 'bootstrap-sass', '~> 3.3.5'
# Use Font-Awesome
gem 'font-awesome-sass'
# Sprockets
gem 'sprockets', '~> 2.8'
# Use SCSS for stylesheets
gem 'sass-rails', '>= 3.2'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
gem 'therubyracer', platforms: :ruby
# Use Autoprefixer
gem 'autoprefixer-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
#gem 'pygments.rb', '~> 0.6.0'
gem 'redcarpet', '~> 3.3.4'
# Mail Forms
gem 'mail_form', '~> 1.5', '>= 1.5.1'
gem 'sendgrid'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use PUMA
gem 'puma'
# Use Passenger as the app server
gem 'passenger'
# Use Devise for security
gem 'devise', '~> 3.5', '>= 3.5.6'
# Use figaro for environment variables (aka. passwords)
gem 'figaro', '~> 1.1', '>= 1.1.1'
group :assets do
gem 'compass-rails'
# Add any compass extensions here
end
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
end
group :development do
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0'
gem 'capistrano-figaro-yml', '~> 1.0.2'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
end
group :production, :staging do
# Use Capistrano for deployment
gem 'capistrano', '~> 3.1'
gem 'capistrano-rails', '~> 1.1.1'
gem 'capistrano-passenger'
gem 'capistrano-bundler', '~> 1.1', '>= 1.1.4'
gem 'capistrano-rbenv', '~> 2.0.4'
# postgress
#gem 'pg'
gem 'rails_12factor'
end
environments/production.rb:
Rails.application.configure do
# Code is not reloaded between requests.
config.cache_classes = true
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 = 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?
# 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 = false
# `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
# Specifies the header that your server uses for sending files.
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
# Use the lowest log level to ensure availability of diagnostic information
# when problems arise.
config.log_level = :debug
config.action_mailer.perform_deliveries = true
# Bad email addresses and raise email delivery errors.
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
config.action_mailer.raise_delivery_errors = true
config.action_mailer.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
:address => "smtp.sendgrid.net",
:port => 587,
:user_name => ENV['SENDGRID_USER'],
:password => ENV['SENDGRID_PASS'],
:domain => "domain.com",
:authentication => :plain,
:enable_starttls_auto => true
}
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation cannot be found).
config.i18n.fallbacks = true
# Send deprecation notices to registered listeners.
config.active_support.deprecation = :notify
# Use default logging formatter so that PID and timestamp are not suppressed.
config.log_formatter = ::Logger::Formatter.new
# Do not dump schema after migrations.
config.active_record.dump_schema_after_migration = false
end
config/deploy.rb
# config valid only for current version of Capistrano
lock '3.4'
set :application, 'MyApplication'
set :user, 'user'
set :assets_roles, [:web, :app]
set :keep_assets, 2
# Default value for :scm is :git
set :scm, :git
set :repo_url, '[email protected]:CoreyVincent/HydraWeb.git'
set :passenger_restart_with_touch, true
# Default branch is :master
# ask :branch, `git rev-parse --abbrev-ref HEAD`.chomp
# Default deploy_to directory is /var/www/my_app_name
set :deploy_to, '/home/user/MyApplication'
set :rails_env, "production"
# set :deploy_via, :copy
# Default value for :format is :pretty
# set :format, :pretty
# Default value for :log_level is :debug
# set :log_level, :debug
# Default value for :pty is false
# set :pty, true
# set :use_sudo, true
# Default value for :linked_files is []
# set :linked_files, fetch(:linked_files, []).push('config/database.yml', 'config/secrets.yml')
# Default value for linked_dirs is []
# set :linked_dirs, fetch(:linked_dirs, []).push('log', 'tmp/pids', 'tmp/cache', 'tmp/sockets', 'vendor/bundle', 'public/system')
set :linked_files, %w{config/database.yml config/secrets.yml}
set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system}
#set :assets_prefix, ""
# Default value for default_env is {}
# set :default_env, { path: "/opt/ruby/bin:$PATH" }
# Default value for keep_releases is 5
set :keep_releases, 5
namespace :deploy do
desc 'Restart application'
task :restart do
on roles(:app), in: :sequence, wait: 5 do
execute :touch, release_path.join('tmp/restart.txt')
end
end
after :publishing, 'deploy:restart'
after :finishing, 'deploy:cleanup'
end
Update:
Assets and styles are now showing up, but I can't seem to update anything. Now when I git push and deploy, the assets don't update to the new changes...