Skip to content

Instantly share code, notes, and snippets.

@bdecarne
Created September 28, 2013 00:24
Show Gist options
  • Select an option

  • Save bdecarne/6737014 to your computer and use it in GitHub Desktop.

Select an option

Save bdecarne/6737014 to your computer and use it in GitHub Desktop.
Capifony on Windows
  1. Install Git for Windows – download and install msysGit from official Git site : http://git-scm.com/download/win

  2. Install Ruby – download and install Rubyinstall for Windows : http://rubyinstaller.org/downloads/

  3. Install Capifony – open a Windows command prompt with Ruby – install Capifony with this command :

gem install capifony
  1. Setup local project
cd path/to/your/project
capifony .
  1. Configure to deploy

– Edit ./app/config/deploy.rb file :

set :application, "myappli"
set :domain,      "mydomain.com"
set :user,        "username"
set :use_sudo,    false

set :repository,  "ssh://#{domain}:/var/repo/#{application}.git"
set :scm,         :git
set :deploy_to,   "/var/www/#{application}"

set :app_path,    "app"
set :model_manager, "doctrine"

role :web,        domain                         # Your HTTP server, Apache/etc
role :app,        domain                         # This may be the same as your `Web` server
role :db,         domain, :primary => true       # This is where Symfony2 migrations will run

set  :keep_releases,  3

logger.level = Logger::MAX_LEVEL

set :shared_files,        ["app/config/parameters.yml"]
set :shared_children,     [app_path + "/logs", web_path + "/uploads", "vendor"]
set :use_composer, true
set :update_vendors, true

# Symfony2 >= 2.1
before 'symfony:composer:update', 'symfony:copy_vendors'

namespace :symfony do
  desc "Copy vendors from previous release"
  task :copy_vendors, :except => { :no_release => true } do
    if Capistrano::CLI.ui.agree("Do you want to copy last release vendor dir then do composer install ?: (y/N)")
      capifony_pretty_print "--> Copying vendors from previous release"

      run "cp -a #{previous_release}/vendor #{latest_release}/"
      capifony_puts_ok
    end
  end
end
  1. Setup production server – run this command on local project directory :
cap deploy:setup

– create server side "parameters.yml" in ./shared/app/config/ folder containing at least this parameter :

# /var/www/myappli/shared/app/config/parameters.yml
parameters:
    #...
    secret: ThisTokenIsNotSoSecretChangeIt
  1. Check if everything is ok to deploy
cap deploy:check
  1. Deploy it !
cap deploy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment