Moving Forge Deploy Script to Envoy
As we start to move off of Forge I still want the automation to take place after all tests pass.
In Codeship or Locally I just follow some instructions from here http://laravel.com/docs/4.2/ssh
Locally
Setup Envoy globally as noted.
Run envoy init
And then I pasted this into my Envoy.blade.php
@servers(['dev' => 'behat_dev'])
@task('deploy_dev', ['on' => 'dev'])
date
cd /home/forge/foo-dev
git pull origin dev
composer config -g github-oauth.github.com sometoken
composer install
composer dump-autoload
php artisan dump-autoload
php artisan migrate
php artisan migrate:refresh --seed
~/node_modules/bower/bin/bower install
npm install
php artisan queue:restart
@endtask
Setup you .ssh config
The behat_dev is a shortcut to the server I made in my ~/.ssh/config
Host foo_dev
Hostname 104.111.111.111
User forge
So now locally I can run
envoy run deploy_dev
Codeship
Setup the server
sudo composer global require "laravel/envoy=~1.0"
Edit your ~/.ssh/config
Host behat_dev
Hostname localhost
User forge
Make sure to put your key into authorized keys
cd .ssh
cat id_rsa.pub >> authorized_keys
Try logging in
ssh behat_dev
Then setup codeship
Under the Deployment settings use script
ssh forge@104.111.111.111 'cd ~/foo-dev && envoy run deploy_dev'
Make sure you codeship public key is also on the destination server
comments powered by Disqus