Setting up Craft with Vagrant - Amazon S3 · Setting up Craft with Vagrant!!! Jason McCallister....
Transcript of Setting up Craft with Vagrant - Amazon S3 · Setting up Craft with Vagrant!!! Jason McCallister....
Lots of reasons…• Just because.
• Matching development environments for production as well as working with remote teams.
• Ability to troubleshoot specific PHP version, or server, issues.
• Keep your host machine clean, the way it should be…
just kidding!
The high level view
Macbook Pro16 GB RAM
Vagrant 2 GB
PHP 5.4
MySQL
Vagrant 1 GB
PHP 5.5
Vagrant 4 GB
PHP 5.6
Vagrant 512 MB
PHP 5.3
MySQL
MySQLMySQL
Workflow, again high level
Vagrant 4 GB RAM
!- !
Web server Database server **Synced Files**!
!
Macbook Pro16 GB RAM
!- !
Atom/Sublime Photoshop
**Synced Files**!Git
Other tools
most work is done here
Commands • vagrant init : creates a bare vagrant file
• vagrant up : bring up the VM
• vagrant suspend : suspend the VM
• vagrant halt : shutdown the VM
• vagrant status : show the VM status
• vagrant destroy : deletes the VM - bye bye..
• These commands work FROM the vagrant directory only.
Basic Vagrantfile# -*- mode: ruby -*- # vi: set ft=ruby : !# Vagrantfile API/syntax version. Don't touch unless you know what you're doing! VAGRANTFILE_API_VERSION = "2" !Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| ! # Every Vagrant virtual environment requires a box to build off of. config.vm.box = "base" ! # Create a private network, which allows host-only access to the machine # using a specific IP. config.vm.network "private_network", ip: "192.168.33.10" ! config.vm.provider "virtualbox" do |vb| # Use VBoxManage to customize the VM. For example to change memory: vb.customize ["modifyvm", :id, "--memory", "1024"] end
“but don’t I need to be a system admin for this?”
• Yes, well no. If you wanted to build your own custom box - not machine - you would have to get your hands dirty.
• Because of the wonderful internet - there are options for those who “just want it to work”.
Option #1 : Puphpet• https://puphpet.com
• Provides web based GUI to configure EVERYTHING - I mean ‘everything’.
• Choose between Apache or Nginx, linux distributions, PHP or Hack, MySQL, Mariadb, Postgres and more.
• You can even specify your web server sites in the GUI
• Slightly complex to add new virtual hosts (sites).
Option #2 : Vaprobash• http://fideloper.github.io/
Vaprobash/
• More for the “DIY” type of person.
• Vast amount of options based on the Vagrantfile and scripts.
• Excellent documentation on his website with custom tools to get started.
Vaprobash example Vagrantfile
• Uncomment what you want to install.
• ‘vagrant up’ after you uncomment what you want and it auto installs.
• Easy to add more virtual hosts as needed.
Vaprobash example Vagrantfile
• Again, easy to install with ALOT of options.
• Databases: MySQL, MariaDB, Mongo, Postgres, Couch, Rethink and more.
• Web servers: Apache, Nginx with tools to setup hosts.
• Misc: Composer, Memcached, Redis, Nodejs and more.
Option #3 : Homestead• http://laravel.com/docs/
homestead
• Preconfigured box - meaning no installation of PHP. Up in a matter of minutes.
• Tuned specifically for PHP development. Mirror copy of Forge hosting boxes.
• Is tuned for Laravel but Craft works flawless as well.
• Simple and nice documentation.
Homestead.yaml• Easy to add additional virtual
hosts and synced folders.
• Configuration is written in YAML - means easy to read and figure out…
• Configured for SSH authentication.
• Tools (scripts) to add new virtual hosts included.
Homestead Docs• Again, simple and easy to
read.
• Tuned for PHP, Forge and works well with Craft.
• Not to sell Forge, if you want to learn more about Forge watch these for free:
• https://laracasts.com/series/server-management-with-forge