Dev.Objective Notes: Take Home Your Very Own Free Vagrant CFML Dev Environment - Gavin Pickin

June 21, 2016

(I've seen Gavin speak several times and have worked with him on a project as well.  He is excellent at explaining concepts new to the audience/co-worker/whatever. I've seen several Vagrant related talks over the last year and this was easily the most well constructed of the bunch.)

Alternatives to Vagrant - command box, docker containers
chef, puppet, ansible

Pros for CommandBox
cross platform
simple
multi engine (cf, lucee, etc)
it’s CFML and JSON
always improving it

Cons for CommandBox
undertow not a full web server
it’s dependent on your OS
limited host support
limited rewrites, etc
it’s dependent on your libraries
can’t run Fusion Reactor via CB…yet!

Mac - terminal ACTS like it is case sensitive
but under the hood it’s really not
that can cause some weirdness while using it on OSX

to switch providers
vagrant up —provider=vmware_fusion
…to change providers on the fly!

Boxes -
instead of building a VM from scratch, which is slow and tedious, Vagrant uses a base img to quickly configure an image the way you want

Provisioners
(this is where Chef and Puppet come in. they’re automation tools that let you do this stuff easier)
download and configure the extra software your VM needs

Plugins
highly recommended that you intalll these:

vagrant-hostsupdateer
vagrant-vbguest

CLI -
common commands
vagrant up - get the machine up and running, get the BOX file, download it, install it, run provisioners, etc, create the VM and make it available to you, according to what’s in your Vagrantfile
- this is the single most important command in Vagrant.

vagrant halt - stop the machine when you’re done for the day

vagrant reload - a “halt” then an “up”. if you’re changing VagrantFile and want to reload, you can do this to grab those changes and load them

“reload” doesn’t do the provisioning by default
add the —-provision flag for that

vagrant provision - runs the provisioners

vagrant reload —-provision: restart the machine AND do the provisions

vagrant ssh — will SSH into a running Vagrant machine and gives you access to the shell
On Windows you need a TTY terminal for full shell interactivity (ConEnu is 1 option, or putty, etc)

vagrant destroy - stops AND deletes the machine, wipes it off your laptop. so next time you do “vagrant up” that will download and rebuild everything

vagrant share - share your vagrant env with anyone in the world. “vagrant share”. if i have an acct w/ HashiCorp, creates a “tunnel” to your machine to share a link to your machine with other people around the world
note: this is not perfect and you should not rely on it to be perfect!

Learning Curve
already have some CFML images available via the CF community

in /Vagrant folder
artifacts - things Vagrant downloads for you, where the installers will be placed
provisioners - the provisioning bash scripts for the box to configure the various pieces of software in the Vagrant guest machine

/Vagrant Credentials folder
a place to store usernames/passwords for your DSNs, etc, but can keep it OUTSIDE of the repo so they’re all safe.
if you have the passwords in your main settings file it will check there, if not, then it will check your Vagrant Credentials files

github.com/Ortus-Solutions/vagrant-centos-lucee
…the image we can grab it, fork it, change things, etc.

github.com/murpg/centos-coldfusion-vagrant
CF11 Vagrant running on CentOS

cfmlrepo.com
anything related to CF development will be noted here