Code Monkey home page Code Monkey logo

gwayppl-vagrant's Introduction

Acquia Cloud VM

I use this VM to test things in an environment close to that of Acquia's Cloud servers, following the guide at Acquia Cloud technology platform and supported software.

The following is included inside this VM:

  • Ubuntu 12.04 (Precise)
  • Apache 2.2.22
  • MySQL 5.5.x
  • PHP 5.5.x
  • Solr 3.6.2 (4.x configurable)
  • PHPMyAdmin 3.4.x
  • Varnish 3.x
  • Memcached 1.4.x
  • XDebug
  • Composer
  • Drush 6.x (7.x/etc. configurable)
  • Git 1.9.x (2.x/etc. configurable)
  • MailHog
  • Command-line tools like curl, iftop, traceroute, htop, strace, vim and more.

Usage

  1. Install VirtualBox, Vagrant, and Ansible: - $ brew cask install virtualbox vagrant - $ brew install ansible
  2. Install all the roles required by this playbook with the command $ ansible-galaxy install -r requirements.yml
  3. Copy example.config.yml to config.yml (your local config.yml will be ignored by Git and you can modify it to suit your needs) or apply changes by hand from example.config.yml.
  4. Install the sudo commands vagrant needs: - sudo mkdir -p /private/etc/sudoers.d/ && sudo cp sudoers.d/* /private/etc/sudoers.d/
  5. (From the same directory as this README file) run $ vagrant up

This assumes you have Homebrew installed and have cask installed (brew tap caskroom/cask && brew install brew-cask to install). On a Linux or Windows computer, you will need to install VirtualBox, Vagrant and Ansible according to the linked guides in step 1. This VM is not currently supported on Windows, but if you'd like support, please file an issue.

Note: Do NOT use the included Ansible playbook for production infrastructure unless you understand the security implications and have configured secure passwords, a firewall, etc. This VM and playbook are meant to help you replicate the Aquia Cloud environment locally, not to replicate the Acquia Cloud on other public infrastructure. You have been warned!

Customization

Please see the available VM customization options inside config.yml. You can easily define folder mappings inside this folder, as well as change settings like RAM/CPU allocation, the hostname and IP address of the VM, and even things like Apache and Varnish ports.

Things like hosts file configuration (changing your local system's hosts file to point to this VM's IP address for development hostnames) are left to you to manage. My goal is to make this VM configuration extremely flexible and lightweight.

Syncing folders

You can share folders between your host computer and the VM in a variety of ways; the two most commonly-used methods are using an NFS share, or using Vagrant's rsync method to synchronize a folder from your host into the guest VM. The example.config.yml file contains an example rsync share that would sync the folder ~/Sites/drupal on your host into a /drupal folder on the VM.

If you want to use NFS for the share instead, you could simply change the share to:

vagrant_synced_folders:
  - local_path: ~/Sites/drupal
    destination: /drupal
    id: drupal
    type: nfs

You can add as many synced folders as you'd like, and you can configure any type of share supported by Vagrant; just add another item to the list of vagrant_synced_folders.

Connecting to MySQL

By default, this VM is set up so you can manage mysql databases on your own. The default root MySQL user credentials are root for username+password, but you could change the password via config.yml. I use the MySQL GUI Sequel Pro (Mac-only) to connect and manage databases, then Drush to sync databases (sometimes I'll just do a dump and import, but Drush is usually quicker, and is easier to do over and over again when you need it).

Connect using Sequel Pro (or a similar client):

  1. Use the SSH connection type.
  2. Set the following options: - MySQL Host: 127.0.0.1 - Username: root - Password: root (or whatever password you chose in config.yml) - SSH Host: 192.168.4.40 (or whatever IP you chose in config.yml) - SSH User: vagrant - SSH Key: (browse to your ~/.vagrant.d/ folder and choose insecure_private_key)

You should be able to connect as the root user and add, manage, and remove databases and users.

Connect using PHPMyAdmin (built-in):

  1. Visit http://local.cloudvm.com/phpmyadmin (or substitute another vhost configured in config.yml).
  2. If prompted for a login, log in using the MySQL root credentials (root/root by default, or whatever password you chose in config.yml).

Using the built-in Apache Solr server

Apache Solr 3.6.2 is installed by default, and two example search cores (core0 and core1) are created. You can access solr via http://local.cloudvm.com:8983/solr/, and in the Drupal Solr server configuration, connect with the URL http://local.cloudvm.com:8983/solr/core0/ (for core0). To get the core to work with Apache Solr Search Integration or Search API Solr, copy the module's solr configuration files into /opt/solr/cores/core0/conf/.

Whenever you make changes to the Apache Solr configuration (adding/removing cores, changing config, etc.), you need to restart Tomcat so the changes will take effect: sudo service tomcat6 restart.

Using XHProf to Profile Code

The easiest way to use XHProf to profile your PHP code on a Drupal site is to install the Devel module, then in Devel's configuration, check the 'Enable profiling of all page views and drush requests' checkbox. In the settings that appear below, set the following values:

  • xhprof directory: /usr/share/php
  • XHProf URL: http://local.xhprof.com/ (assuming you have this set in apache_vhosts in config.yml)

If you're getting blank XHProf pages and errors like Run #546e053e171fb: Invalid Run Id = 546e053e171fb, you might need to manually create the /tmp/xhprof directory or run vagrant provision again.

Catching/Debugging Email with MailHog

By default, the VM is configured to redirect PHP's emails to MailHog (instead of sending them to the outside world). You can access the MailHog UI at http://local.cloudvm.com:8025/ (where local.cloudvm.com is a domain you've configured for the VM).

You can override the default behavior of redirecting email to MailHog by editing or removing the php_sendmail_path inside config.yml.

Author Information

This VM was created in 2014 by Jeff Geerling, author of Ansible for DevOps.

gwayppl-vagrant's People

Contributors

geerlingguy avatar mwpeterson avatar laserlight avatar

Stargazers

Russ avatar

Watchers

Nathaniel avatar Steve Rhom avatar James Cloos avatar Josh Ferrara avatar Jonathan Simmons avatar Evan Agee avatar  avatar  avatar Darren Ehlers avatar  avatar Dacia Milner avatar Arthur Goerlitz avatar Nic Rodriquez avatar Ryan Graves avatar Nat Harding avatar  avatar Jeremy Tyson avatar Jordan Skomer avatar Marc  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.