env
Create development environments like a pro with Packer, Vagrant, & Docker
What?
-
Vagrant is a high-level wrapper API for kernel-based virtual machines (KVM). Vagrant uses packaged environments called boxes and allows one to manage, configure, and control virtual environments with code and automation.
-
Packer enables one to create Vagrant boxes (and other things) via an automated and repeatable process driven by a single JSON-formatted template file.
Vagrant, Packer, and Docker are tools that facilitate applying SOLID, WORA, PoLA, YAGNI, DRY practices to the code that you write, and the environments in which the code is written and used (spoken: " infrastructure and stuff ").
Requirements
- Virtualbox is installed
- Vagrant is installed
Quick Start
Warning: Internet connection is required
- Open up a command prompt (or Git bash)
- Create and enter a new directory:
mkdir path/to/dev/dir && cd path/to/dev/dir
- Initialize a Vagrantfile and start your VM:
vagrant init jhwohlgemuth/env && vagrant up
See the Vagrant Getting Started guide for more information
Customize the VM
The default jhwohlgemuth/env
Vagrant box hosted on Atlas,
includes the ~/.jhwohlgemuth
directory that has some useful files.
~/.jhwohlgemuth/setup.sh
is a collection of tweaks and customizations.
usage:
#setup.sh is executable and can be run with just:
~/.jhwohlgemuth/setup.sh
~/.jhwohlgemuth/functions.sh
is a collection of functions for installing and configuring software.
usage:
#Most functions require root privileges
sudo -s
#Functions are sourced when terminal is opened
#Type 'install_' followed by tab to see the available install functions
#Type 'setup_' followed by tab to see the available setup functions
Create Your Own Vagrant Box with Packer
Warning: Internet connection is required
Warning: This sections requires that Packer is installed
Warning: An Atlas token is not required for box creation, but not having one set will cause the
atlas
post-provisioner to fail.
- Clone this repo with
git clone https://github.com/jhwohlgemuth/env.git
- Customize
packer.json
and the provisioning scripts to your liking - Open up a Git bash in the root directory:
#Set token for connecting to Atlas
export ATLAS_TOKEN=<your secret token>
#Validate Packer template and fix errors if applicable
packer validate packer.json
#Start the build process. Go get a coffee.
packer build packer.json
See the official Packer Introduction for more information
Future
- See env Trello board