Skip to content

Instantly share code, notes, and snippets.

@davekiss
Last active October 27, 2015 17:15
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davekiss/8945377 to your computer and use it in GitHub Desktop.
Save davekiss/8945377 to your computer and use it in GitHub Desktop.
Bedrock Usage

##Install Homebrew

ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
brew upgrade
brew update
brew doctor
> Your system is ready to brew.

##Install and Update XCode from the App Store

  • If you upgraded to Mavericks 10.9.x, please also upgrade to the latest Xcode, 5.0.1 and make sure you re-install Command Line Tools: xcode-select --install
  • On Mavericks 10.9.x, if xcode-select --install displays the following error message:

Can't install the software because it is not currently available from the Software Update server. download Command Line Tools from https://developer.apple.com/downloads/index.action?name=Command%20Line%20Tools xcode-select --install

Check if XCode CLT installed

pkgutil --pkg-info=com.apple.pkg.CLTools_Executables

http://stackoverflow.com/a/19899984/234240

Install homebrew-php

Please see https://github.com/Homebrew/homebrew/wiki/brew-tap to learn more about what this is doing.

brew tap homebrew/dupes
brew tap homebrew/versions
brew tap homebrew/homebrew-php

Install PHP (if not installed)

brew install php55

==> Caveats
To enable PHP in Apache add the following to httpd.conf and restart Apache:
    LoadModule php5_module    /usr/local/opt/php55/libexec/apache2/libphp5.so

The php.ini file can be found in:
    /usr/local/etc/php/5.5/php.ini

✩✩✩✩ PEAR ✩✩✩✩

If PEAR complains about permissions, 'fix' the default PEAR permissions and config:
    chmod -R ug+w /usr/local/Cellar/php55/5.5.14/lib/php
    pear config-set php_ini /usr/local/etc/php/5.5/php.ini

✩✩✩✩ Extensions ✩✩✩✩

If you are having issues with custom extension compiling, ensure that
you are using the brew version, by placing /usr/local/bin before /usr/sbin in your PATH:

      PATH="/usr/local/bin:$PATH"

PHP55 Extensions will always be compiled against this PHP. Please install them
using --without-homebrew-php to enable compiling against system PHP.

✩✩✩✩ PHP CLI ✩✩✩✩

If you wish to swap the PHP you use on the command line, you should add the following to ~/.bashrc,
~/.zshrc, ~/.profile or your shell's equivalent configuration file:

      export PATH="$(brew --prefix homebrew/php/php55)/bin:$PATH"

To have launchd start php55 at login:
    ln -sfv /usr/local/opt/php55/*.plist ~/Library/LaunchAgents
Then to load php55 now:
    launchctl load ~/Library/LaunchAgents/homebrew.mxcl.php55.plist
==> Summary
🍺  /usr/local/Cellar/php55/5.5.14: 492 files, 38M, built in 3.4 minutes

Install Composer

brew install homebrew/php/composer
composer --version

Install Bedrock using Composer

composer create-project roots/bedrock <path> # path being the folder to install to

[2.0.0-p247@system] ~/dropbox/sites $ composer create-project roots/bedrock ~/path/to/site/folder
Installing roots/bedrock (1.2.4)
  - Installing roots/bedrock (1.2.4)
    Downloading: 100%         

Created project in ~/path/to/site/folder
Generate salts and append to .env file? [Y,n]? Y
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
  - Installing composer/installers (v1.0.12)
    Downloading: 100%         

  - Installing fancyguy/webroot-installer (1.1.0)
    Downloading: 100%         

  - Installing vlucas/phpdotenv (1.0.6)
    Downloading: 100%         

  - Installing wordpress/wordpress (3.9)
    Downloading: 100%         

Generating autoload files


cd <path>
composer update

Initialize Git Repository

cd <path>
git init .

Running a local server using Ansible

brew install ansible

Download Vagrant https://www.vagrantup.com/downloads

Download VirtualBox https://www.virtualbox.org/wiki/Downloads

vagrant plugin install vagrant-hostsupdater

git clone git@github.com:roots/bedrock-ansible.git ~/path/to/sites/folder

Open the Vagrantfile in your text editor and add your local hostname details

Open group_vars/all and add your local details

vagrant up This downloads the roots/bedrock box

==> default: Adding box 'roots/bedrock' (v0.1.1) for provider: virtualbox default: Downloading: https://vagrantcloud.com/roots/bedrock/version/1/provider/virtualbox.box

Could take ~30mins depending on your connection (~550MB)

Edit .env and update environment variables:

cd <path>
nano .env

DB_NAME     # Database name
DB_USER     # Database user
DB_PASSWORD # Database password
DB_HOST     # Database host (defaults to localhost)
WP_ENV      # Set to environment (development, staging, production, etc)
WP_HOME     # Full URL to WordPress home (http://example.com)
WP_SITEURL  # Full URL to WordPress including subdirectory (http://example.com/wp)

Add theme(s)

Adding plugins

composer require wpackagist-plugin/vimeography
composer update

# add any external files caused by plugin to .gitignore
nano .gitignore
  app/vimeography

Updating WordPress and Plugins

Add new version to composer.json file and run composer update

Access WP Admin at http://example.com/wp/wp-admin

Edit any wp-config options in config/application.php or environment-specific options in config/environments/<environment>.php

Setting up a Digital Ocean Droplet

set up nginx on a ubuntu instance on digital ocean with wordpress and bedrock and vagrant https://www.digitalocean.com/community/tutorials/how-to-use-digitalocean-as-your-provider-in-vagrant-on-an-ubuntu-12-10-vps

We're using the box located at https://vagrantcloud.com/AndrewDryga/digital-ocean

Generate SSH Key pair

ssh-keygen -t rsa

Install Vagrant

vagrant plugin install vagrant-digitalocean

NOTE: If you are using a Mac, you may need to install a CA bundle to enable SSL communication with the Digital Ocean API. It is recommended to first install Homebrew. With Homebrew installed, run the following command to install the bundle:

$ brew install curl-ca-bundle

Once the bundle is installed, add the following environment variable to your .bash_profile script and source it:

export SSL_CERT_FILE=/usr/local/opt/curl-ca-bundle/share/ca-bundle.crt

mkdir ~/my-site
cd ~/my-site
vagrant init AndrewDryga/digital-ocean

Create new Digitalocean API v2.0 token in your account login.

Add this at the bottom of the Vagrant.configure block:

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|

  config.vm.provider :digital_ocean do |provider, override|
    override.ssh.private_key_path = '~/.ssh/id_rsa'
    override.vm.box = "AndrewDryga/digital-ocean"
    
    provider.ca_path = "/etc/ssl/certs/ca-certificates.crt"
    
    provider.token = 'YOUR TOKEN'
    provider.image = 'Ubuntu 14.04 x64'
    provider.region = 'nyc2'
    provider.size = '512mb'
  end
end

Launch the Droplet vagrant up --provider=digital_ocean

Available DO Options

  • vagrant destroy: Destroys the droplet instance.
  • vagrant ssh: Logs into the droplet instance using the configured user account.
  • vagrant halt: Powers off the droplet instance.
  • vagrant provision: Runs the configured provisioners and rsyncs any specified config.vm.synced_folder.
  • vagrant reload: Reboots the droplet instance.
  • vagrant rebuild: Destroys the droplet instance and recreates it with the same IP address is was assigned to previously.
  • vagrant status: Outputs the status (active, off, not created) for the droplet instance.

Deploying with Capistrano

Install Bundler

gem install bundler

Install Gem Dependencies

cd path
bundle install

Deployment Steps

https://github.com/roots/bedrock#deployment-steps

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment