michelle
6/30/2016 - 9:56 AM

Setup Capistrano

Setup Capistrano

#1  Set your repo settings on github under settings
#2  Set a deployment key
#3  Add the Cap file in your project directory
#4  Fill out the details of the files - config>deploy.rb & config>deploy>dev.rb

nb: If can't install capistrano, try: sudo gem install capistrano --source http://rubygems.org
nb: Your git key goes in the tmp folder (@root) of server.

Remember: To run the cap dev deploy from within the cap directory (file)


- Change directory in ss_environment file
- navigate to /etc/httpd/conf.d/sites
- vim yoursite.conf and edit details matching the muster file
- service httpd restart
- SSL pass phase for slc.flipsidegroup.com... is
2000Digital
Michelles-MacBook-Pro:elearningplus mwatts$ ls
Vagrantfile	cap		html		puphpet
Michelles-MacBook-Pro:elearningplus mwatts$ cd cap
Michelles-MacBook-Pro:cap mwatts$ ls
Capfile	config	lib	log
Michelles-MacBook-Pro:cap mwatts$ cap dev deploy
-bash: cap: command not found
Michelles-MacBook-Pro:cap mwatts$ gem install capistrano
Fetching: net-ssh-3.2.0.gem (100%)
ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.
Michelles-MacBook-Pro:cap mwatts$ sudo gem install capistrano

WARNING: Improper use of the sudo command could lead to data loss
or the deletion of important system files. Please double-check your
typing when using sudo. Type "man sudo" for more information.

To proceed, enter your password, or type Ctrl-C to abort.

Password:
Fetching: net-ssh-3.2.0.gem (100%)
Successfully installed net-ssh-3.2.0
Fetching: net-scp-1.2.1.gem (100%)
Successfully installed net-scp-1.2.1
Fetching: sshkit-1.11.1.gem (100%)
Successfully installed sshkit-1.11.1
Fetching: airbrussh-1.0.2.gem (100%)
Successfully installed airbrussh-1.0.2
Fetching: i18n-0.7.0.gem (100%)
Successfully installed i18n-0.7.0
Fetching: rake-11.2.2.gem (100%)
rake's executable "rake" conflicts with /usr/bin/rake
Overwrite the executable? [yN]  y
Successfully installed rake-11.2.2
Fetching: capistrano-harrow-0.5.2.gem (100%)

     ___   _   ___ ___ ___ _____ ___    _   _  _  ___
    / __| /_\ | _ \_ _/ __|_   _| _ \  /_\ | \| |/ _ \
   | (__ / _ \|  _/| |\__ \ | | |   / / _ \| .` | (_) |
    \___/_/ \_\_| |___|___/ |_| |_|_\/_/ \_\_|\_|\___/

    Learn about our web-based collaboration and
    automation platform for Capistrano: hrw.io/auto-cap

Successfully installed capistrano-harrow-0.5.2
Fetching: capistrano-3.5.0.gem (100%)
Successfully installed capistrano-3.5.0
Parsing documentation for net-ssh-3.2.0
Installing ri documentation for net-ssh-3.2.0
Parsing documentation for net-scp-1.2.1
Installing ri documentation for net-scp-1.2.1
Parsing documentation for sshkit-1.11.1
Installing ri documentation for sshkit-1.11.1
Parsing documentation for airbrussh-1.0.2
Installing ri documentation for airbrussh-1.0.2
Parsing documentation for i18n-0.7.0
Installing ri documentation for i18n-0.7.0
Parsing documentation for rake-11.2.2
Installing ri documentation for rake-11.2.2
Parsing documentation for capistrano-harrow-0.5.2
Installing ri documentation for capistrano-harrow-0.5.2
Parsing documentation for capistrano-3.5.0
Installing ri documentation for capistrano-3.5.0
8 gems installed
Michelles-MacBook-Pro:cap mwatts$ cap dev deploy
(Backtrace restricted to imported tasks)
cap aborted!
LoadError: cannot load such file -- capistrano/composer
/Users/mwatts/Dev/elearningplus/cap/Capfile:25:in `<top (required)>'
(See full trace by running task with --trace)
Michelles-MacBook-Pro:cap mwatts$ gem install capistrano composer
Fetching: capistrano-3.5.0.gem (100%)
ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.
Michelles-MacBook-Pro:cap mwatts$ gem install capistrano-composer
Fetching: capistrano-composer-0.0.6.gem (100%)
ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.
Michelles-MacBook-Pro:cap mwatts$ sudo gem install capistrano-composer
Fetching: capistrano-composer-0.0.6.gem (100%)
Successfully installed capistrano-composer-0.0.6
Parsing documentation for capistrano-composer-0.0.6
Installing ri documentation for capistrano-composer-0.0.6
1 gem installed
Michelles-MacBook-Pro:cap mwatts$ cap dev deploy
00:00 git:wrapper
      01 mkdir -p /tmp/Elearning/
Text will be echoed in the clear. Please install the HighLine or Termios libraries to suppress echoed text.
elearning@elearning.dev.flipsidegroup.com's password:^C(Backtrace restricted to imported tasks)
cap aborted!
Interrupt: 

Tasks: TOP => git:check => git:wrapper
(See full trace by running task with --trace)
The deploy has failed with an error: 

** DEPLOY FAILED
** Refer to log/capistrano.log for details. Here are the last 20 lines:

 DEBUG [8200687b] Command: /usr/bin/env ln -s /var/www/elearning.dev/html/relea…
  INFO [8200687b] Finished in 0.031 seconds with exit status 0 (successful).
  INFO [e5206031] Running /usr/bin/env mv /var/www/elearning.dev/html/releases/…
 DEBUG [e5206031] Command: /usr/bin/env mv /var/www/elearning.dev/html/releases…
  INFO [e5206031] Finished in 0.037 seconds with exit status 0 (successful).
 DEBUG [ed0f9b3a] Running /usr/bin/env ls -xtr /var/www/elearning.dev/html/rele…
 DEBUG [ed0f9b3a] Command: /usr/bin/env ls -xtr /var/www/elearning.dev/html/rel…
 DEBUG [ed0f9b3a] 	20160607110046	20160607112629	20160617155353	20160627155858	…
 DEBUG [ed0f9b3a] Finished in 0.032 seconds with exit status 0 (successful).
 DEBUG [9d63c5b8] Running if test ! -d /var/www/elearning.dev/html/releases; th…
 DEBUG [9d63c5b8] Command: if test ! -d /var/www/elearning.dev/html/releases; t…
 DEBUG [9d63c5b8] Finished in 0.031 seconds with exit status 0 (successful).
  INFO [0aea83eb] Running /usr/bin/env echo "Branch develop (at a99fff674d374f9…
 DEBUG [0aea83eb] Command: cd /var/www/elearning.dev/html/releases && /usr/bin/…
  INFO [0aea83eb] Finished in 0.030 seconds with exit status 0 (successful).
  INFO ------------------------------------------------------------------------…
  INFO START 2016-06-30 10:39:10 +0100 cap dev deploy
  INFO ------------------------------------------------------------------------…
  INFO [1801adab] Running /usr/bin/env mkdir -p /tmp/Elearning/ as elearning@el…
 DEBUG [1801adab] Command: /usr/bin/env mkdir -p /tmp/Elearning/
Michelles-MacBook-Pro:cap mwatts$ cap dev deploy
00:00 git:wrapper
      01 mkdir -p /tmp/Elearning/
    ✔ 01 elearning@elearning.dev.flipsidegroup.com 0.321s
      Uploading /tmp/Elearning/git-ssh.sh 100.0%
      02 chmod +rx /tmp/Elearning/git-ssh.sh
    ✔ 02 elearning@elearning.dev.flipsidegroup.com 0.028s
00:00 git:check
      01 git ls-remote --heads git@dev-git.flipsidegroup.com:jonathan.flipside/…
      01 e9b94b5e69ebc0631adffb28d3caddcada008537	refs/heads/develop
      01 b8c4ea08f04a2ac7df13c2f74f9331f8e6b159be	refs/heads/ecommerce
      01 cd1d0493ab21078cc9ca9be09694ee2c24a75a2c	refs/heads/feature/OrderHisto…
      01 6a339d085e8c6134538b35c2ae00e166bafc892d	refs/heads/feature/ecommerce
      01 86151ebc1b6e4d0e99e21ecad0d757562d484ac1	refs/heads/master
    ✔ 01 elearning@elearning.dev.flipsidegroup.com 0.414s
00:01 deploy:check:directories
      01 mkdir -p /var/www/elearning.dev/html/shared /var/www/elearning.dev/htm…
    ✔ 01 elearning@elearning.dev.flipsidegroup.com 0.028s
00:01 deploy:check:linked_dirs
      01 mkdir -p /var/www/elearning.dev/html/shared/assets
    ✔ 01 elearning@elearning.dev.flipsidegroup.com 0.028s
00:01 git:clone
      The repository mirror is at /var/www/elearning.dev/html/repo
00:01 git:update
      01 git remote update --prune
      01 Fetching origin
      01 From dev-git.flipsidegroup.com:jonathan.flipside/elearningplus
      01    cd197bc..e9b94b5  develop    -> develop
    ✔ 01 elearning@elearning.dev.flipsidegroup.com 0.468s
00:01 git:create_release
      01 mkdir -p /var/www/elearning.dev/html/releases/20160630094049
    ✔ 01 elearning@elearning.dev.flipsidegroup.com 0.030s
      02 git archive develop | tar -x -f - -C /var/www/elearning.dev/html/relea…
    ✔ 02 elearning@elearning.dev.flipsidegroup.com 0.067s
00:02 git:set_current_revision
      01 echo "e9b94b5e69ebc0631adffb28d3caddcada008537" >> REVISION
    ✔ 01 elearning@elearning.dev.flipsidegroup.com 0.028s
00:02 deploy:symlink:linked_dirs
      01 mkdir -p /var/www/elearning.dev/html/releases/20160630094049
    ✔ 01 elearning@elearning.dev.flipsidegroup.com 0.033s
      02 ln -s /var/www/elearning.dev/html/shared/assets /var/www/elearning.dev…
    ✔ 02 elearning@elearning.dev.flipsidegroup.com 0.028s
00:02 composer:run
      01 composer install --no-dev --prefer-dist --no-interaction --quiet --opt…
    ✔ 01 elearning@elearning.dev.flipsidegroup.com 5.204s
00:07 deploy:symlink:release
      01 ln -s /var/www/elearning.dev/html/releases/20160630094049 /var/www/elearning.dev/html/releases/cur…
    ✔ 01 elearning@elearning.dev.flipsidegroup.com 0.028s
      02 mv /var/www/elearning.dev/html/releases/current /var/www/elearning.dev/html
    ✔ 02 elearning@elearning.dev.flipsidegroup.com 0.028s
00:07 deploy:log_revision
      01 echo "Branch develop (at e9b94b5e69ebc0631adffb28d3caddcada008537) deployed as release 20160630094…
    ✔ 01 elearning@elearning.dev.flipsidegroup.com 0.028s
Michelles-MacBook-Pro:cap mwatts$