Bedrock + PHP Server + Livereload
mkdir projectname/ && cd projectname/
git clone [email protected]:OutThisLife/NWS-WP.git .
composer install
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.
Let your server build your WP site for you via git.
$ mkdir nws-wp.git && cd nws-wp.git
$ git init --bare
$ vim hooks/post-receive
post-receive:
#!/bin/sh
echo "********************"
echo "Build initiated"
echo "********************"
DIR=/home/<username>/public_html/nws-wp
GIT_WORK_TREE=$DIR git checkout -f
echo "Changing permissions for $DIR"
cd $DIR && composer install
chown -hR apache:apache $DIR
$ git init
$ git remote add live ssh://[email protected]/home/<username>/public_html/nws-wp.git
$ git remote add origin [email protected]:<username>/nws-wp.git
First, you have to enable git on your WPE install as well as a staging environment.
Your remotes should ideally look something like this:
$ git remote -v
origin [email protected]:outthislife/reponame.git (fetch)
origin [email protected]:outthislife/reponame.git (push)
production [email protected]:production/reponame (fetch)
production [email protected]:production/reponame (push)
staging [email protected]:staging/reponame (fetch)
staging [email protected]: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.