项目作者: OutThisLife

项目描述 :
Local WP environment with automatic deploys
高级语言: PHP
项目地址: git://github.com/OutThisLife/NWS-WP.git
创建时间: 2013-06-15T04:49:46Z
项目社区:https://github.com/OutThisLife/NWS-WP

开源协议:MIT License

下载


Bedrock + PHP Server + Livereload

  1. mkdir projectname/ && cd projectname/
  2. git clone git@github.com:OutThisLife/NWS-WP.git .
  3. composer install
  4. touch .env

Setup database credentials for .env and then run yarn dev to start a PHP server, livereload server, and to listen to all css/js changes.

SSH work flow

Let your server build your WP site for you via git.

On the server

  1. $ mkdir nws-wp.git && cd nws-wp.git
  2. $ git init --bare
  3. $ vim hooks/post-receive

post-receive:

  1. #!/bin/sh
  2. echo "********************"
  3. echo "Build initiated"
  4. echo "********************"
  5. DIR=/home/<username>/public_html/nws-wp
  6. GIT_WORK_TREE=$DIR git checkout -f
  7. echo "Changing permissions for $DIR"
  8. cd $DIR && composer install
  9. chown -hR apache:apache $DIR

Your local setup

  1. $ git init
  2. $ git remote add live ssh://user@domain.com/home/<username>/public_html/nws-wp.git
  3. $ git remote add origin git@github.com:<username>/nws-wp.git

WPEngine work flow

First, you have to enable git on your WPE install as well as a staging environment.

Your remotes should ideally look something like this:

  1. $ git remote -v
  2. origin git@bitbucket.org:outthislife/reponame.git (fetch)
  3. origin git@bitbucket.org:outthislife/reponame.git (push)
  4. production git@git.wpengine.com:production/reponame (fetch)
  5. production git@git.wpengine.com:production/reponame (push)
  6. staging git@git.wpengine.com:staging/reponame (fetch)
  7. staging git@git.wpengine.com:staging/reponame (push)

You need remotes setup as above in order to manage your VC. Staging will be where you push most of your changes up, but all of your git work will remain mostly on bitbucket. This is because WPE will automatically deploy any push to their git servers despite the branch name.

To bypass this, you use the origin remote to manage your branches and then just deploy to whichever WPE environment you need once ready.

With this setup, and on any branch, you can deploy via yarn deploy to staging and yarn golive to production.