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

  • Home
  • SEARCH
  • 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 9159765
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T13:34:23+00:00 2026-06-17T13:34:23+00:00

I followed the Ryan’s screencast and deployed to VPS. So i use Unicorn +

  • 0

I followed the Ryan’s screencast and deployed to VPS. So i use Unicorn + nginx + github + Ubuntu 12.04 LTS + capistrano. Also i use i18n to translate application.

I also would like to notice that i use Carriarewave for picture uploading. Carriarewave keeps pictures on VPS locally. When i upload images it works great and uploaded pictures appear.

But each time when i deploy new changes to the server then ALL my pictures become broken. It’s really awfull. I tried manually to restart nginx:

sudo service nginx restart

And i tried to restart Unicorn:

/etc/init.d/unicorn_Chirch_app restart

It doesn’t help too.

When i try to open my broken page manually it says:

The page you were looking for doesn't exist.
You may have mistyped the address or the page may have moved.

When i try to find pictures in console:

> Photo.all
> => [#<Photo id: 3, description: nil, created_at: "2013-01-21 11:14:01", updated_at: "2013-01-21 11:14:01", image: "1320700703588.jpg">, #<Photo id: 4, description: nil, created_at: "2013-01-21 11:14:01", updated_at: "2013-01-21 11:14:01", image: "Seasonscape_by_alexiuss.jpg">, #<Photo id: 5, description: nil, created_at: "2013-01-21 11:30:30", updated_at: "2013-01-21 11:30:30", image: "Seasonscape_by_alexiuss.jpg">]

As i understand they should exist.

Error from logs:

Started GET "/ru/uploads%2Fphoto%2Fimage%2F4%2FSeasonscape_by_alexiuss" for 89.178.205.47 at 2013-01-21 11:31:17 +0000

ActionController::RoutingError (No route matches [GET] "/ru/uploads%2Fphoto%2Fimage%2F4%2FSeasonscape_by_alexiuss"):
  actionpack (3.2.8) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
  actionpack (3.2.8) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
  railties (3.2.8) lib/rails/rack/logger.rb:26:in `call_app'
  railties (3.2.8) lib/rails/rack/logger.rb:16:in `call'
  actionpack (3.2.8) lib/action_dispatch/middleware/request_id.rb:22:in `call'
  rack (1.4.4) lib/rack/methodoverride.rb:21:in `call'
  rack (1.4.4) lib/rack/runtime.rb:17:in `call'
  activesupport (3.2.8) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
  rack (1.4.4) lib/rack/lock.rb:15:in `call'
  rack-cache (1.2) lib/rack/cache/context.rb:136:in `forward'
  rack-cache (1.2) lib/rack/cache/context.rb:245:in `fetch'
  rack-cache (1.2) lib/rack/cache/context.rb:185:in `lookup'
  rack-cache (1.2) lib/rack/cache/context.rb:66:in `call!'
  rack-cache (1.2) lib/rack/cache/context.rb:51:in `call'
  railties (3.2.8) lib/rails/engine.rb:479:in `call'
  railties (3.2.8) lib/rails/application.rb:223:in `call'
  railties (3.2.8) lib/rails/railtie/configurable.rb:30:in `method_missing'
  unicorn (4.5.0) lib/unicorn/http_server.rb:552:in `process_client'
  unicorn (4.5.0) lib/unicorn/http_server.rb:628:in `worker_loop'
  unicorn (4.5.0) lib/unicorn/http_server.rb:500:in `spawn_missing_workers'
  unicorn (4.5.0) lib/unicorn/http_server.rb:511:in `maintain_worker_count'
  unicorn (4.5.0) lib/unicorn/http_server.rb:277:in `join'
  unicorn (4.5.0) bin/unicorn:121:in `<top (required)>'
  /home/deployer/apps/My_app/shared/bundle/ruby/1.9.1/bin/unicorn:23:in `load'
  /home/deployer/apps/My_app/shared/bundle/ruby/1.9.1/bin/unicorn:23:in `<main>'

My config/deploy.rb

require "bundler/capistrano"

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

set :application, "My_app"
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:MyName/#{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.example.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
  • 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-17T13:34:25+00:00Added an answer on June 17, 2026 at 1:34 pm

    Ok, I found the solution. The problem appeared because I didn’t change the default folder to keep images. You can find your default folder in public/uploads. That means that each cap deploy will create a new empty folder which doesn’t contain your older files.

    To fix this you should create another folder which doesn’t live in your application. I choose the easiest way. I created symlinlk.

    My steps:

    1) On your server go to your app’s shared folder (it generated automatically via capistrano). And then create your folder to keep new images:

    $ mkdir uploads
    

    2) Give necessary rights for a created folder:

    $ sudo chmod 775 uploads
    

    3) On your local machine in config/deploy.rb add:

    task :symlink_config, roles: :app do
      ...
      run "ln -nfs #{shared_path}/uploads #{release_path}/public/uploads"
    end
    

    4) Then push git and deploy:

    $ git push
    $ cap deploy:symlink
    $ cap deploy
    

    Now everything works fine.

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

Sidebar

Related Questions

I followed this article to have an Ubuntu Nginx, Rails, and Thin server, but
I've followed Ryan Bates' screencast in order to get friendly_id set up (up until
I've followed Ryan Bates' screencast on using jQuery Tokeninput for an auto-completing list for
I'd followed the railscast 213 (calendars) from Ryan Bates Where he makes use of
I followed the instructions given in the link: http://blog.avirtualhome.com/how-to-compile-a-new-ubuntu-11-04-natty-kernel/ for building a custom kernel
I followed the tutorial on https://dev.twitter.com/docs/auth/implementing-sign-twitter to use OAuth on my homepage. Everything worked
I followed the instructions as given in Using The Notifications API . Also I
I followed Ryan Bates Omniauth Part1 railscats http://railscasts.com/episodes/235-omniauth-part-1 . I put twitter and Facebook
I have successfully followed Ryan Bates tutorial of paperclip and have it working correctly.
I followed along with Ryan Bates' authenticating with Facebook Railscast http://media.railscasts.com/assets/episodes/videos/360-facebook-authentication.ogv in which he

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.