chrico / wordpress-capistrano-starter
Starterkit to deploy your `wp-content`-directory.
Installs: 8
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Language:Ruby
Type:project
pkg:composer/chrico/wordpress-capistrano-starter
Requires
- php: >=5.4
- composer/installers: 1.*
Requires (Dev)
- php: >=5.4
- wpackagist-plugin/loco-translate: 1.5.5
- wpackagist-plugin/p3-profiler: 1.5.3.9
- wpackagist-plugin/theme-check: 20151211.1
This package is auto-updated.
Last update: 2021-05-17 19:40:55 UTC
README
Table of Contents
- Requirements
- Configure Capistrano
- Local Development
- Remote Server
- Directory structure
- wp-config.php
- Commands
Requirements
- Ruby >= 2.0
- Capistrano 3.4.0
- Bundler
- Composer
- Access via SSH Key to Server
Install Ruby
$ 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.
Howto install: http://capistranorb.com/documentation/getting-started/installation/
$ 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.
$ gem install bundler
$ bundler -v
Bundler version 1.11.2
Install Composer
Composer is a Dependency Manager for PHP.
- Howto install https://getcomposer.org/download/
Configure Capistrano
Basic configuration
Go to config/deploy.rb and configure your application-name and repo_url.
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).
Set your host, user and webdir which is the relative path to your web project on remote server.
Local development
This Starterkit only represents your wp-content-directory and does not restrict your local workflow. You can..
- Replace your
wp-contentlocally. - 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.
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:
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:
- Test SSH-connection.
- Check Git-connection.
- Create folders withing
deployments/.
Deployment and Rollback
$ cap {environment} deploy
What happens:
- Read the HEAD of the selected branch.
- Create
shared-folder if not existing. - Update
~/deployments/repoviagit checkout. - Execute
composer update. - Create
release-folder if not existing. - Create new folder - with date and time as name - in
release. - Copy the current branch from
repointo this folder. - Update all symlinks for
releases/{latest release}andshared/tocurrent/. - Cleanup old releases - by default the last 5 releases.
$ cap {environment} deploy:rollback
What happens:
- Change Symlink on
current/inrelease/{current release - 1}.