Help please to configure capistrano for deployment. I have ssh:
- user: User
- host: 8.8.8.8:6554
- pass: 123
Then i have bitbucket repository git@bitbucket.org:somerepo/code.git
- user: Repouser@gmail.com
- pass: repopass
I am just need to deploy code from default branch to User@8.8.8.8:8888:/public_html/test/ . On local machine i have ssh key, that allows me to connect without password. But capistrano didn't connect.
There is my config:
lock '3.3.5'
set :application, 'App'
set :scm, :git
set :repo_url, 'git@bitbucket.org:somerepo/code.git'
set :scm_passphrase, ""
set :scm_user, "Repouser@gmail.com"
set :user, 'User'
set :deploy_to, '/public_html/test'
set :app_dir, "/public_html/test"
set :ssh_options, {:forward_agent => true}
role :web, '8.8.8.8:6554'
namespace :deploy do
after :restart, :clear_cache do
on roles(:web), in: :groups, limit: 3, wait: 10 do
end
end
end
Error:
connection closed by remote host ** Invoke deploy:failed (first_time) ** Execute deploy:failed
Step 1: in Gemfile
Step 2: bundle
Step 3:
cap install
## it will generate set of fileStep 4: go in
Capfile
and paste the following code ## this file will be parallel to your rails applicationStep 5: Config/deploy.rb that will be common to both ENV
This file will be shared/common across the application environment
Step6: Lets create ENV specific file for now For production Environment
config/deploy/production.rb
## this file will be generate bycap install
command that you did earlier no need for this timedo comment all the code except this
Step 6: now do
ssh to your server
ssh User@8.8.8.8:6554
now it will ask for the password ...give password
Step 7: now by default your app will go
/var/www/app
and here you need to create the folder accordingly But in your case as youset :deploy_to, '/public_html/test'
# make sure Dir name is followed by / 'Forward slash' this mistake i did many timesNow add this key to your repo's go to => setting => deployment keys Button => click on that and add
Key
. Put the label name any thing you want and paste thessh key
here.That it from server side
Step8: Now you need to add your ssh key to server For that do
cat ~/.ssh/id_rsa.pub
if you haversa
key other wise generate rsa key it is very easy to crateStep 9: Login to your server using ssh
save and exit
Step 10 :
cap -T
## list out all the taskstep 11:
cap production deploy:check
It will throw an error because database.yml file is not there
For that
vi /public_html/test/shared/config/database.yml
save and exit
Do again
cap production deploy:check
This time would not throw any error
Step 12:
And That's it
Check this also ruby rake task after deploymewnt