Skip to content

Instantly share code, notes, and snippets.

@necromant2005
Created November 1, 2012 08:39
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save necromant2005/3992522 to your computer and use it in GitHub Desktop.
Save necromant2005/3992522 to your computer and use it in GitHub Desktop.
recipy php
ssh_options[:keys] = [File.join(Dir.pwd, "config", "ubuntu.pem")]
set :application, "MyAPPNAME"
set :repository, "git@github.com:necromant2005/MYAPPName.git"
# If you aren't deploying to /u/apps/#{application} on the target
# servers (which is the default), you can specify the actual location
# via the :deploy_to variable:
set :deploy_to, "/var/www/#{application}"
# If you aren't using Subversion to manage your source code, specify
# your SCM below:
set :scm, :git
role :app, "ubuntu@ec2-instance.compute.amazonaws.com", :primary => true
set :user, "ubuntu"
set :use_sudo, false
set :branch, "master"
#set :deploy_via, :remote_cache
set :keep_releases, 5
namespace :deploy do
task :before_setup do
sudo "apt-get update"
sudo "apt-get -y upgrade"
sudo "apt-get -y install sysstat nginx php5-fpm php5-dev php-pear git make memcached php5-memcache php-apc"
sudo "rm -f /etc/nginx/sites-enabled/default"
sudo "mkdir -p 777 /var/www"
sudo "mkdir -p 777 /var/www/#{application}"
sudo "chmod -R 777 /var/www/#{application}"
sudo "chown -R ubuntu:ubuntu /var/www/#{application}"
end
task :start do
end
task :stop do
end
task :restart, :roles=>:app do
sudo "cp /var/www/#{application}/current/config/deploy/nginx.conf /etc/nginx/sites-enabled/MyAppName.conf"
sudo "/etc/init.d/nginx restart"
sudo "/etc/init.d/php5-fpm restart"
end
task :finalize_update do
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment