2017 © Pedro Peláez
 

project wordpress-capistrano-starter

Starterkit to deploy your `wp-content`-directory.

image

chrico/wordpress-capistrano-starter

Starterkit to deploy your `wp-content`-directory.

  • Ruby
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

WordPress Capistrano Starter

Table of Contents

Requirements

  • Ruby >= 2.0
  • Capistrano 3.4.0
  • Bundler
  • Composer
  • Access via SSH Key to Server

Install Ruby

  • https://www.ruby-lang.org/de/downloads/
  • https://www.ruby-lang.org/de/documentation/installation/
$ ruby -v
ruby 2.2.3p173 (2015-08-18 revision 51636) [x64-mingw32]

Install Capistrano

Capistrano is a remote server automation tool. It supports the scripting and execution of arbitrary tasks, and includes a set of sane-default deployment workflows., (*1)

Howto install: http://capistranorb.com/documentation/getting-started/installation/, (*2)

$ gem install capistrano
$ cap -v
Capistrano Version: 3.4.0 (Rake Version: 10.5.0)

Install Bundler

Bundler is a package manager for Capistrano v3., (*3)

$ gem install bundler
$ bundler -v
Bundler version 1.11.2

Install Composer

Composer is a Dependency Manager for PHP., (*4)

  • Howto install https://getcomposer.org/download/

Configure Capistrano

Basic configuration

Go to config/deploy.rb and configure your application-name and repo_url., (*5)

Environment

To configure your environment, go to config/deploy/staging.rb. The file name equals to your deploy command cap {environment} deploy e.G. cap staging deploy)., (*6)

Set your host, user and webdir which is the relative path to your web project on remote server., (*7)

Local development

This Starterkit only represents your wp-content-directory and does not restrict your local workflow. You can.., (*8)

  • Replace your wp-content locally.
  • Create a symlink to this folder in your WordPress-installation.
  • Load WordPress via Composer
  • ...

To work with Plugins and Themes, just add them to your composer.json and run composer install., (*9)

Remote Server

Directory structure

| /cache
| /deployments
|_ current/ ~> ~/deployments/releases/YYYYMMDDHHIISS/
|__ releases/
|___ <release folders with YYYYMMDDHHIISS>
|__ repo/
|___ <VCS data>
|__ shared/
|___ <linked_files & linked_dirs>
|_ revisions.log
| /tmp
|___ composer.phar
| /www
|___ <WordPress installation>
|___|___ wp-content/ ~> ~/../deployments/current/
| wp-config.php

wp-config.php

To load the correct wp-content/-folder into your WordPress-installation, you've to add following line to your wp-config.php:, (*10)

define( 'WP_CONTENT_DIR', realpath( __DIR__ . '/deployments/current' ) );

Commands

View all available commands

$ cap -T

Check if everything is fine

cap {environment} deploy:check

What happens:, (*11)

  1. Test SSH-connection.
  2. Check Git-connection.
  3. Create folders withing deployments/.

Deployment and Rollback

$ cap {environment} deploy

What happens:, (*12)

  1. Read the HEAD of the selected branch.
  2. Create shared-folder if not existing.
  3. Update ~/deployments/repo via git checkout.
  4. Execute composer update.
  5. Create release-folder if not existing.
  6. Create new folder - with date and time as name - in release.
  7. Copy the current branch from repo into this folder.
  8. Update all symlinks for releases/{latest release} and shared/ to current/.
  9. Cleanup old releases - by default the last 5 releases.
$ cap {environment} deploy:rollback

What happens:, (*13)

  1. Change Symlink on current/ in release/{current release - 1}.

The Versions

23/05 2016

dev-master

9999999-dev

Starterkit to deploy your `wp-content`-directory.

  Sources   Download

The Requires

 

The Development Requires

  • php >=5.4
  • wpackagist-plugin/loco-translate 1.5.5
  • wpackagist-plugin/p3-profiler 1.5.3.9
  • wpackagist-plugin/theme-check 20151211.1