WordPress development with VCCW on AMIMOTO

WordPress development with VCCW on AMIMOTO.

We AMIMOTO recommend VCCW as WordPress development environment.

What is VCCW

http://vccw.cc/

VCCW is Vagrant based development environment for WordPress plugins, themes, or websites.
Developer is Takayuki Miyauchi. He is also involved in the development of AMIMOTO.

Benefits of using VCCW

1: Useful tools are ready-to-use

VCCW provides many development tools ready-to-use:

  • Subversion
  • Git
  • jq
  • WP-CLI
  • WordPress i18n Tools
  • WordPress Coding Standards for PHP_CodeSniffer
  • PHPUnit
  • Composer
  • phpenv
  • php-build
  • Node.js
  • grunt, grunt-cli, grunt-init
  • gulp
  • Ruby 2.1
  • Bundler
  • Wordmove
  • Sass
  • MailCatcher

2: Easy to set up

Simply edit site.yml to configure version of PHP, IP address, memory limits, plugins and any other server configurations.
So you can develop WordPress site in near-production environment.

3: Easy to deploy the data to AMIMOTO

VCCW have WordMove the easiest synchronisation tool between staging and production environment.
WordMove use Moevefile to synchronise data you should create manually. But on AIMOTO, you can create Movefile so easily following these steps and using tools:

https://github.com/amimoto-ami/scaffold-movefile

Development and Deployment flow using VCCW and AMIMOTO

0: preparations

Make sure below line is written in your VCCW’s Vangrantfile.


config.ssh.forward_agent = true

You cannot find it? Copy above line and paste it into Vangrantfile then save it.
If the line is comment outed, remove # and un-comment out then save file, just like below:

from


#config.ssh.forward_agent = true

to


config.ssh.forward_agent = true

Run below command to check Vagrant is working correctly. If Vagrant worked correct, you can see below code on your terminal. You cannot get below code, check your Vagrantfile again.

$ vagrant up
$ vagrant ssh
$ ssh-add -l
// Vagrant returns kind of below code
2048 6e:ef:86:27:2c:a9:xx:xx:xx /Users/xx/.ssh/id_rsa (RSA)

1: Creating Movefile

$ ssh -i /path/to/keyfile/{KEYFILE}.pem ec2-user@xxx.xxx.xxx.xxx
$ curl -L https://raw.githubusercontent.com/amimoto-ami/run-httpd-as-ec2-user/master/run-httpd-as-ec2-user.sh | sudo bash
$ curl https://raw.githubusercontent.com/amimoto-ami/scaffold-movefile/master/run.sh | bash
// It returns below code: 
local:
  vhost: http://vccw.dev
  wordpress_path: /var/www/wordpress
  database:
    name: wordpress
    user: wordpress
    password: wordpress
    host: localhost
    charset: utf8
production:
  vhost: https://example.com
  wordpress_path: /var/www/vhosts/xxxxxxxxxx
  database:
    name: xxxxxxxxxxxxxxx
    user: xxxxxxxxxxx
    password: xxxxxxxxxxxxxxxxxxxxx
    host: localhost
    charset: utf8
  exclude:
    - .git/
    - .gitignore
    - .sass-cache/
    - bin/
    - 'tmp/*'
    - 'Gemfile*'
    - Movefile
    - wp-config.php
    - 'wp-content/*.sql'
  ssh:
    host: example.com
    user: ec2-user

Copy all of outputted code then paste it to text file and save as “Movefile” in VCCW.
Note: never forget to change host name (host: example.com) to production’s one, before save Movefile.

$ exit
$ cd /path/to/vccw
$ vim Movefile

2: Pull production’s data on AMIMOTO to VCCW

$ cd /path/to/vccw/
$ vagrant ssh
$ cd /var/www/wordpress
$ wordmove pull --all

Synchronise production’s files and data to VCCW

3: Develop WordPress site in VCCW

Develop WordPress site in VCCW.

By using these wpcs and phpunit command or Git/Subversion, you can proceed with the development at a high efficiency.

4: Deploy data to production environment

Easy to deploy data to production with below commands:

$ cd /path/to/vccw/
$ vagrant ssh
$ cd /var/www/wordpress
$ wordmove push --all

when you run the last command –wordmove push –all–, it pushes all of files and data on VCCW to the production environment and replaces host name to the domain name written in the Movefile.