Deployed my app to EC2 using Capistrano, where is it? - ruby-on-rails

So I have a rails app and am deploying to ec2. I successfully did cap deploy:setup, cap deploy:check, and cap:deploy. I then tried to access the url, but I'm not actually sure where my app is or if there are more steps. I tried accessing http://xxx.us-west-2.compute.amazonaws.com/var/www/highlandsfacebookart, but got nothing.
Here is my deploy.rb
set :application, "highlandsfacebookart"
set :repository, "repository-url"
set :user, 'ec2-user'
set :use_sudo, false
set :deploy_to, "/var/www/#{application}#"
#set :deploy_via, :remote_cache
set :deploy_via, :copy
set :normalize_asset_timestamps, false
set :ssh_options, { :forward_agent => true }
ssh_options[:keys] = %w(~/highlandsfbkey.pem)
set :scm, "git"
# set :scm, :git # You can set :scm explicitly or Capistrano will make an intelligent guess based on known version control directory names
# Or: `accurev`, `bzr`, `cvs`, `darcs`, `git`, `mercurial`, `perforce`, `subversion` or `none`
role :web, "xxx.compute.amazonaws.com" # Your HTTP server, Apache/etc
role :app, "xxx.us-west-2.compute.amazonaws.com" # This may be the same as your `Web` server
role :db, "xxx.us-west-2.compute.amazonaws.com", :primary => true # This is where Rails migrations will run
role :db, "xxx.compute.amazonaws.com"

Not sure, but have you configured your instance to serve your website using a web server like Nginx? Set it up so it's listening on port 80 and pointing to the correct folders. Nginx integration in Capistrano is possible I believe.

Can you verify that your instances are running when you're accessing EC2's console on aws.amazon.com/console? (Sorry, I wish I had enough reputation to make this a comment)

Related

Authentication failed for user #domain.com - Capistrano & Rails

I am trying to set up Capistrano to deploy a website on a remote server. When I run the following command:
cap production deploy
I get the following error:
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing on host domain.com: Authentication failed for user #domain.com
Here is my deploy.rb file in the config directory of my Rails app:
...
set :application, 'my-app'
set :repo_url, 'git#bitbucket.org:karns/my-app.git'
set :deploy_to, "/var/www/my-app"
# Default value for :scm is :git
set :scm, :git
set :branch, 'master'
set :user, "deploy"
set :use_sudo, false
set :rails_env, "production"
set :deploy_via, :copy
server "domain.com", roles: [:app, :web, :db], :primary => true
...
To my understanding, deploy is supposed to be the user on the remote server.
What am I missing? Why does the error say "Authentication failed for user #domain.com"? Why wouldn't it say "deploy#domain.com"? If you need any other code, please let me know.

Capistrano ssh_options aws deploy issue

So I'm trying to deploy an app via capistrano, but despite trying several formats for referencing the pem file, it repeatedly asks me for my password. The pem file is in the root directory of the rails project, named highlandsapptestdeploy. Here is my code: also, I'm not sure if my server references are the correct ones or not?
set :application, "highlandsfacebookart"
set :repository, "https://onenoc#bitbucket.org/onenoc/highlands-coffee-art-app.git"
set :user, 'deploy'
set :use_sudo, false
set :deploy_to, "/var/www/#{application}#"
set :deploy_via, :remote_cache
ssh_options[:keys] = %w(/highlandsapptestdeploy/highlandsfbkey.pem)
# set :scm, :git # You can set :scm explicitly or Capistrano will make an intelligent guess based on known version control directory names
# Or: `accurev`, `bzr`, `cvs`, `darcs`, `git`, `mercurial`, `perforce`, `subversion` or `none`
role :web, "ec2-54-200-24-60.us-west-2.compute.amazonaws.com" # Your HTTP server, Apache/etc
role :app, "ec2-54-200-24-60.us-west-2.compute.amazonaws.com" # This may be the same as your `Web` server
role :db, "ec2-54-200-24-60.us-west-2.compute.amazonaws.com", :primary => true # This is where Rails migrations will run
role :db, "ec2-54-200-24-60.us-west-2.compute.amazonaws.com"
I have a feeling your username is incorrect. Are you sure it's "deploy"?
You'll also need to have ssh-agent working on your machine. Once the agent is working correctly you should be able to ssh into the machine without supplying a password or passphrase. Then you'll need to tell Capistrano to forward the authentication from the agent.
ssh_options[:forward_agent] => true

Capistrano deploy fails with "Cannot read username"

i wonder why my cap deployment fails.
I am using capistrano.
Here's my deploy.rb:
set :application, "gppb"
set :repository, "git#github.com:AppSource/gppb.git"
set :scm, :git
set :user, "gppb.com"
set :deploy_to, "/home/gppb.com/apps/#{application}"
set :use_sudo, false
set :keep_releases, 5
# set :scm, :git # You can set :scm explicitly or Capistrano will make an intelligent guess based on known version control directory names
# Or: `accurev`, `bzr`, `cvs`, `darcs`, `git`, `mercurial`, `perforce`, `subversion` or `none`
role :web, "test.gppb.appsource.biz" # Your HTTP server, Apache/etc
role :app, "test.gppb.appsource.biz" # This may be the same as your `Web` server
role :db, "test.gppb.appsource.biz", :primary => true # This is where Rails migrations will run
# if you want to clean up old releases on each deploy uncomment this:
# after "deploy:restart", "deploy:cleanup"
# if you're still using the script/reaper helper you will need
# these http://github.com/rails/irs_process_scripts
# If you are using Passenger mod_rails uncomment this:
namespace :deploy do
task :start do ; end
task :stop do ; end
task :restart, :roles => :app, :except => { :no_release => true } do
run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
end
end
And here is the error:
To see the full image click here-> http://d.pr/i/wnIb
Looks like you should set your :user to "gppbv2". That's the parameter for the remote user on the server. Also, Unix usernames can't have periods in them.

Deploying rails app using Capistrano

I'm trying to deploy my rails app called Blog to my website through Capistrano. I have created a Rails App in cPanel at /rails_app/Blog/ and have deleted the skeleton code that was generated.
When i type this command in the terminal
cap deploy:setup
I get this error message
USER#USER-PC ~/documents/Aptana Studio 3 Workspace/Blog
$ cap deploy:setup
* executing `deploy:setup'
* executing "sudo -p 'sudo password: ' mkdir -p /rails_app/Blog/ /rails_app/Bl
og/releases /rails_app/Blog/shared /rails_app/Blog/shared/system /rails_app/Blog
/shared/log /rails_app/Blog/shared/pids"
servers: ["mydomain.co.nz"]
connection failed for: mydomain.co.nz (Errno::ETIMEDOUT: A connection attempt fail
ed because the connected party did not properly respond after a period of time,
or established connection failed because connected host has failed to respond. -
connect(2))
Here is my deploy.rb file config settings
set :application, "mydomain.co.nz"
set :repository, "set your repository location here"
set :scm, :subversion
# Or: `accurev`, `bzr`, `cvs`, `darcs`, `git`, `mercurial`, `perforce`, `subversion` or `none`
# These are not not part of the defaults
set :port, 12002
set :deploy_to, "/rails_app/Blog/"
#
role :web, application # Your HTTP server, Apache/etc
role :app, application # This may be the same as your `Web` server
role :db, application, :primary => true # This is where Rails migrations will run
role :db, application
try this, this is example of deploy.rb file that work for me
require "bundler/capistrano"
set :application, "testcapistrano"
set :rvm_ruby_string, "ruby-1.9.3-p194#testcapistrano"
require "rvm/capistrano"
set :rvm_type, :user
set :rvm_install_ruby, :install
set :repository, "xyz"
set :scm, :git
# Or: `accurev`, `bzr`, `cvs`, `darcs`, `git`, `mercurial`, `perforce`, `subversion` or `none`
role :web, "testcapistrano.dipak.cs" # Your HTTP server, Apache/etc
role :app, "testcapistrano.dipak.cs" # This may be the same as your `Web` server
role :db, "testcapistrano.dipak.cs", :primary => true # This is where Rails migrations will run
default_run_options[:pty] = true
ssh_options[:forward_agent] = true
set :deploy_to, "/dipak/capistron/"
set :deploy_via, :remote_cache
set :user, "your username"
set :password, "password"
set :use_sudo, false
set :keep_releases, 5
before 'deploy:setup', 'rvm:install_ruby'
# tasks
namespace :deploy do
task :start, :roles => :app do
run "touch #{current_path}/tmp/restart.txt"
end
task :stop, :roles => :app do
# Do nothing.
end
desc "Restart Application"
task :restart, :roles => :app do
run "touch #{current_path}/tmp/restart.txt"
end
end

First Time Capistrano User.have problems(Net::SSH::Disconnect: connection closed by remote host)

I get the problem like this.
$ cap deploy:setup
* executing `deploy:setup'
* executing "sudo -p 'XXXXXXXXX' mkdir -p /home/railsu/bianbian.com /home/railsu/bianbian.com/releases /home/railsu/bianbian.com/shared /home/railsu/bianbian.com/shared/system /home/railsu/bianbian.com/shared/log /home/railsu/bianbian.com/shared/pids"
servers: ["74.207.243.205"]
connection failed for: 74.207.243.205 (Net::SSH::Disconnect: connection closed by remote host)
I already add my computer's public key into the git.
/.ssh/authorized_keys
In the deploy.rb
set :application, "mini-saler"
set :repository, "git#74.207.243.205:mini-saler.git"
set :scm, :git
# Or: `accurev`, `bzr`, `cvs`, `darcs`, `git`, `mercurial`, `perforce`, `subversion` or `none`
role :web, "74.207.243.205" # Your HTTP server, Apache/etc
role :app, "74.207.243.205" # This may be the same as your `Web` server
set :deploy_to, "/home/railsu/bianbian.com"
# if you want to clean up old releases on each deploy uncomment this:
# after "deploy:restart", "deploy:cleanup"
set :user, "railsu"
set :password, "XXXXXXXXXX"
set :sudo_prompt, "XXXXXXXXXX"
My VPS is Linode.
I'm pretty sure this is where it is erring. Any ideas what kind of error this is?
Thanks everyone!!
I see a couple peculiar errors here:

Resources