8000 GitHub - gianthat/woostrap: WooCommerce Bootstrap Theme · GitHub
[go: up one dir, main page]

Skip to content
gianthatPublic

About

WooCommerce Bootstrap Theme

Resources

Contributing

Stars

1 star

Watchers

7 watching

Forks

Repository files navigation

Efeqdev Bedrock and Vagrant for Wordpress development

====

This is the master repo for setting up a new Wordpress site locally.

Prerequisites

You must have the following installed on your Mac OS X system in order to use this repository:

Quick Start Guide

Before getting started, make sure you have the prerequisites listed above installed.

Setting this project up for the first time:

  1. Be sure the hosts record for your project has been added to the efeqdev/bedrock repository hosts file. See instructions here if you are setting up a brand new project.
  2. Download this repository: git clone git@github.com:efeqdev/bedrock.git yourprojectname
  3. Change remote origin: git remote rm origin && git remote add origin <github url of this site's repo>
  4. If there is not a line in the hosts file for this project, add one. Also, add the line to the main efeqdev/bedrock repository and commit/push change.
  5. Install Grunt dependencies: npm install
  6. Sync hosts files: sudo /your/local/path/to/this/folder/hosts.sh
  7. Update variables in secret.json file.
  8. If this is not a brand new project, pull database dump from production server: grunt db_to_dev. Otherwise, skip this step.
  9. Install packages: composer install
  10. If you don't already have it in your system, add the Vagrant box: vagrant box add efeqdev/wp-ubuntu-14.04
  11. Update /provisioning/hosts file with the correct application_name variable.
  12. If this project is brand new and there is no production or staging database, comment out the last task "Source Databases" in provisioning/playbooks/wp-lamp-setup.yml. Remember later to comment that back in when the site has been launched to production. You'll need to create your local db after vagrant up.
  13. If this project already has a production database, run grunt db_to_dev.
  14. Grab the .env and deploy config files from the remote server located in /home/yourprojectname/local_dev_files. Put them in you local repo - overwrite the existing files.
  15. Start Vagrant and provision the box: vagrant up.
  16. Check out http://yourprojectname.dev to confirm the site is up.
  17. Log in to PHPMyAdmin at http://192.168.33.10/phpmyadmin (Username: wp_db_u Password: password)

See Commands section for more detailed explanation of available tasks.

Commands

Note: All commands below assume you are cd'd into this directory.

Syncing Hosts file

Note: If this project was previously worked on and you have an /etc/hosts file record for 127.0.0.1 yourprojectname.dev, remove that line before continuing.

In your local terminal, run:

$ sudo /your/local/path/to/this/folder/hosts.sh

This will replace the lines in your /etc/hosts file and make a backup at /etc/hosts.backup.

The IP address of 192.168.33.10 is in the protected range for private networking.

Note: the hosts file contained in this directory has a comment # Main Wordpress Cluster that is used to ensure the process doesn't duplicate lines. So in that sense it is brittle and will break if you remove that comment from the file or put anything above it.

Pulling database dumps and unzipping / Search and Replace database dumps

Database dumps on the remote server are made nightly at 11:55pm and live in /tmp/mysqldumps on the remote server. If this is a new project and there is no database on the remote server yet, skip this step.

In your local terminal, run these commands:

# PULL AND PREP FOR DEVELOPMENT - does not source the database, that happens in the vagrant provisioning playbook - so do this before vagrant up
# To pull dump, unzip, and search and replace domains
$ grunt db_to_dev

# To pull file only
$ grunt exec:get_prod_dump

# To unzip only
$ grunt exec:unzip_prod # This will overwrite existing .sql files.

# PREP DUMPS FOR OTHER DIRECTIONALS - dev to prod, staging to dev, etc.
# We've started building out these functions, but the system is not complete
$ grunt db_to_prod # requires a manually dumped db file at web/mysqldumps/latest_to_prod.sql
$ grunt db_to_staging # requires a manually dumped db file at web/mysqldumps/latest_to_staging.sql
$ grunt db_staging_to_dev # in case you are in need of the staging database and have grabbed a dump from the server - requires this file to be at web/mysqldumps/latest_staging_to_dev.sql.gz

Syncing uploads directory

# To pull all uploads
$ grunt get_uploads

# Or to sync - probably better and faster
$ grunt sync_uploads

Vagrant

The base box has been set up with only basic libraries. We're using Ansible to provision it with other requirements on vagrant up which will allow for some flexibility.

# One-time only
$ vagrant box add efeqdev/wp-ubuntu-14.04

# Later if there are updates to the box
$ vagrant box outdated # check to make sure
$ vagrant box update # update it - this will take a long time

# Each time you want to spin it up
$ vagrant up # this will also provision

# ssh into it
$ vagrant ssh

# Suspend it
$ vagrant halt

# Provision it (after it's "up"). If you make changes to the Ansible playbook, Ansible will run tasks that haven't been run before and ignore tasks that are already done.
$ vagrant provision

# Kill it
$ vagrant destroy # doing this will cause all of the Ansible provisioning tasks to run again next time you vagrant up.

PHPMyAdmin

You should be able to login at http://192.168.33.10/phpmyadmin with the following credentials:

Username: wp_db_u Password: password

Provided you have pulled and replaced your SQL dump, vagrant's provisioning should have sourced your databases. If you want to source a database outside of the normal startup procedure, use PHPMyAdmin or use the commands below (substituting the appropriate database name and folder name, of course):

$ vagrant ssh

$ mysql -u wp_db_u -ppassword

mysql> use projectname_dev;

mysql> source /var/www/web/mysqldumps/output.sql

OR

$ mysql -u wp_db_u -ppassword projectname_dev < /var/www/web/mysqldumps/output.sql

TODO

Must do:

  • Create this readme file dynamically with project appropriate language
  • Add running of hosts script to vagrant trigger on provision or reload
  • Pull in Bonestrap as a submodule, then break connection?

Nice to have:

  • Make hosts bash script into Grunt task instead.
  • Disable caching plugins in database?

Information about this projects core architecture

efeqdev/bedrock is built off of Bedrock, a modern WordPress stack that helps you get started with the best development tools and project structure. View the github repo readme to learn more about that.

About

WooCommerce Bootstrap Theme

Resources

Contributing

Stars

1 star

Watchers

7 watching

Forks

Releases

Packages

Contributors

Languages

0