You’re not receiving notifications from this thread.
Deploy Ubuntu 14.04 Trusty Tahr Discussion
The following commands should be slightly modified:
cap install STAGES=production
cap production deploy
I believe it should be the following:
bundle exec cap install STAGES=production
bundle exec cap production deploy
If you run 'cap' directly from the shell, it searches standard linux PATH and says that cap is not installed.
In other words, the binary is in gems folder ( ~/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/capistrano-3.1.0/bin/cap ) and should be called with bundle exec.
At least that's what I found out trying to replicate the installation.
Thanks for this guide, it's my first time trying to deploy an app in rails. With a little help from google and stackoverflow I managed to set it all up and finally created a db, but when I visit my site in the browser I get an error page. It says to check my log file in var/log/nginx but when I try to go there it says:
-bash: cd: nginx: Permission denied
Any idea how I can see the error log? and also do I maybe need to do anything else not mentioned in this guide to get the site live?
You need to add a beginning slash to that command:
cd /var/log/nginx/ or just view it by doing
sudo less /var/log/nginx/error.log
That file will have your Nginx and passenger logs, but your Rails app will contain your Rails errors. Use
less /home/deploy/MYAPP/current/log/production.log to view that.
If you send me your error, I can give you some more guidance on fixing it.
Hey, small typo thing: if you select to install with 2.0.0-p481
the Capfile section still says:
# set :rbenv_ruby, '2.0.0-p451'
# set :rvm_ruby_version, '2.0.0-p451'
I'm having capistrano failing on this command of deployment [ -f home/deploy/codeblog/repo/HEAD ]
actually, it looks like that failure is fine.. however when it's trying to mirror my git repo it's giving me this error: fatal: destination path 'home/deploy/codeblog/repo' already exists and is not an empty directory. When i ssh into the server and look at the file structure that folder isn't there.
When I run the command (gem 'capistrano', '~> 3.1.0' It returns this error "unknown command capistrano" any ideas why this might be happening?
This is tutorial is awesome, but i got server hacked withing 3 days on digital ocean. Be sure you close ssh with login/password http://lani78.com/2008/08/0...
Awesome tut, thank you very much.
I managed to deploy but I have an error "We're sorry, but something went wrong."
when i type sudo less /var/log/nginx/error.log i get the following.
[ 2014-06-17 04:55:18.8418 903/7f6b1e392700 agents/HelperAgent/RequestHandler.h:2262 ]: [Client 20] Cannot checkout session.
Your Ruby version is 1.9.3, but your Gemfile specified 2.1.2 (Bundler::RubyVersionMismatch)
/home/deploy/.rvm/gems/ruby-2.1.2/gems/bundler-1.6.3/lib/bundler/setup.rb:17:in `<top (required)="">'
**omitted same lines***
WARNING:root:could not open file '/etc/apt/sources.list.d/passenger.list'
The program 'rails' can be found in the following packages:
ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-linux]
Been trying the whole day. May you please help.
Hi, thanks for the tut, it seems like a very concise and informative resource.
I seem to have hit an issue though, when running:
cap production deploy
I get an error:
ERROR linked file /home/deploy/my_actual_app_name/shared/config/database.yml does not exist on my.server.ip.address
SSHKit::Runner::ExecuteError: Exception while executing on host my.server.ip.address: exit
The backtrace is pretty unhelpful but the tasks: TOP suggests the issue is originating (as expected) from config/deploy.rb
Tasks: TOP => deploy:check:linked_files
I am using Figaro for keeping my password out of git but that should have nothing to do with the file being sent to the server right?
would you happen to know what may be going wrong here?
Thanks in advance
You'll need to manually create a
database.yml file on your server. It's trying to link it but it hasn't been created yet. So you can ssh in and edit that file
and put in your database config for the server database that you just setup.
Where is the Gem File ? Please give me the exact location of the Gemfile.
"like /home/rails or /etc/nginx etc."
To add the lines :
gem 'capistrano', '~> 3.1.0'
gem 'capistrano-bundler', '~> 1.1.2'
gem 'capistrano-rails', '~> 1.1.1'
# Add this if you're using rbenv
# gem 'capistrano-rbenv', github: "capistrano/rbenv"
Here is the error I see when I try to run the command bundle --binstubs
deploy@sparktransfer:~/AsachTimepass$ bundle --binstubs
/home/deploy/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- bundler (LoadError)
from /home/deploy/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/bin/bundle:7:in `<main>'
I am using passenger_ruby /home/deploy/.rbenv/shims/ruby;
in the nginx.conf file, but it still doesnt work.
Can you help me ?
I have managed to go through and run the complete tutorial, but after running touch APP-NAME/current/tmp/restart.txt I only see an nginx welcome page on the server IP. How can I debug the problem.
I also tried with SERVER-IP instead of WEB-ADDRESS in server-name in /etc/nginx/sites-enabled/default
Where am I go wrong
Ahh I found out I had created a backup for nginx.conf with the name nginx.conf.backup and that was creating all the problem..
Thanks for the tutorial.
I want to add a helpful tip incase anyone else's Rails app has SSL enabled and is not working.
If you have enabled SSL/https on your Rails app, you will need to add another step to this process. I went through this tutorial and was getting ERR_CONNECTION_REFUSED in chrome when I tried to get to my site. I am new to this and it took me hours before I realized what the problem was.
If you follow the steps in this article it should fix the issue.
Soon i would like to write a deployment guide for opensource project https://github.com/sharetri... from non-server guy perspective. And this guide playing a big role, i hope you wouldn't mind that i will reference it via link?
Hi Chris, I've followed this tutorial exactly and I'm getting the following error and can't figure out why. I also have no idea why example.com is there...
cap production deploy:check
[68f3b617] Running /usr/bin/env [ ! -d ~/.rbenv/versions/2.0.0-p481 ] on ***.***.***.***
[68f3b617] Command: [ ! -d ~/.rbenv/versions/2.0.0-p481 ]
[d8d5b994] Running /usr/bin/env [ ! -d ~/.rbenv/versions/2.0.0-p481 ] on example.com
[d8d5b994] Command: [ ! -d ~/.rbenv/versions/2.0.0-p481 ]
[68f3b617] Finished in 1.144 seconds with exit status 1 (failed).
SSHKit::Runner::ExecuteError: Exception while executing on host example.com: No route to host - connect(2)
Errno::EHOSTUNREACH: No route to host - connect(2)
Tasks: TOP => rbenv:validate
Any ideas? Thanks for taking the time to write this up.
Hey, thanks a lot for this tutorial. This is one of the most comprehensive one that I've come across thus far!
I am running into some trouble however. For some reason, the app that is actually up and running on my server is an older version (from like two months ago) of my application, but the "current" version of the app is my desired up-to-date one. (I see this when I review the code in that directory.)
I've specified that the master branch should be deployed, restarted the web and app servers, precompiled assets. But, I still have this older version running.
(I am having the same problem this person had http://stackoverflow.com/qu...
Does anyone have any ideas as to why this may be the case?
this was very useful for me. Thank you very much for the article!
Hi, thanks for this tutorial, I tried to follow every step, I deployed the app with some fails
the vps still showing the nginx welcome message, I can't figure out why!
Thanks for this, quite helpful. I'm having an issue with capistrano.
cap production deploy
Don't know how to build task 'deploy:updated'
with a bunch of other errors after it. I think I set everything up as shown here though – any ideas how to solve this?
Hey Chris, thanks for providing this walkthrough, it's been mostly a breeze. One thing I'm stuck on however is generating the database. When I run RAILS_ENV=production bundle exec rake db:create in the /home/deploy/myapp/current directory, substituting "myapp" for the actual name of my app or course, the vps tells me ruby 2.1.1 is not installed, so I install it, then it wants me to bundle install, and so I do, and finally I'm stuck with "Gem::Ext::BuildError: ERROR: Failed to build gem native extension." type errors as the gems fail to compile. Where did I go wrong? I'd be happy to supply much more insight into this issue, up to and including access to the vps! thanks in advance.