I am using rails 4
with nginx
and passenger
for my personal project. Today I decided to use capistrano
for deployment. My capsitrano config is working fine and I am able to deploy my application to production. After deploying I can see my changes in current
folder and latest release
folder. But I don't see the changes in browser.
let's say I have following folder structures on my server after setting up capistrano.
[1]app_name/app/views/finance/index.html
[2]app_name/releases/<latest_release>app/views/finance/index.html
[3]app_name/current/app/views/finance/index.html
If I ssh into server then I can see my code changes are applied to folder structure [2] and [3]
but my code in not updated in folder structure [1].
Below are snippets from my cap files:
production.rb
set :port, 22
set :user, 'deploy'
set :deploy_via, :remote_cache
set :use_sudo, false
server 'xx.xxx.x.xxx',
roles: [:web, :app, :db],
port: fetch(:port),
user: fetch(:user),
primary: true
set :deploy_to, "/var/www/app_name"
set :ssh_options, {
forward_agent: true,
auth_methods: %w(publickey),
user: 'deploy',
}
set :rails_env, :production
set :conditionally_migrate, true
deploy.rb
lock '3.4.0'
set :application, 'app_name'
set :repo_url, 'git@github.com:user_name/app_name.git'
# Default branch is :master
set :branch, 'master'
set :use_sudo, false
set :bundle_binstubs, nil
# Default value for :scm is :git
set :scm, :git
# 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
# 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')
# Default value for keep_releases is 5
set :keep_releases, 5
set :keep_assets, 3
namespace :deploy do
task :restart do
on roles(:app) do
within release_path do
execute :touch, 'tmp/restart.txt'
end
end
end
end
Do I need to point my application server to current
directory?
I fixed the problem by telling nginx
to point to current/public
folder.
root /var/www/app_name/current/public;
(falsely made edit deleted)