Skip to content
Project template for VIP Go hosted websites with local development environment
Branch: master
Clone or download
Latest commit f4f61db Apr 26, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
deploy Add the core deploy logic Apr 25, 2019
local/public Fix references Apr 25, 2019
public
scripts
.editorconfig
.gitignore Ignore some more Apr 25, 2019
.travis.yml Allow us to disable deploys Apr 26, 2019
LICENSE
Vagrantfile
composer.json Specify at the Composer level instead Apr 25, 2019
docker-compose.yml Avoid merges with the default contents Apr 25, 2019
package-lock.json Lock npm deps Apr 25, 2019
package.json Add the core deploy logic Apr 25, 2019
phpcs-release.xml Don’t check the default theme Apr 25, 2019
phpcs.xml.dist Coding standard fixes Apr 25, 2019
readme.md

readme.md

VIP Go Site Boilerplate

Build Status

A modern setup for WordPress VIP Go hosted projects:

  • 🏭 Uses Composer for adding project dependencies, including plugins and themes.
  • 🌎 Uses Composer autoloader for using any of the popular PHP packages anywhere in the codebase.
  • 👩‍💻 Provides a local development environment based on Docker that can be run inside Vagrant without having to install Docker on the host machine.
  • 🚀 Includes automated build and deploy pipelines to WordPress VIP Go.

Principles and Ideas

Upstream Repositories for Deployment Only

Most enterprise WordPress hosts use Git repositories for tracking the website source code including the built Javascript and CSS files, and PHP dependencies which shouldn't be part of the development repositories. Therefore, we use the host's repositories only for deployment purposes. Deployments consist of all changes bundled into a single Git commit to a timestamp-based "release" branch in the host's repository from which we open a pull request to the deployement target branch.

Reproducible Builds

Deployment process always starts from the same clean state which enables reproducable builds accross different environments such as local development machines and continuous integration services. See the "Deployments" section below for more details.

Requirements

We suggest using Homebrew for installing all project dependencies.

Overview

  • Project plugins and themes can be added as Composer dependencies or manualy to this repository under public/plugins/your-plugin and public/themes/your-theme.
  • Composer dependencies are placed under public/plugins/vendor.
  • Composer autoloader public/plugins/vendor/autoload.php is included in public/vip-config/vip-config.php.
  • Composer installers maps WordPress plugins, themes and mu-plugins to sub-directories under public.

Setup

  1. Create a fresh Git repository from this reference repository:

     composer create-project xwp/vip-go-site --stability dev
    
  2. Add your theme and plugins as Composer dependencies:

     composer require your/theme your/plugin another/plugin
    

    or by manually copying them from existing repositories to public/themes or public/plugins. Remember to start tracking those directories by excluding them in public/themes/.gitignore and public/plugins/.gitignore.

Local Development Environment

  1. If using Docker inside Vagrant, adjust the hostname of the development environment in Vagrantfile to match your project.

     - config.vm.hostname = "vipgo"
     + config.vm.hostname = "your-project"
    

    which will create the development environment at your-project.local.

  2. Start the development environment using Vagrant:

     vagrant up
    

    or using Docker Compose:

     docker-compose up
    
  3. Visit your-project.local (or the default vipgo.local) to view the development environment.

Deployments

Deployments to the VIP Go upstream repository are handled by scripts/deploy.sh which does a clean checkout of the deploy branch to deploy/src, runs the build pipeline and copies the the public directory with the resulting artifects to deploy/dist (using rsync) which contains the upstream VIP Go repository. It then creates a new branch with the new changes and pushes it to the upstream repository.

Configure Deployments

  1. Change the repository URL for deploy-staging and deploy-production scripts in package.json to match your VIP Go upstream repository.
  2. Adjust the build sequence in scripts/deploy.sh to match your setup.
  3. Run npm run deploy-staging to deploy to the develop branch or npm run deploy-production to deploy to the master branch of the upstream VIP Go repository.
  4. Visit GitHub to open a pull request to the deploy target branch.

Contribute

All suggestions and contributions are welcome!

You can’t perform that action at this time.