Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8375157
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T15:06:05+00:00 2026-06-09T15:06:05+00:00

I own a Rails application with Unicorn as Web server. I deploy it by

  • 0

I own a Rails application with Unicorn as Web server.

I deploy it by means of Capistrano.

Here my deploy.rb file:

require "bundler/capistrano"

server "91.121.11.100", :web, :app, :db, primary: true

set :application, "myapp"
set :user, "deployer"
set :deploy_to, "/home/#{user}/apps/#{application}"
#set :deploy_via, :remote_cache
set :use_sudo, false

set :scm, "git"
set :repository, "git@github.com:therepository/#{application}.git"
set :branch, "master"

default_run_options[:pty] = true
ssh_options[:forward_agent] = true

#after "deploy", "deploy:cleanup" # keep only the last 5 releases

namespace :deploy do
  %w[start stop restart].each do |command|
    desc "#{command} unicorn server"
    task command, roles: :app, except: {no_release: true} do
      run "/etc/init.d/unicorn_#{application} #{command}"
    end
  end

  task :setup_config, roles: :app do
    sudo "ln -nfs #{current_path}/config/nginx.conf /etc/nginx/sites-enabled/#{application}"
    sudo "ln -nfs #{current_path}/config/unicorn_init.sh /etc/init.d/unicorn_#{application}"
    run "mkdir -p #{shared_path}/config"
    put File.read("config/database.yml"), "#{shared_path}/config/database.yml"
    puts "Now edit the config files in #{shared_path}."
  end
  after "deploy:setup", "deploy:setup_config"

  task :symlink_config, roles: :app do
    run "ln -nfs #{shared_path}/config/database.yml #{release_path}/config/database.yml"
  end
  after "deploy:finalize_update", "deploy:symlink_config"

  desc "Make sure local git is in sync with remote."
  task :check_revision, roles: :web do
    unless `git rev-parse HEAD` == `git rev-parse origin/master`
      puts "WARNING: HEAD is not the same as origin/master"
      puts "Run `git push` to sync changes."
      exit
    end
  end
  before "deploy", "deploy:check_revision"
end

Deployment well happens and current folder on server contains the updated files as expected.

But, something very strange that I don’t understand happens:

I’ve got this line in the beginning of my process:

logger = Logger.new "#{Rails.root}/log/web_agents.log"

and this error still appears:

No such file or directory - /home/deployer/apps/myapp/releases/20120612122610/log/web_agents.log

Why 20120612122610??? It’s an old release that I even deleted.

Why don’t Unicorn point to the last release ?

For testing, I even replace Rails.root by the hardcoded path to current one.

Still got the same error… I’ve killed, stop, force-stop Unicorn…doesn’t matter…

Any idea ?

I precise that I’m sure that process are launch using last updated files in the ‘current’ folder since when I delete one, process can’t work and many errors appear.

UPDATED

Here my config/unicorn.rb file:

root = "/home/deployer/apps/myapp/current"
working_directory root
pid "#{root}/tmp/pids/unicorn.pid"
stderr_path "#{root}/log/unicorn.log"
stdout_path "#{root}/log/unicorn.log"

listen "/tmp/unicorn.myapp.sock"
worker_processes 2
timeout 30
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T15:06:07+00:00Added an answer on June 9, 2026 at 3:06 pm

    I found myself where the problem comes from.

    In fact, there is a troubleshooting between Unicorn and Sidekiq.

    Indeed, as I said in one comment above, process is launched by Sidekiq.

    First, within deploy.rb, there must be this line:

    require 'sidekiq/capistrano' 
    

    This allows deployment process to restart Sidekiq gracefully.
    See there:
    https://github.com/mperham/sidekiq/wiki/Deployment

    Secondly, within unicorn.rb, there must be this kind of block:

    after_fork do |server, worker|
      Sidekiq.configure_client do |config|
        config.redis = { :size => 1 }
      end
    end
    

    For more information about it, see there:

    https://github.com/mperham/sidekiq/wiki/Problems-and-Troubleshooting

    And now, no more weird issue 🙂

    A potential explanation:

    Probably Sidekiq manages some caches that prevent it to be based on the last release…and that would be why a restart plus cleanly launches of Unicorn and Sidekiq were enough.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

As we install rails it uses its own web server WEBrick. If i want
I'm converting a part of a rails application to its own sinatra application. It
I'm creating a new web application (Rails 3 beta), of which pieces of it
If I have a Ruby on Rails application running on my Apache shared server
In my Rails application, there are many games, and each game has it's own
I'm working on a backbone rails application that needs to poll the server to
Here's our basic requirements: We have a base Rails application, which is being actively
I'm building a web application with Ruby on Rails which needs to be highly
I have a Rails application which I now plan to deploy many instances to
I cloned one of my own apps using Rails 3.1.3, created an app on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.