WP Starter Environment
The local development environment uses Station which is a simple, module based framework for customizing the laravel/homestead vagrant environment.
Station extends homesteads Yaml configuration file with features such as: XDebug, zsh, oh-my-zsh, ruby-gem installers and much more.
To learn more about how to use Station, lots of information is available in the wiki.
##Setting up your local environment
-
Install requirements
-
Set up Git: All this happens in terminal
- open terminal and type these commands
- Add your name:
git config --global user.name "Your Name Here"
- Add your email:
git config --global user.email "your_email@example.com"
- Add colors:
git config --global color.ui auto
-
Setup your Github/Bitbucket account
- Create a github account at github.com if you haven't already.
- Create a Bitbucket account as well
- Follow this guide for setting up ssh keys on your machine.
##Host Editor
The dev server is set up to point to a specific domain at a custom ip address. We need to edit your machines hosts file.
The best way that I've found to do this is to install a browser plugin for either chrome or firefox called HostAdmin.
-
Install HostAdmin
-
Add correct permissions. In terminal (linux/OSX) type:
sudo chmod og+w /etc/hosts
. -
Click on the host editor and add the following entry:
192.168.10.55 local.wp-starter.com
. -
Save and you're done.
##Clone the application repository to your machine
Some of these instructions are based on my preferences, please feel free to change them if your environment is different.
- Next clone the app repository to a folder on your machine.
- create a sites directory in your user folder:
mkdir -p ~/Sites
- In terminal type:
git clone git@github.com:mcuyar/wp-starter.git ~/Sites/wp-starter
.
- create a sites directory in your user folder:
##Start up the development box
-
In terminal, navigate to the application folder
cd ~/Sites/wp-starter
(you may already be there). -
Start the the virtual machine
vagrant up
. -
If this is not the first time you have ran the
vagrant up
for the app, provision the box by running the commandvagrant provision
after the vm is up and running.
If for any reason you come across the NFS error below, complete the following instructions to correct the issue.
NFS is reporting that your exports file is invalid. Vagrant does
this check before making any changes to the file. Please correct
the issues below and execute "vagrant reload":
exports:2: path contains non-directory or non-existent components: <path-to-wp-starter-environment>
exports:2: no usable directories in export entry
exports:2: using fallback (marked offline): /
- Open the exports file located at /etc/exports and clear out all the available entries and save the file. If this does not work or you do not have access to modify the file, continue to the next step b.
- Open up terminal and run the following command to open the export file:
sudo nano /etc/exports
. - Go ahead and clear out all the entries within the file. Note: you can clear each line quickly by hitting
control+k
for each line within the exports file. - Save the
exports
file by using the key combinations ofcontrol+x
followed byy
, thenenter
to save your changes. - You will likely need to restart the Vagrant VM by running
vagrant halt
followed byvagrant up
, once again.
A typical reason for this error to occur is if you renamed the environment directory after the initial
vagrant up
.
##Final set up for the app
-
Still within the
~/Sites/wp-starter
directory SSH into the Vagrant box by runningvagrant ssh
. -
Change your current directory to
cd /var/www
. -
Run the command:
composer install
-
Navigate to local.wp-starter.com in your favorite browser and install wordpress
##Notes and troubleshooting
If you ever run into any issues with the server, try restarting nginx and php
-
SSH into the Vagrant box:
vagrant ssh
. -
Run the command:
sudo service nginx restart && sudo service php5-fpm restart
.
##Customizing your Dev environment (optional|advanced)
This file will allow you to customize your development environment. You can open this in your favorite text editor. As a quick reference, you can open the current folder in Finder by typing open .
in terminal.
-
In terminal navigate to your development folder
cd ~/Sites/wp-starter
on your host machine. -
Create a new file called config.yaml:
touch config.yaml
. -
Open up the new config.yaml file either with the text editor of your choice or with nano:
sudo nano config.yaml
. You may be required to enter your user account password. -
Copy/paste any config changes you need to make from the config-default.yaml file.
-
Save the
config.yaml
file. If you are using nano, hitcontrol+x
followed byy
, thenenter
to save your changes.