Skip to content

Instantly share code, notes, and snippets.

@okjake
Created December 12, 2013 13:06
Show Gist options
  • Select an option

  • Save okjake/7927650 to your computer and use it in GitHub Desktop.

Select an option

Save okjake/7927650 to your computer and use it in GitHub Desktop.
Generic capistrano / capifony configuration for Symfony 2 project deployment to dopey servers
# app/config/deploy.rb
# Replace strings in "CAPITALS"
# Assumptions, adjust to taste:
# - Using Composer
# - No git on remote server
# - Staging and production environments are on the same IP
# - Database and webserver are on the same IP
# = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
require 'capistrano/ext/multistage'
set :application, "APPNAME"
set :stages, %w(staging production)
set :default_stage, "staging"
set :stage_dir, "app/config/deploy"
set :domain, "DOMAIN"
set :app_path, "app"
set :user, "USERNAME"
set :repository, "file:/// LOCAL REPO PATH"
set :scm, :git
set :deploy_via, :capifony_copy_local
set :use_composer, true
set :use_composer_tmp, true
set :shared_children, [app_path + "/logs", web_path + "/uploads", app_path + "/sessions"]
set :model_manager, "doctrine"
set :composer_options, "--no-dev --verbose --prefer-dist --optimize-autoloader --no-progress --no-interaction"
set :use_sudo, false
set :keep_releases, 3
set :shared_files, ["app/config/parameters.yml"]
role :web, domain
role :app, domain, :primary => true
role :db, domain, :primary => true
# Uncomment below for verbose deployment
# logger.level = Logger::MAX_LEVEL
# app/config/deploy/production.rb
set(:deploy_to) { "/REMOTE/PATH/TO/PRODUCTION" }
set(:releases_path) { File.join(deploy_to, version_dir) }
set(:shared_path) { File.join(deploy_to, shared_dir) }
set(:current_path) { File.join(deploy_to, current_dir) }
set(:release_path) { File.join(releases_path, release_name) }
set :keep_releases, 3
set :writable_dirs, ["app/cache", "app/logs", "app/sessions"]
set :webserver_user, "apache"
set :permission_method, :chown
set :use_set_permissions, true
after "deploy:update", "deploy:cleanup"
# app/config/deploy/staging.rb
set(:deploy_to) { "/REMOTE/PATH/TO/STAGING" }
set(:releases_path) { File.join(deploy_to, version_dir) }
set(:shared_path) { File.join(deploy_to, shared_dir) }
set(:current_path) { File.join(deploy_to, current_dir) }
set(:release_path) { File.join(releases_path, release_name) }
set :keep_releases, 3
set :writable_dirs, ["app/cache", "app/logs", "app/sessions"]
set :webserver_user, "apache"
set :permission_method, :chown
set :use_set_permissions, true
after "deploy:update", "deploy:cleanup"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment