- Have SSH access to the target server(s) using PKA (public key authentication)
- Either your public key or a deploy key on the target server(s) has been added to the source repository as a deploy key
- The system you are running deployments from has Ruby 2.2 or later installed (RHEL/CentOS users may reference this gist as a means of meeting this requirement)
-
Install bundler (http://bundler.io/):
gem install bundler
-
Clone the git repository:
git clone [email protected]:classyllama/exampledomain-com.git
-
Install project deployment dependencies:
cd exampledomain-com/tools/cap bundle install
-
Find out what deployment stages (may be better thought of as target configurations) are configured on your system:
ls -1 config/deploy | sed 's/\.rb//'
In a typical setup, you'll likely see
stage
andprod
listed. The former being the stage site where code is tested and the latter being the production system where real customers browse the site. -
Move into the
tools/cap
directory of your project repository:cd exampledomain-com/tools/cap
-
Run the following deployment command, replacing
<stage>
with one of the stages listed in step #1:bundle exec cap <stage> deploy
The output of this command should look something like the following:
00:00 git:wrapper 01 mkdir -p /home/www-data/tmp ✔ 01 www-data@target-server 0.876s /// a lot of additional output here... 00:10 deploy:cleanup Keeping 10 of 11 deployed releases on target-server 01 rm -rf /var/www/data/releases/20161103160141 ✔ 01 www-data@target-server 0.727s 00:10 deploy:log_revision 01 echo "Branch master (at 4a6b0d4b1cd42a91f4cfed13aecf395629ebdfbd) deployed as release... ✔ 01 www-data@target-server 0.085s
-
Load up the site and verify the deployment ran successfully