Deploy Ubuntu 12.04 Precise Pangolin Discussion
Great tutorial!
Just one thing, the Gemfile it's wrong, it's pointing to the wrong repository of each capistrano implementation. This should work:
gem 'capistrano', '~> 3.0.0'
gem 'capistrano-bundler', '~> 1.0.0'
gem 'capistrano-rails', '~> 1.0.0'
# Add this if you're using rbenv
# gem 'capistrano-rbenv', github: "capistrano/rbenv"
# Add this if you're using rvm
# gem 'capistrano-rvm', github: "capistrano/rvm"
Cheers,
Diego
Ah thanks! Fixed that up. :)
Very nice tutorial, just what I needed. You should write this for digitalocean, they are offering $50 for each article now I believe.
I've always done the Postgres step a bit differently but this works too.
I keep getting error on 'rbenv:validate'? Has anyone else seen this issue or know how to resolve it?
I haven't, but it seems you're not the only one https://gist.github.com/Dev...
Hi! good job.
I've followed your tutorial, I'm new in rails. This is my first app, it's working in development, and this is my first try to put in production.
Everything went ok until I have arrived to command: "cap production deploy" this returns to me an error:
cap production deploy
/home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- capistrano/cli (LoadError)
from /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /usr/bin/cap:3:in `<main>'
When following your tutorial i've used rbenv with ruby 1.9.3-p194 as in deployment-machine.
I've created database on MySQL and migrate also works.
Thanks in advance and sorry for my english.
Did you make sure to include the rbenv or rvm gems for capistrano and configuration?
Thanks for the tutorial, first of all, none of the articles at digitalocean worked for me.
I followed all the steps (using rvm for ruby installation), but when I do 'cap production deploy', I get the following error:
deploy@testdroplet:~/myapp$ cap production deploy --trace
** Invoke production (first_time)
** Execute production
** Invoke load:defaults (first_time)
** Execute load:defaults
** Invoke bundler:map_bins (first_time)
** Execute bundler:map_bins
** Invoke rvm:hook (first_time)
** Execute rvm:hook
DEBUG [971a1192] Running /usr/bin/env [ -d ~/.rvm ] on 188.226.143.213
DEBUG [971a1192] Command: [ -d ~/.rvm ]
cap aborted!
deploy
/home/deploy/.rvm/gems/ruby-2.0.0-p353/gems/net-ssh-2.7.0/lib/net/ssh.rb:215:in `start'
/home/deploy/.rvm/gems/ruby-2.0.0-p353/gems/sshkit-1.3.0/lib/sshkit/backends/connection_pool.rb:25:in `create_or_reuse_connection'
/home/deploy/.rvm/gems/ruby-2.0.0-p353/gems/sshkit-1.3.0/lib/sshkit/backends/netssh.rb:173:in `ssh'
/home/deploy/.rvm/gems/ruby-2.0.0-p353/gems/sshkit-1.3.0/lib/sshkit/backends/netssh.rb:126:in `block in _execute'
/home/deploy/.rvm/gems/ruby-2.0.0-p353/gems/sshkit-1.3.0/lib/sshkit/backends/netssh.rb:123:in `tap'
/home/deploy/.rvm/gems/ruby-2.0.0-p353/gems/sshkit-1.3.0/lib/sshkit/backends/netssh.rb:123:in `_execute'
/home/deploy/.rvm/gems/ruby-2.0.0-p353/gems/sshkit-1.3.0/lib/sshkit/backends/netssh.rb:62:in `test'
/home/deploy/.rvm/gems/ruby-2.0.0-p353/gems/capistrano-rvm-0.1.1/lib/capistrano/tasks/rvm.rake:19:in `block (3 levels) in <top (required)="">'
/home/deploy/.rvm/gems/ruby-2.0.0-p353/gems/sshkit-1.3.0/lib/sshkit/backends/netssh.rb:54:in `instance_exec'
/home/deploy/.rvm/gems/ruby-2.0.0-p353/gems/sshkit-1.3.0/lib/sshkit/backends/netssh.rb:54:in `run'
/home/deploy/.rvm/gems/ruby-2.0.0-p353/gems/sshkit-1.3.0/lib/sshkit/runners/parallel.rb:12:in `block (2 levels) in execute'
Tasks: TOP => rvm:hook
I've been trying to fix it for a few hours now with no luck.
Any help would be appreciated,
Ulugbek
Sounds like an SSH authentication problem. Take a look at the people here who also had the same problem. https://github.com/capistra...
Hi Chris, great tutorial! My one question is -- how can I apply this for multiple Rails apps hosted on the same Digital Ocean server?
Thanks.
Pretty simple, all you need to do is to deploy multiple apps with Capistrano and setup multiple nginx server blocks. You'll be able to simply upload the new apps and everything will be already setup so long as you tell nginx to respond to those on the correct domains.
Thanks for this. I am getting an error on installing passenger, it looks like the apt source changed according to this:
http://www.modrails.com/doc...
So this:
sudo sh -c "echo 'deb https://oss-binaries.phusio... 12.04 main' >> /etc/apt/sources.list.d/passenger.list"
should be:
sudo sh -c "echo 'deb https://oss-binaries.phusio... precise main' >> /etc/apt/sources.list.d/passenger.list"
Oh shoot, thanks! I missed this when I rewrote the site. Fixed now.
I'd also add libffi-dev to the first apt-get install before compiling ruby.
Not a bad idea, I'll see about adding that shortly.
Hi, amazing tutorial! Can you update it for 14.04?
It is in the works! First we're waiting on the passenger package to get updated for 14.04. I'm going to try it with an older version, but we'll see.
I'm not sure if anyone else is getting this, but I'm running into an issue deploying my app. When I run the Capistrano deploy script it's not generating the same file structure I anticipate, here's my error:
DEBUG [e8519776] Running /usr/bin/env [ -f /home/deploy/blog/shared/config/database.yml ] on sm-beta.cloudapp.net
DEBUG [e8519776] Command: [ -f /home/deploy/blog/shared/config/database.yml ]
DEBUG [e8519776] Finished in 1.009 seconds with exit status 1 (failed).
ERROR linked file /home/deploy/blog/shared/config/database.yml does not exist on sm-beta.cloudapp.net
Looked around on Google for a bit and, supposedly, this shouldn't break my deploy which means something else is up. Any ideas where I might be able to look for other problem spots? If I ls into my blog app I only have two folders, 'releases' and 'shared'. Any thoughts/pointers are greatly appreciated!
I imagine that it's trying to run migrations and the database.yml would be required for that. You can hop on to the server and create that file if you don't have it in your repo. Setup a production
section with the right credentials.
hi i am newbie... help me here.. i got my app added in to github. I have digital ocean vps with ubuntu 12.04. I am deploying my app to server now.
I have done everything untill Capistrano Setup
the problem is it's confusing me mainly this line "The first step is to add Capistrano to your Gemfile". i have checked my server files using sftp client and i couldn't find it.
can you please specify the path of Gemfile please. I am almost close to deploy my app and i am stuck with this thing. It might be easy for you but i am new to rails. Please send a reply asap.
Jinu
Hey Jinu, your Gemfile should be in the top folder of your Rails app. This is what defines your version of Rails and other gems that you use. You want to edit the Gemfile on your computer first (not on the server) to add Capistrano.
Hi Chris,
can you look in to it.
Open up /etc/nginx/sites-enabled/default in your text editor
how to do it?
When i did cap production deploy i got following error its connecting to mydomain.com and ip address but i don't know whts happening. please someone help
cap aborted!
SocketError: getaddrinfo: Name or service not known
/home/hub/.rvm/gems/ruby-2.1.0/gems/net-ssh-2.7.0/lib/net/ssh/transport/session.rb:67:in `initialize'
/home/hub/.rvm/gems/ruby-2.1.0/gems/net-ssh-2.7.0/lib/net/ssh/transport/session.rb:67:in `open'
/home/hub/.rvm/gems/ruby-2.1.0/gems/net-ssh-2.7.0/lib/net/ssh/transport/session.rb:67:in `block in initialize'
/home/hub/.rvm/gems/ruby-2.1.0/gems/net-ssh-2.7.0/lib/net/ssh/transport/session.rb:67:in `initialize'
/home/hub/.rvm/gems/ruby-2.1.0/gems/net-ssh-2.7.0/lib/net/ssh.rb:200:in `new'
/home/hub/.rvm/gems/ruby-2.1.0/gems/net-ssh-2.7.0/lib/net/ssh.rb:200:in `start'
/home/hub/.rvm/gems/ruby-2.1.0/gems/sshkit-1.3.0/lib/sshkit/backends/connection_pool.rb:25:in `create_or_reuse_connection'
/home/hub/.rvm/gems/ruby-2.1.0/gems/sshkit-1.3.0/lib/sshkit/backends/netssh.rb:173:in `ssh'
/home/hub/.rvm/gems/ruby-2.1.0/gems/sshkit-1.3.0/lib/sshkit/backends/netssh.rb:126:in `block in _execute'
/home/hub/.rvm/gems/ruby-2.1.0/gems/sshkit-1.3.0/lib/sshkit/backends/netssh.rb:123:in `tap'
/home/hub/.rvm/gems/ruby-2.1.0/gems/sshkit-1.3.0/lib/sshkit/backends/netssh.rb:123:in `_execute'
/home/hub/.rvm/gems/ruby-2.1.0/gems/sshkit-1.3.0/lib/sshkit/backends/netssh.rb:62:in `test'
/home/hub/.rvm/gems/ruby-2.1.0/bundler/gems/rvm-dc35ec5e7a74/lib/capistrano/tasks/rvm.rake:19:in `block (3 levels) in <top (required)="">'
/home/hub/.rvm/gems/ruby-2.1.0/gems/sshkit-1.3.0/lib/sshkit/backends/netssh.rb:54:in `instance_exec'
/home/hub/.rvm/gems/ruby-2.1.0/gems/sshkit-1.3.0/lib/sshkit/backends/netssh.rb:54:in `run'
/home/hub/.rvm/gems/ruby-2.1.0/gems/sshkit-1.3.0/lib/sshkit/runners/parallel.rb:12:in `block (2 levels) in execute'
Tasks: TOP => rvm:hook
(See full trace by running task with --trace)
SocketError: getaddrinfo: Name or service not known
means it cannot connect to the IP address / domain that you put in. Make sure you don't have any typos and that you specified your domain correctly.
hi,
my app using rvm 2.1.1 do i need to use the same in server
It's best to use the same setup on the server if you can. Definitely make sure you're using the same version of Ruby to be on the safe side otherwise bugs can come up. I would upgrade to 2.1.2 because 2.1.1 had compile bugs with readline on Ubuntu.
when i am deploying my app, the deploy path should be new or an already created app? which means when i push my contents. it will got to /home/deploy/myapp
i am just deploying my respo to /home/deploy/myapp (where my app is a fresh directory).
do i need to create scratch rails app before deploying?
then deploy my app in to the scratch rails app?
i have deployed my app to digital ocean. i got current directory. but when i visit current folder and try RAILS_ENV=production bundle exec rake db:create it's saying to bundle install first.
when i am trying to bundle install in current it'd saying install git. i couldn't install git in current right/?
so whats wrong here?
hi chris i done deploy successfully using your guide. the only problem is i am still gettng nginx page on my ip.
i tried touch myapp/current/tmp/restart.txt and it didn't started my app. the ip still showing nginx welcome. wht i did worng here?
You'll need to make sure you delete the default server block for Nginx, add your Rails one, and then run "sudo service nginx restart" to load all those new configs.
hi chris,
i got an error when i am doing seed after deploy... can you tell me whats worng
[schema_associations] Authorization.belongs_to :oauth_provider, :class_name=>"OauthProvider", :foreign_key=>"oauth_provider_id", :inverse_of=>:authorizations
[schema_associations] Authorization.belongs_to :user, :class_name=>"User", :foreign_key=>"user_id", :inverse_of=>:authorizations
Rendered custom/devise/mailer/confirmation_instructions.en.html.slim within layouts/email (30.6ms)
rake aborted!
Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/actionpack-4.0.2/lib/action_dispatch/http/url.rb:59:in `build_host_url'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/actionpack-4.0.2/lib/action_dispatch/http/url.rb:40:in `url_for'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/actionpack-4.0.2/lib/action_dispatch/routing/route_set.rb:670:in `url_for'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/actionpack-4.0.2/lib/action_dispatch/routing/route_set.rb:401:in `url_for'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/actionpack-4.0.2/lib/action_dispatch/routing/route_set.rb:234:in `call'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/actionpack-4.0.2/lib/action_dispatch/routing/route_set.rb:178:in `call'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/actionpack-4.0.2/lib/action_dispatch/routing/route_set.rb:274:in `block (2 levels) in define_url_helper'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/actionpack-4.0.2/lib/action_dispatch/routing/routes_proxy.rb:31:in `user_confirmation_url'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/actionpack-4.0.2/lib/action_dispatch/routing/routes_proxy.rb:34:in `method_missing'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/devise-3.1.2/lib/devise/controllers/url_helpers.rb:50:in `confirmation_url'
/home/deploy/silcom/releases/20140530151732/app/views/custom/devise/mailer/confirmation_instructions.en.html.slim:7:in `_app_views_custom_devise_mailer_confirmation_instructions_en_html_slim__458522283_113549150'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/actionpack-4.0.2/lib/action_view/template.rb:143:in `block in render'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/activesupport-4.0.2/lib/active_support/notifications.rb:161:in `instrument'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/actionpack-4.0.2/lib/action_view/template.rb:141:in `render'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/actionpack-4.0.2/lib/action_view/renderer/template_renderer.rb:49:in `block (2 levels) in render_template'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/actionpack-4.0.2/lib/action_view/renderer/abstract_renderer.rb:38:in `block in instrument'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/activesupport-4.0.2/lib/active_support/notifications.rb:159:in `block in instrument'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/activesupport-4.0.2/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/activesupport-4.0.2/lib/active_support/notifications.rb:159:in `instrument'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/actionpack-4.0.2/lib/action_view/renderer/abstract_renderer.rb:38:in `instrument'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/actionpack-4.0.2/lib/action_view/renderer/template_renderer.rb:48:in `block in render_template'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/actionpack-4.0.2/lib/action_view/renderer/template_renderer.rb:56:in `render_with_layout'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/actionpack-4.0.2/lib/action_view/renderer/template_renderer.rb:47:in `render_template'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/actionpack-4.0.2/lib/action_view/renderer/template_renderer.rb:17:in `render'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/actionpack-4.0.2/lib/action_view/renderer/renderer.rb:42:in `render_template'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/actionpack-4.0.2/lib/action_view/renderer/renderer.rb:23:in `render'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/actionpack-4.0.2/lib/abstract_controller/rendering.rb:127:in `_render_template'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/actionpack-4.0.2/lib/abstract_controller/rendering.rb:120:in `render_to_body'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/actionpack-4.0.2/lib/abstract_controller/rendering.rb:97:in `render'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/actionmailer-4.0.2/lib/action_mailer/base.rb:755:in `block in collect_responses'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/actionmailer-4.0.2/lib/action_mailer/base.rb:769:in `each'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/actionmailer-4.0.2/lib/action_mailer/base.rb:769:in `each_template'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/actionmailer-4.0.2/lib/action_mailer/base.rb:751:in `collect_responses'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/actionmailer-4.0.2/lib/action_mailer/base.rb:691:in `mail'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/devise-3.1.2/lib/devise/mailers/helpers.rb:16:in `devise_mail'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/devise-3.1.2/app/mailers/devise/mailer.rb:6:in `confirmation_instructions'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/actionpack-4.0.2/lib/abstract_controller/base.rb:189:in `process_action'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/actionpack-4.0.2/lib/abstract_controller/callbacks.rb:18:in `block in process_action'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/activesupport-4.0.2/lib/active_support/callbacks.rb:373:in `_run__527241932__process_action__callbacks'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/activesupport-4.0.2/lib/active_support/callbacks.rb:80:in `run_callbacks'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/actionpack-4.0.2/lib/abstract_controller/callbacks.rb:17:in `process_action'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/actionpack-4.0.2/lib/abstract_controller/base.rb:136:in `process'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/actionpack-4.0.2/lib/abstract_controller/rendering.rb:44:in `process'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/actionmailer-4.0.2/lib/action_mailer/base.rb:503:in `process'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/actionmailer-4.0.2/lib/action_mailer/base.rb:497:in `initialize'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/actionmailer-4.0.2/lib/action_mailer/base.rb:480:in `new'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/actionmailer-4.0.2/lib/action_mailer/base.rb:480:in `method_missing'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/devise-3.1.2/lib/devise/models/authenticatable.rb:175:in `send_devise_notification'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/devise-3.1.2/lib/devise/models/confirmable.rb:102:in `send_confirmation_instructions'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/devise-3.1.2/lib/devise/models/confirmable.rb:158:in `send_on_create_confirmation_instructions'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/activesupport-4.0.2/lib/active_support/callbacks.rb:386:in `_run__437918340__create__callbacks'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/activesupport-4.0.2/lib/active_support/callbacks.rb:80:in `run_callbacks'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/activerecord-4.0.2/lib/active_record/callbacks.rb:306:in `create_record'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/activerecord-4.0.2/lib/active_record/timestamp.rb:57:in `create_record'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/activerecord-4.0.2/lib/active_record/persistence.rb:477:in `create_or_update'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/activerecord-4.0.2/lib/active_record/callbacks.rb:302:in `block in create_or_update'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/activesupport-4.0.2/lib/active_support/callbacks.rb:413:in `_run__437918340__save__callbacks'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/activesupport-4.0.2/lib/active_support/callbacks.rb:80:in `run_callbacks'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/activerecord-4.0.2/lib/active_record/callbacks.rb:302:in `create_or_update'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/activerecord-4.0.2/lib/active_record/persistence.rb:128:in `save!'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/activerecord-4.0.2/lib/active_record/validations.rb:57:in `save!'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/activerecord-4.0.2/lib/active_record/attribute_methods/dirty.rb:41:in `save!'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/activerecord-4.0.2/lib/active_record/transactions.rb:275:in `block in save!'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/activerecord-4.0.2/lib/active_record/transactions.rb:326:in `block in with_transaction_returning_status'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/activerecord-4.0.2/lib/active_record/connection_adapters/abstract/database_statements.rb:200:in `transaction'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/activerecord-4.0.2/lib/active_record/transactions.rb:209:in `transaction'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/activerecord-4.0.2/lib/active_record/transactions.rb:323:in `with_transaction_returning_status'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/activerecord-4.0.2/lib/active_record/transactions.rb:275:in `save!'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/state_machine-1.2.0/lib/state_machine/integrations/active_record.rb:487:in `block in save!'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/state_machine-1.2.0/lib/state_machine/integrations/active_record.rb:502:in `block (2 levels) in around_save'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/state_machine-1.2.0/lib/state_machine/transition_collection.rb:150:in `block in run_actions'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/state_machine-1.2.0/lib/state_machine/transition_collection.rb:170:in `catch_exceptions'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/state_machine-1.2.0/lib/state_machine/transition_collection.rb:148:in `run_actions'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/state_machine-1.2.0/lib/state_machine/transition_collection.rb:133:in `run_callbacks'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/state_machine-1.2.0/lib/state_machine/transition_collection.rb:212:in `run_callbacks'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/state_machine-1.2.0/lib/state_machine/transition_collection.rb:63:in `block (2 levels) in perform'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/state_machine-1.2.0/lib/state_machine/transition_collection.rb:63:in `catch'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/state_machine-1.2.0/lib/state_machine/transition_collection.rb:63:in `block in perform'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/state_machine-1.2.0/lib/state_machine/transition_collection.rb:186:in `within_transaction'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/state_machine-1.2.0/lib/state_machine/transition_collection.rb:62:in `perform'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/state_machine-1.2.0/lib/state_machine/integrations/active_record.rb:502:in `block in around_save'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/state_machine-1.2.0/lib/state_machine/integrations/active_record.rb:530:in `block in transaction'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/activerecord-4.0.2/lib/active_record/connection_adapters/abstract/database_statements.rb:202:in `block in transaction'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/activerecord-4.0.2/lib/active_record/connection_adapters/abstract/database_statements.rb:210:in `within_new_transaction'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/activerecord-4.0.2/lib/active_record/connection_adapters/abstract/database_statements.rb:202:in `transaction'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/activerecord-4.0.2/lib/active_record/transactions.rb:209:in `transaction'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/state_machine-1.2.0/lib/state_machine/integrations/active_record.rb:529:in `transaction'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/state_machine-1.2.0/lib/state_machine/integrations/active_record.rb:501:in `around_save'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/state_machine-1.2.0/lib/state_machine/integrations/active_record.rb:487:in `save!'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/protected_attributes-1.0.5/lib/active_record/mass_assignment_security/validations.rb:17:in `create!'
/home/deploy/silcom/releases/20140530151732/db/seeds.rb:135:in `<top (required)="">'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:223:in `load'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:223:in `block in load'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:214:in `load_dependency'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:223:in `load'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/railties-4.0.2/lib/rails/engine.rb:540:in `load_seed'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/activerecord-4.0.2/lib/active_record/tasks/database_tasks.rb:154:in `load_seed'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/activerecord-4.0.2/lib/active_record/railties/databases.rake:181:in `block (2 levels) in <top (required)="">'
Tasks: TOP => db:seed
(See full trace by running task with --trace)
Well it says: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true
So you need to set that in your different environment.rb files. Probably forgot to add that in your production.rb
hi i got one more error. while seeding, can you tell my i am seeing this... do i need to start redis-server in production server too?
2014-05-30T18:17:32Z 20938 TID-14fa9g INFO: Sidekiq client with redis options {}
rake aborted!
Error connecting to Redis on 127.0.0.1:6379 (ECONNREFUSED)
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/redis-3.0.6/lib/redis/client.rb:278:in `rescue in establish_connection'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/redis-3.0.6/lib/redis/client.rb:273:in `establish_connection'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/redis-3.0.6/lib/redis/client.rb:69:in `connect'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/redis-3.0.6/lib/redis/client.rb:292:in `ensure_connected'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/redis-3.0.6/lib/redis/client.rb:179:in `block in process'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/redis-3.0.6/lib/redis/client.rb:258:in `logging'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/redis-3.0.6/lib/redis/client.rb:178:in `process'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/redis-3.0.6/lib/redis/client.rb:149:in `call_pipelined'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/redis-3.0.6/lib/redis/client.rb:121:in `block in call_pipeline'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/redis-3.0.6/lib/redis/client.rb:245:in `with_reconnect'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/redis-3.0.6/lib/redis/client.rb:119:in `call_pipeline'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/redis-3.0.6/lib/redis.rb:2093:in `block in multi'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/redis-3.0.6/lib/redis.rb:36:in `block in synchronize'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/redis-3.0.6/lib/redis.rb:36:in `synchronize'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/redis-3.0.6/lib/redis.rb:2085:in `multi'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/sidekiq-2.17.0/lib/sidekiq/client.rb:159:in `block in raw_push'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/connection_pool-1.2.0/lib/connection_pool.rb:55:in `with'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/sidekiq-2.17.0/lib/sidekiq.rb:67:in `redis'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/sidekiq-2.17.0/lib/sidekiq/client.rb:150:in `raw_push'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/sidekiq-2.17.0/lib/sidekiq/client.rb:50:in `push'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/sidekiq-2.17.0/lib/sidekiq/client.rb:98:in `push'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/sidekiq-2.17.0/lib/sidekiq/worker.rb:83:in `client_push'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/sidekiq-2.17.0/lib/sidekiq/worker.rb:40:in `perform_async'
/home/deploy/silcom/releases/20140530162625/app/observers/user_observer.rb:10:in `after_create'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/rails-observers-0.1.2/lib/rails/observers/active_model/observing.rb:352:in `update'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/rails-observers-0.1.2/lib/rails/observers/activerecord/observer.rb:118:in `block (2 levels) in define_callbacks'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/activesupport-4.0.2/lib/active_support/callbacks.rb:454:in `_run__319964337__create__callbacks'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/activesupport-4.0.2/lib/active_support/callbacks.rb:80:in `run_callbacks'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/activerecord-4.0.2/lib/active_record/callbacks.rb:306:in `create_record'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/activerecord-4.0.2/lib/active_record/timestamp.rb:57:in `create_record'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/activerecord-4.0.2/lib/active_record/persistence.rb:477:in `create_or_update'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/activerecord-4.0.2/lib/active_record/callbacks.rb:302:in `block in create_or_update'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/activesupport-4.0.2/lib/active_support/callbacks.rb:413:in `_run__319964337__save__callbacks'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/activesupport-4.0.2/lib/active_support/callbacks.rb:80:in `run_callbacks'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/activerecord-4.0.2/lib/active_record/callbacks.rb:302:in `create_or_update'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/activerecord-4.0.2/lib/active_record/persistence.rb:128:in `save!'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/activerecord-4.0.2/lib/active_record/validations.rb:57:in `save!'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/activerecord-4.0.2/lib/active_record/attribute_methods/dirty.rb:41:in `save!'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/activerecord-4.0.2/lib/active_record/transactions.rb:275:in `block in save!'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/activerecord-4.0.2/lib/active_record/transactions.rb:326:in `block in with_transaction_returning_status'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/activerecord-4.0.2/lib/active_record/connection_adapters/abstract/database_statements.rb:200:in `transaction'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/activerecord-4.0.2/lib/active_record/transactions.rb:209:in `transaction'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/activerecord-4.0.2/lib/active_record/transactions.rb:323:in `with_transaction_returning_status'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/activerecord-4.0.2/lib/active_record/transactions.rb:275:in `save!'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/state_machine-1.2.0/lib/state_machine/integrations/active_record.rb:487:in `block in save!'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/state_machine-1.2.0/lib/state_machine/integrations/active_record.rb:502:in `block (2 levels) in around_save'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/state_machine-1.2.0/lib/state_machine/transition_collection.rb:150:in `block in run_actions'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/state_machine-1.2.0/lib/state_machine/transition_collection.rb:170:in `catch_exceptions'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/state_machine-1.2.0/lib/state_machine/transition_collection.rb:148:in `run_actions'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/state_machine-1.2.0/lib/state_machine/transition_collection.rb:133:in `run_callbacks'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/state_machine-1.2.0/lib/state_machine/transition_collection.rb:212:in `run_callbacks'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/state_machine-1.2.0/lib/state_machine/transition_collection.rb:63:in `block (2 levels) in perform'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/state_machine-1.2.0/lib/state_machine/transition_collection.rb:63:in `catch'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/state_machine-1.2.0/lib/state_machine/transition_collection.rb:63:in `block in perform'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/state_machine-1.2.0/lib/state_machine/transition_collection.rb:186:in `within_transaction'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/state_machine-1.2.0/lib/state_machine/transition_collection.rb:62:in `perform'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/state_machine-1.2.0/lib/state_machine/integrations/active_record.rb:502:in `block in around_save'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/state_machine-1.2.0/lib/state_machine/integrations/active_record.rb:530:in `block in transaction'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/activerecord-4.0.2/lib/active_record/connection_adapters/abstract/database_statements.rb:202:in `block in transaction'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/activerecord-4.0.2/lib/active_record/connection_adapters/abstract/database_statements.rb:210:in `within_new_transaction'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/activerecord-4.0.2/lib/active_record/connection_adapters/abstract/database_statements.rb:202:in `transaction'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/activerecord-4.0.2/lib/active_record/transactions.rb:209:in `transaction'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/state_machine-1.2.0/lib/state_machine/integrations/active_record.rb:529:in `transaction'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/state_machine-1.2.0/lib/state_machine/integrations/active_record.rb:501:in `around_save'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/state_machine-1.2.0/lib/state_machine/integrations/active_record.rb:487:in `save!'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/protected_attributes-1.0.5/lib/active_record/mass_assignment_security/validations.rb:17:in `create!'
/home/deploy/silcom/releases/20140530162625/db/seeds.rb:135:in `<top (required)="">'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:223:in `load'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:223:in `block in load'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:214:in `load_dependency'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:223:in `load'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/railties-4.0.2/lib/rails/engine.rb:540:in `load_seed'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/activerecord-4.0.2/lib/active_record/tasks/database_tasks.rb:154:in `load_seed'
/home/deploy/silcom/shared/bundle/ruby/2.1.0/gems/activerecord-4.0.2/lib/active_record/railties/databases.rake:181:in `block (2 levels) in <top (required)="">'
Tasks: TOP => db:seed
(See full trace by running task with --trace)
Yeah you'll need to run redis-server in production if you use sidekiq.
Thanks Chris - your tutorial is simply awesome. It's the clearest I could find.
I have an issue though. I followed the tutorial and the deployment was successful. Yet I can't see the app. I can see the Nginx start page at the IP of my droplet (http://5.101.99.81/) but I can't see the app. Locally I see it at localhost:3000/todos but nothing of that sort can be seen at the DO instance. The only place I deviated from your tutorial was at the /etc/nginx/sites-enabled/default.Instead of using server_name mydomain.com; I used the IP address: server_name 5.101.99.81; as I haven't registered the domain yet. Do you think that this is the cause? If not - what else could be wrong?
That would be a problem with your nginx config. The IP address doesn't matter, it's okay to serve up on that instead of a domain. You may have changed the config and not restarted nginx or you did and it was invalid and nginx didn't actually load it. Double check that and the /var/log/nginx/error.log file to see if you have anything wrong there.
Thank you for the great tutorial. I feel a lot more comfortable with Capistrano.
I'm struggling somewhat with Passenger:
"Ruby (Rack) application could not be started"
It cites a problem with the Gemfile ("There was an error in your Gemfile, and Bundler cannot continue. (Bundler::GemfileError)")
And in the Backtrace, it points to an old version of Ruby I had installed on there:
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/bundler-1.1.5/lib/bundler/dsl.rb12in `evaluate'
Any idea how to get Passenger to stop using REE? I have a feeling it's simply an old version of Bundler that is struggling with my more current Gemfile.
Make sure your passenger_ruby line in nginx.conf points to the right location. I think if that fails, it probably falls back to whatever is in your PATH which could be an older version like REE.