capistrano-typo3-cms
This is an extension for the deployment tool Capistrano. This extension facilitates the deploy of TYPO3 CMS projects. This tool ist only testet on Unix based systems. A German introduction can be reached here.
It includeds follows additional packages:
Thank you!
Installation
Install it yourself wit rubygems package manager:
gem install capistrano-typo3-cms
Need help to install ruby? Or easer and better with RVM
Usage
Configuration
Capify your project
$ cd /path/to/your/project
$ capify ./
Edit your ./Capfile in your project root to include capistrano-typo3-cms
load 'deploy' if respond_to?(:namespace)
require 'capistrano'
require 'capistrano-typo3-cms'
load 'config/deploy' # remove this line to skip loading any of the default
Edit your ./config/deploy.rb in enable multistage support:
set :stages, %w(production staging)
set :default_stage, "staging"
require 'capistrano/ext/multistage'
set :application, "your-prject-name"
set :user, "www-data"
set :group, "www-data"
Enviroments
- Development: Your local maschine. In best case with a simular operation system to staging and production. On this maschine you run you unit tests. Do you have one? ;o)
- Staging: System to run unit and integration test on system. This is a system that is almost equal to the production system in configuration, data and installed software. Also this instance of your TYPO3 CMS can be a place to present your customer new features befor you deploy it on production.
- Production: Some guys call it also live system. Maybe it's also a life system, if your life depends on everything here works well. It's the last step in our basic deployment process. The place where the client can sea your website. Mybe you can run additional Capistrano task after deploy such a minimize and optimize CSS, Images and Javascript to improve the performance.
It's possible to extend this process with addition steps but theese are the default settings that come with this extension.
set :env_development, "development"
set :env_staging, "staging"
set :env_production, "production"
You will need this, to targeting your deployments.
deploy strategy
set :deploy_via, :rsync_with_remote_cache
set :scm, :git
set :copy_exclude, ".DS_Store", ".git/*", ".git", ".gitignore", ".gitmodules"]
ssh & shell settings
set :use_sudo, false
set :ssh_options, { :keys => %w(~/.ssh/id_dsa ~/.ssh/id_rsa) }
set :ssh_options, { :forward_agent => true }
set :ssh_local, 'ssh'
default_run_options[:shell] = '/bin/bash'
set :php_cli, "php"
rsync (rsync_with_remote_cache)
set :local_cache, "cache/rsync"
set :rsync_options, "-avz --delete --chmod=u=rwx,g=rx,o=r --exclude=*.svn* "
set :copy_exclude, ["REVERSION", ".svn", ".svn/*", ".git/*", ".git", ".gitignore", ".gitmodules"]
set :rsync_local, "rsync"
repository
set :repository, "git@bitbucket.org:vergissberlin/#{application}.git"
set :git_enable_submodules, 1
set :branch, "#{rails_env}"
set :branch, "master"
remote
set :keep_releases, 10
set(:deploy_to) { "/var/www/#{application}/#{rails_env}/deploy" }
set :deploy_via, :remote_cache
set :rails_env, "production"
Add your enviroments settings file at ./config/deploy/staging.rb (for example)
server 'staging.server.eu', :app, :web, :primary => true
set :rails_env, 'staging'
In case of using multistage create config files for every enviroment (deploy/staging.rb):
- http://capifony.org/cookbook/using-the-multistage-extension.html
- https://github.com/capistrano/capistrano/wiki/2.x-Multistage-Extension
Deploy
cap <enviroment> deploy:setup
cap <enviroment> deploy
Project roadmap
Version 0.0.1
- Documentation "Deploying with Capistrano and TYPO3 CMS
- Resolving dependencies for PHP projects
Version 1.0.0
Additional TYPO3:CMS tasks
typo3:cms:setup
typo3:cms:cc
typo3:cms:check
typo3:cms:data:push
typo3:cms:data:pull
typo3:cms:data:backup
Version 2.0.0
Including new package "capistrano-mysql" to manage database data.
mysql:push
mysql:pull
mysql:backup
mysql:sync <source_env> <target_env>
mysql:migrate
Version 3.0.0
Scaffolding
CLI command support to create a new TYPO3 CMS project from the scratch.
$ typo3 init ./
Add progress bar to follow tasks:
-
typo3:cms
- :backup
- :sync
-
mysql
- :backup
- :pull
- :push
Dear PHP Developers
I did not want that this tool may grow to a meta package, so I have refrained from creating unnecessary dependencies. But I want to recommend you some very useful extensions of Capistrano.
Useful Capistrano Extensions
Here is a list of ''Capistrano extension'' you should install:
Installation and activation
sudo gem install capistrano-confirm
After installation, you can add the script to your Capfile:
require 'capistrano-confirm'
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
Install locally
$ cd /path/to/capistrano-typo3-cms/
$ rake build
$ sudo gem install --local pkg/capistrano-typo3-cms-1.0.0.gem
Thanks to
- A special thanks to Jamis Buck and Lee Hambley, the developers of Capistrano.
- Thank you to developers of capistrano-ext and railess-deploy.
- Further thanks JetBrains for a free license for RubyMine.