Skip to content

Instantly share code, notes, and snippets.

@neidiom
Forked from albankora/capistrano-3-basic-set-up
Created February 9, 2017 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save neidiom/8d2240fcab4e3d90e57b1a185b5129ac to your computer and use it in GitHub Desktop.
Save neidiom/8d2240fcab4e3d90e57b1a185b5129ac to your computer and use it in GitHub Desktop.
Capistrano 3 basic set up
#create a public key base on the link bellow
https://www.digitalocean.com/community/tutorials/how-to-set-up-ssh-keys--2
#the local public key has to be added on bitbucket.com and the remote server
https://help.github.com/articles/generating-ssh-keys/
#if you added a pass phrase to the key you need to add your public key to the remote server
http://capistranorb.com/documentation/getting-started/authentication-and-authorisation/#toc_3
#set up the public ssh to your account
bitbucket.com → Manage accounts → SSH key → add key
#CAUTION change your www directory permission to user
sudo chown -R [user]:[user] /var/www
#CAUTION add key to the ssh agent
ssh-add
#add bitbucket domain to ssh known domains
ssh -T git@bitbucket.com
#install ruby on ubuntu
sudo apt-get install ruby-full
#install capistrano
sudo gem install capistrano
#install capistrano to a project
cd /path/to/project
cap install
#the deploy and production configures content
# deploy.rb
set :log_level, :info
set :application, 'testrepo'
set :repo_url, 'git@theRepoUrl'
set :deploy_to, "/var/www/#{fetch(:application)}"
set :scm, :git
set :keep_releases, 5
# production.rb
set :stage, :production
role :app, %w{user@serverip} # EDIT your ssh username and server ip address
#reference articles
https://github.com/capistrano/capistrano/blob/master/lib/capistrano/templates/deploy.rb.erb
http://jeremykendall.net/2013/11/24/php-and-capistrano-3-notes-to-self/
http://borisguery.com/blog/2013/11/27/php-deployment-with-capistrano-3-dot-x/
https://www.airpair.com/laravel/posts/automating-laravel-deployments-using-capistrano
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment