3

I'm currently developing a website using Symfony2 and Gitflow. I have 2 external servers called 'development', 'staging' and 'production' and a central GIT repository on Github.

I'm looking to use Capifony to:

  • deploy the 'develop' branch changes to the development server.
  • deploy any releases/hotfixes etc to staging to test
  • deploy the 'master' branch to the live 'production' server

I've been reading this page about multistage deployment and so far have installed capifony with the capistrano extension.

Within my /app/config/deploy.rb file I have the following:

set :stage_dir, 'app/config/deploy' # needed for Symfony2 only
require 'capistrano/ext/multistage'
set :stages, %w(production staging development)

set :application, "MyApp"

set :repository,  "git@github.com:MyCompany/#{application}.git"
set :scm,         :git

set  :keep_releases,  3

I've then got a separate /app/config/development.rb file with the following:

server 'SERVER_IP - PORT NUMBER', :app, :web, :primary => true
set :deploy_to, "/var/www/MyApp/" #directory on server
set :symfony_env_prod, "test"

However, if I run cap development deploy I get an error

the task `development' does not exist

Can someone explain what the 'task' refers to?

Thanks

user1961082
  • 1,015
  • 17
  • 41

1 Answers1

1

Move require 'capistrano/ext/multistage' to the very last line of deploy.rb or at least move the set :stages, %w(production staging development) before it.

MDrollette
  • 6,887
  • 1
  • 36
  • 49
  • Another question, do I have to initialise GIT on the 3 servers before I can deploy from local as I'm now getting a GIT clone error? – user1961082 Feb 09 '13 at 08:08
  • 1
    depends on the error, but it's probably related to your deploy keys. have a look at the agent forwarding part of the capifony docs and see if that helps at all. ```ssh_options[:forward_agent] = true``` – MDrollette Feb 09 '13 at 08:18
  • Thanks. I now get a green tick for 'Creating cache directory' but then a red cross for 'Creating symlinks for shared directories' and the error failed to create symbolic link `/var/www/MyApp/releases/20130209125336/web/uploads' *** [err :: x.xx.xx.xxx] : No such file or directory A /releases/ directory and /shared/web/uploads/ and /shared/app/logs/ directories are created on my development server within /var/www/MyApp/ but nothing else. – user1961082 Feb 09 '13 at 12:58