Coder Social home page Coder Social logo

dev2-playbooks's Introduction

Four Kitchens: Ubuntu 14.04 Development Server

The Four Kitchens development server uses ansible for using our bespoke development environment as a VM or in the cloud. You have a great amount of configuration options available to you via yml files but by default, after installing the latest VirtualBox and the latest version of Vagrant you should be only a few steps away from a robust and comprehensive environment.

Requirements

Installation

Local (OS X)

Start by installing Homebrew, a package manager for OS X. Additional instructions can be found in the Homebrew documentation.

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Next install the Homebrew extension Cask, an application package manager that deals with prebuilt binaries for desktop applications. Additional instructions can be found in the documentation.

brew install caskroom/cask/brew-cask

Next, install VirtualBox.

brew cask install virtualbox

Then, install Vagrant.

brew cask install vagrant

Optionally, install Vagrant Manager to manage your VMs.

brew cask install vagrant-manager

You'll need to install Ansible.

brew install ansible

Continue to Local (All) to complete installation.

Local (Linux)

Install VirtualBox; see the Linux Downloads page and follow the instructions that match your environment.

Then, install Vagrant; see the download page and download the package that matches your environment. Note: Must be version 1.5.* or greater. Do not use the version provided by apt-get as it is not supported.

Next, install Ansible; see their installation page and follow the instructions that match your environment.

Continue to Local (All) to complete installation.

Local (All)

Ansible Galaxy roles need to be installed, and they are listed in the roles.txt file. The command below will automatically install and/or update roles locally.

ansible-galaxy install --force -r roles.txt

Change directory to where you want to store your project configuration and clone this repository.

cd ~/projects
PROJECT_NAME=dev2-playbooks
git clone [email protected]:fourkitchens/dev2-playbooks.git $PROJECT_NAME
cd $PROJECT_NAME

Within the project, run a single, magical command:

vagrant up

The virtual machine will be created and configured for you.

Pro Tip: If you have trouble mounting shared folders with NFS, which is a known issue for directories encrypted with ecryptfs, see the VagrantFile at the root of this repository for alternative options.

Usage

To access the shell, run:

vagrant ssh

To update your machine, pull the latest within the repository, then run:

vagrant provision

If you want to customize any of the settings within the playbooks, create a host_vars/vagrant file, with any settings overrides you need.

Ansible Scripts

Ansible deployment scripts, located in the deploy directory can be used for common deployment tasks. Deployment commands can be run on a development server using the following syntax, however to use them in a Vagrant virtual machine you'll need to use the bash script located below.

ansible-playbook -i hosts deploy/user-add.yml

Fill out the prompts or include them in the extra-vars -e argument

ansible-playbook -i hosts -e="user_name=bender github=fkbender" deploy/user-add.yml

A special bash script is available that makes it possible to run deployment scripts locally.

./vagrant-playook deploy/user-add.yml

The following commands will work on the vagrant machine and on the dev server:

Databases

Create MySQL Database

./vagrant-playbook deploy/database/mysql-db-create.yml

Import MySQL Database

./vagrant-playbook deploy/database/mysql-db-import.yml

Solr Cores

Add Solr Core

./vagrant-playbook deploy/solr-cores/solr-core-add.yml

Delete Solr Core

./vagrant-playbook deploy/solr-cores/solr-core-delete.yml

Users

Add User

./vagrant-playbook deploy/users/user-add.yml

Delete User

./vagrant-playbook deploy/users/user-delete.yml

Drupal Sites

The following commands only work on a remote dev server:

Deploy Drupal dev site

deploy/drupal-sites/drupal-dev-site-deploy.yml

Remove Drupal dev site

deploy/drupal-sites/drupal-dev-site-remove.yml

Deploy Drupal trunk site

deploy/drupal-sites/drupal-trunk-site-deploy.yml

Remove Drupal trunk site

deploy/drupal-sites/drupal-trunk-site-remove.yml

Dev Server Features

In addition to the easy execution of common tasks and parity between our Development and local environments, the playbooks provide a number of features.

Standard Stuff

Multiple Webservers

The dev2 playbooks now install both apache and nginx. This will allow us to more closely emulate Pantheon (nginx+php-fpm), or more common (apache) application server environments. You can switch between the two by sending either a GET argument (varnish_backend by default) or by setting a request header (X-varnish-backend by default).

For example, the following requests would hit the respective servers:

The default webserver can be set from your settings file before running the playbooks but will be set to apache by default.

Protip: you can use the Chrome extension ModHeader to send custom headers and avoid needing to use GET arguments on every request.

XHProf

You can utilize XHProf with mongodb xhprof which will provide you with a Drupal interface to view the XHProf results without using devel.

Remote

  • Create a hosts file
  • ansible-playbooks -i hosts playbook.yml
  • Magic.

dev2-playbooks's People

Contributors

mirzu avatar elliotttf avatar marktheunissen avatar iamcarrico avatar thebruce avatar chasingmaxwell avatar fluxsauce avatar tsmith512 avatar milsyobtaf avatar

Watchers

James Cloos avatar Frankie Gravato (Cronparser) avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.