Capistrano::Forkcms

Fork CMS specific Capistrano tasks

Capistrano ForkCMS - Easy deployment of ForkCMS 5+ apps with Ruby over SSH.

Installation

Add this line to your application's Gemfile:

gem 'capistrano-forkcms'

And then execute:

$ bundle

Usage

Require the module in your Capfile:

require "capistrano/forkcms"

The plugin comes with two tasks:

  • forkcms:configure:composer, which will configure the capistrano/composer plugin.
  • forkcms:opcache:reset, which will reset the opcache.
  • forkcms:symlink:document_root, which will link the document_root to the current-folder.

But you won't need any of them as everything is wired automagically.

Configuration

Configuration options:

  • :php_bin_custom_path, this will allow you to configure a custom PHP binary, the fallback is php.
  • :opcache_reset_strategy, the reset strategy. Possible options: file, fcgi
  • opcache_reset_fcgi_connection_string, the fcgi-connection string used for the cachetool. required when :opcache_reset_strategy is fcgi.
  • opcache_reset_base_url, the public url of your website. Required when :opcache_reset_strategy is file

How to use with a fresh Fork install

  1. Create a Capfile with the content below:
# Load DSL and set up stages
require "capistrano/setup"

# Include default deployment tasks
require "capistrano/deploy"

require "capistrano/scm/git"
install_plugin Capistrano::SCM::Git

require "capistrano/forkcms"

# Load custom tasks from `lib/capistrano/tasks` if you have any defined
Dir.glob("lib/capistrano/tasks/*.rake").each { |r| import r }
  1. Create a file called config/deploy.rb, with the content below:
set :application, "$your-application-name"
set :repo_url, "$your-repo-url"

set :keep_releases, 3
  1. Create a file called config/deploy/production.rb, with the content below:
... @todo, fix this
  1. Create a file called config/deploy/staging.rb, with the content below:
server "$your-server-hostname", user: "sites", roles: %w{app db web}
set :deploy_to, "$your-path-where-everything-should-be-deployed" # eg: /home/johndoe/apps/website
set :document_root, "$your-document-root" # eg: /var/www

set :opcache_reset_strategy, "fcgi"
set :opcache_reset_fcgi_connection_string, "$your-php-fpm-socket-or-connection-string" # eg: /var/run/php_71_fpm_sites.sock

# or if you are not using FCGI/FPM
#set :opcache_reset_strategy, "file"
#set :opcache_reset_base_url, "$your-public-url" # eg: "http://www.fork-cms.com"

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/tijsverkoyen/capistrano-forkcms.

License

The gem is available as open source under the terms of the MIT License.