SlideShare a Scribd company logo
1 of 16
Download to read offline
Node.js with Vagrant and Chef
@ Benetech
April 24, 2014
Chris Bumgardner
Why Vagrant?
 Speed and Portability
 Get a working uniform development environment
running in about 15 minutes while getting a coffee.
 This often takes hours or days for a modern environment
getting specific libraries, tools, and versions for a specific
operating system.
 Open source and mature. Around since 2010.
Advantages to a VM Image
 Vagrant is small: just text files in source control
 A snapshot is typically around 0.5GB – 1GB. Hard to host and
transfer.
 A snapshot is binary: changing a version of a library is hard,
but in Vagrant it is just a configuration change.
 Abstraction: Vagrant can run on top of different providers,
such as AWS, Docker or Azure in addition to a local virtual
machine.
 https://github.com/mitchellh/vagrant-aws
 https://github.com/10thmagnitude/vagrant-azure
Installing Vagrant & VirtualBox
 Install Vagrant here:
http://www.vagrantup.com/downloads.html
 Install VirtualBox here:
https://www.virtualbox.org/wiki/Downloads
 Cloud boxes are automatically downloaded and
installed with Vagrant 1.5+
 Be sure to upgrade Vagrant if you have an older version.
Configuration Management via Chef
 Idempotent
 You can run Chef multiple times on the same system with
identical results.
 Not the case with shell scripts: running more than once will
usually lead to unpredictable results.
 Cross-platform
 Chef supports Linux, Mac, Windows
 Shell scripts are system dependent
 Existing ecosystem of cookbooks: don’t reinvent the wheel.
 Chef Solo: runs on local machine, does not require server
infrastructure.
Docker, Packer, etc: More DevOps
 DevOps tools appear daily.
 Chef alternatives: Puppet, Ansible, Salt, etc.
 Docker.io
 Promising tool that contains and virtualizes processes.
 Think of Vagrant but for a specific process.
 Example: turn a server application into a portable image.
 Packer.io
 Automates creation of machine images.
 A meta layer above a tool like Vagrant.
Mathoid using Vagrant
 https://github.com/cbumgard/mathoid-vagrant
 Once running you can access at localhost:10042
 Built on Ubuntu Precise 12.04 64-bit base box. Found 14.04
not compatible yet with Mathoid.
 First time you “vagrant up” it has to download the base
box (~300MB). Boxes are cached locally however.
 Added Chef cookbooks as Git submodules. Requires just
an extra two commands the first time you clone the repo,
makes for a cleaner repository.
Mathoid + Vagrant continued
 All configuration done in the Vagrantfile:
https://github.com/cbumgard/mathoid-
vagrant/blob/master/Vagrantfile
 Non-provisioning changes to Vagrantfile, such as
networking configuration, will take effect on a “vagrant
reload” (halt + up).
 Provisioning changes will not run unless you destroy and
re-up, or do a “vagrant provision”.
 This Vagrantfile is a combination of shell, file, and chef
provisioning.
Vagrant: Things to Note
 Pick your base box carefully.
 Ideally has the configuration manager (e.g. Chef) installed that you will
use for provisioning.
 Avoid anything else if possible. For example a base box with Node.js built
in will be trickier to upgrade to a new version than if you add Node.js as
a Chef cookbook.
 You can always see installed boxes via “vagrant box list”
 When creating a Vagrantfile test incrementally via “vagrant
provision”
 Vagrant commands you should learn:
 init, up, ssh, suspend, resume, halt, destroy
 reload: halt + up
Vagrant: continued
 When switching networks on the host (e.g. changing WIFI
networks on your laptop) you may need to “vagrant reload”
for the guest VM networking.
 If you want to access files from your host machine inside the
guest vm, be sure to use NFS:true in your synchronized folder
setup.
 Gives ~10x performance accessing files. Noticeable if running a
webserver like Node.js in the VM on files on your host.
 Requires nfs-common installed.
 Requires password on “vagrant up”. Fix for that at:
https://gist.github.com/GUI/2864683
Vagrant: continued
 When shell provisioning keep in mind:
 Your script is running as root. No need for sudo.
 Interactive prompts will hang and timeout. Make sure to add
flags like “-y” to command-line calls like “apt-get”.
 You can enable a GUI from the Vagrantfile if you want to do
graphical work in the VM
 Provisioning usually requires download files from many
sources: occasionally there will be intermitent problems
downloading from certain sources.
 Check out Vagrant Shares. New in 1.5. Allows giving others
outside your local network access to your running machine.
Node.js: Lessons Learned
 Node.js runs all Javascript code on a single thread.
 So you can’t do heavy operations in the JS layer.
 Consider message queues or pub/sub like Redis.io
 Thinking asynchronously takes getting used to. Learn libraries
like async at the start: https://github.com/caolan/async.
 Flow control is very important.
 Also greatly helps exception handling.
 Control your versioning carefully for dependencies.
 Follow semantic versioning: http://semver.org/.
 If your versioning isn’t specific enough a deployment can break.
 Often best to package dependencies during deployment.
Node.js: Lessons Continued
 Amazing ecosystem: always check for an existing npm
module before writing something new.
 I strongly recommend Grunt for building your project, and
Bower for client-side web package management.
 http://gruntjs.com/
 http://bower.io/
 Yeoman generators are a great way to bootstrap a project:
http://yeoman.io/
 Daemonize your app with tools like forever:
https://github.com/nodejitsu/forever
Node.js: Lessons Continued
 Use clustering module: will run a copy of your Node
process on each available core.
 Think stateless: in general for web apps, and especially
here so you can scale out.
 Follow CommonJS module for code organization:
http://www.commonjs.org/specs/modules/1.0/
 Don’t expect to share a lot of code between the browser
and the server. However the lack of context switching (all
JS all the time) is the real benefit.
Thanks!
 Chris Bumgardner
 https://github.com/cbumgard
 https://www.linkedin.com/in/chrisbumgardner
 Please don’t hesitate to contact me 
Links
 http://www.slideshare.net/chrisbumgardner/benetech-nodejsvagrant
 https://github.com/cbumgard/mathoid-vagrant
 http://www.vagrantup.com/downloads.html
 https://www.virtualbox.org/wiki/Downloads
 https://github.com/mitchellh/vagrant-aws
 https://github.com/10thmagnitude/vagrant-azure
 https://gist.github.com/GUI/2864683
 https://github.com/caolan/async
 http://semver.org/

More Related Content

What's hot

It Works On My Machine: Vagrant for Software Development
It Works On My Machine: Vagrant for Software DevelopmentIt Works On My Machine: Vagrant for Software Development
It Works On My Machine: Vagrant for Software DevelopmentCarlos Perez
 
Automated Infrastructure and Application Management
Automated Infrastructure and Application ManagementAutomated Infrastructure and Application Management
Automated Infrastructure and Application ManagementClark Everetts
 
Vagrant 101 Workshop
Vagrant 101 WorkshopVagrant 101 Workshop
Vagrant 101 WorkshopLiora Milbaum
 
Vagrant-Binding JUG Dortmund
Vagrant-Binding JUG DortmundVagrant-Binding JUG Dortmund
Vagrant-Binding JUG DortmundHendrik Ebbers
 
VCCW - Vagrant based WordPress development environment
VCCW - Vagrant based WordPress development environmentVCCW - Vagrant based WordPress development environment
VCCW - Vagrant based WordPress development environmentTakayuki Miyauchi
 
Wocker @WordBench Osaka No.41
Wocker @WordBench Osaka No.41Wocker @WordBench Osaka No.41
Wocker @WordBench Osaka No.41Kite Koga
 
Virtualization for Developers
Virtualization for DevelopersVirtualization for Developers
Virtualization for DevelopersJohn Coggeshall
 
Virtualization for Developers
Virtualization for DevelopersVirtualization for Developers
Virtualization for DevelopersJohn Coggeshall
 
6 Years of Docker: The Good, the Bad and Python Packaging at PyCon.DE&PyData ...
6 Years of Docker: The Good, the Bad and Python Packaging at PyCon.DE&PyData ...6 Years of Docker: The Good, the Bad and Python Packaging at PyCon.DE&PyData ...
6 Years of Docker: The Good, the Bad and Python Packaging at PyCon.DE&PyData ...Sebastian Neubauer
 
Dev to Delivery with Puppet, Vagrant and AWS
Dev to Delivery with Puppet, Vagrant and AWSDev to Delivery with Puppet, Vagrant and AWS
Dev to Delivery with Puppet, Vagrant and AWSPuppet
 
Getting Started with Docker (For Developers)
Getting Started with Docker (For Developers)Getting Started with Docker (For Developers)
Getting Started with Docker (For Developers)ColdFusionConference
 
Vagrant - Version control your dev environment
Vagrant - Version control your dev environmentVagrant - Version control your dev environment
Vagrant - Version control your dev environmentbocribbz
 
Local development environment through virtualisation
Local development environment through virtualisationLocal development environment through virtualisation
Local development environment through virtualisationRadu Barbu
 
Vagrant up-and-running
Vagrant up-and-runningVagrant up-and-running
Vagrant up-and-runningJoe Ferguson
 

What's hot (20)

It Works On My Machine: Vagrant for Software Development
It Works On My Machine: Vagrant for Software DevelopmentIt Works On My Machine: Vagrant for Software Development
It Works On My Machine: Vagrant for Software Development
 
Intro to vagrant
Intro to vagrantIntro to vagrant
Intro to vagrant
 
Vagrant
Vagrant Vagrant
Vagrant
 
Vagrant
VagrantVagrant
Vagrant
 
Automated Infrastructure and Application Management
Automated Infrastructure and Application ManagementAutomated Infrastructure and Application Management
Automated Infrastructure and Application Management
 
Vagrant 101 Workshop
Vagrant 101 WorkshopVagrant 101 Workshop
Vagrant 101 Workshop
 
Vagrant-Binding JUG Dortmund
Vagrant-Binding JUG DortmundVagrant-Binding JUG Dortmund
Vagrant-Binding JUG Dortmund
 
Vagrant to-aws-flow
Vagrant to-aws-flowVagrant to-aws-flow
Vagrant to-aws-flow
 
VCCW - Vagrant based WordPress development environment
VCCW - Vagrant based WordPress development environmentVCCW - Vagrant based WordPress development environment
VCCW - Vagrant based WordPress development environment
 
Vagrant
VagrantVagrant
Vagrant
 
Wocker @WordBench Osaka No.41
Wocker @WordBench Osaka No.41Wocker @WordBench Osaka No.41
Wocker @WordBench Osaka No.41
 
Virtualization for Developers
Virtualization for DevelopersVirtualization for Developers
Virtualization for Developers
 
Virtualization for Developers
Virtualization for DevelopersVirtualization for Developers
Virtualization for Developers
 
6 Years of Docker: The Good, the Bad and Python Packaging at PyCon.DE&PyData ...
6 Years of Docker: The Good, the Bad and Python Packaging at PyCon.DE&PyData ...6 Years of Docker: The Good, the Bad and Python Packaging at PyCon.DE&PyData ...
6 Years of Docker: The Good, the Bad and Python Packaging at PyCon.DE&PyData ...
 
Dev to Delivery with Puppet, Vagrant and AWS
Dev to Delivery with Puppet, Vagrant and AWSDev to Delivery with Puppet, Vagrant and AWS
Dev to Delivery with Puppet, Vagrant and AWS
 
GlassFish Embedded API
GlassFish Embedded APIGlassFish Embedded API
GlassFish Embedded API
 
Getting Started with Docker (For Developers)
Getting Started with Docker (For Developers)Getting Started with Docker (For Developers)
Getting Started with Docker (For Developers)
 
Vagrant - Version control your dev environment
Vagrant - Version control your dev environmentVagrant - Version control your dev environment
Vagrant - Version control your dev environment
 
Local development environment through virtualisation
Local development environment through virtualisationLocal development environment through virtualisation
Local development environment through virtualisation
 
Vagrant up-and-running
Vagrant up-and-runningVagrant up-and-running
Vagrant up-and-running
 

Similar to Node.js, Vagrant, Chef, and Mathoid @ Benetech

Vagrant for local and team WordPress Development
Vagrant for local and team WordPress DevelopmentVagrant for local and team WordPress Development
Vagrant for local and team WordPress DevelopmentAnthony Alvarez
 
DevOps Camp 2017 NYC Local Development using Vagrant by Anthony Alvarez
DevOps Camp 2017 NYC Local Development using Vagrant by Anthony AlvarezDevOps Camp 2017 NYC Local Development using Vagrant by Anthony Alvarez
DevOps Camp 2017 NYC Local Development using Vagrant by Anthony AlvarezAnthony Alvarez
 
Take Home Your Very Own Free Vagrant CFML Dev Environment
Take Home Your Very Own Free Vagrant CFML Dev Environment Take Home Your Very Own Free Vagrant CFML Dev Environment
Take Home Your Very Own Free Vagrant CFML Dev Environment ColdFusionConference
 
Take home your very own free Vagrant CFML Dev Environment - Presented at dev....
Take home your very own free Vagrant CFML Dev Environment - Presented at dev....Take home your very own free Vagrant CFML Dev Environment - Presented at dev....
Take home your very own free Vagrant CFML Dev Environment - Presented at dev....Gavin Pickin
 
Oracle Developers APAC Meetup #1 - Working with Wercker Worksheets
Oracle Developers APAC Meetup #1 -  Working with Wercker WorksheetsOracle Developers APAC Meetup #1 -  Working with Wercker Worksheets
Oracle Developers APAC Meetup #1 - Working with Wercker WorksheetsDarrel Chia
 
Vagrant are you still develop in a non-virtual environment-
Vagrant  are you still develop in a non-virtual environment-Vagrant  are you still develop in a non-virtual environment-
Vagrant are you still develop in a non-virtual environment-Anatoly Bubenkov
 
Using Docker to build and test in your laptop and Jenkins
Using Docker to build and test in your laptop and JenkinsUsing Docker to build and test in your laptop and Jenkins
Using Docker to build and test in your laptop and JenkinsMicael Gallego
 
Puppet and Vagrant in development
Puppet and Vagrant in developmentPuppet and Vagrant in development
Puppet and Vagrant in developmentAdam Culp
 
codemotion-docker-2014
codemotion-docker-2014codemotion-docker-2014
codemotion-docker-2014Carlo Bonamico
 
Why everyone is excited about Docker (and you should too...) - Carlo Bonamic...
Why everyone is excited about Docker (and you should too...) -  Carlo Bonamic...Why everyone is excited about Docker (and you should too...) -  Carlo Bonamic...
Why everyone is excited about Docker (and you should too...) - Carlo Bonamic...Codemotion
 
Create Development and Production Environments with Vagrant
Create Development and Production Environments with VagrantCreate Development and Production Environments with Vagrant
Create Development and Production Environments with VagrantBrian Hogan
 
Docker navjot kaur
Docker navjot kaurDocker navjot kaur
Docker navjot kaurNavjot Kaur
 
Warden @ Meet magento Romania 2021
Warden @ Meet magento Romania 2021Warden @ Meet magento Romania 2021
Warden @ Meet magento Romania 2021alinalexandru
 
Linux containers and docker
Linux containers and dockerLinux containers and docker
Linux containers and dockerFabio Fumarola
 
Vagrant Binding JayDay 2013
Vagrant Binding JayDay 2013Vagrant Binding JayDay 2013
Vagrant Binding JayDay 2013Hendrik Ebbers
 
Foundation of starting your drupal project to vagrant environment
Foundation of starting your drupal project to vagrant environmentFoundation of starting your drupal project to vagrant environment
Foundation of starting your drupal project to vagrant environmentEleison Cruz
 
AtoM and Vagrant: Installing and Configuring the AtoM Vagrant Box for Local T...
AtoM and Vagrant: Installing and Configuring the AtoM Vagrant Box for Local T...AtoM and Vagrant: Installing and Configuring the AtoM Vagrant Box for Local T...
AtoM and Vagrant: Installing and Configuring the AtoM Vagrant Box for Local T...Artefactual Systems - AtoM
 

Similar to Node.js, Vagrant, Chef, and Mathoid @ Benetech (20)

Vagrant for local and team WordPress Development
Vagrant for local and team WordPress DevelopmentVagrant for local and team WordPress Development
Vagrant for local and team WordPress Development
 
DevOps Camp 2017 NYC Local Development using Vagrant by Anthony Alvarez
DevOps Camp 2017 NYC Local Development using Vagrant by Anthony AlvarezDevOps Camp 2017 NYC Local Development using Vagrant by Anthony Alvarez
DevOps Camp 2017 NYC Local Development using Vagrant by Anthony Alvarez
 
Keep calm and vagrant up
Keep calm and vagrant upKeep calm and vagrant up
Keep calm and vagrant up
 
Take Home Your Very Own Free Vagrant CFML Dev Environment
Take Home Your Very Own Free Vagrant CFML Dev Environment Take Home Your Very Own Free Vagrant CFML Dev Environment
Take Home Your Very Own Free Vagrant CFML Dev Environment
 
Take home your very own free Vagrant CFML Dev Environment - Presented at dev....
Take home your very own free Vagrant CFML Dev Environment - Presented at dev....Take home your very own free Vagrant CFML Dev Environment - Presented at dev....
Take home your very own free Vagrant CFML Dev Environment - Presented at dev....
 
Oracle Developers APAC Meetup #1 - Working with Wercker Worksheets
Oracle Developers APAC Meetup #1 -  Working with Wercker WorksheetsOracle Developers APAC Meetup #1 -  Working with Wercker Worksheets
Oracle Developers APAC Meetup #1 - Working with Wercker Worksheets
 
Vagrant are you still develop in a non-virtual environment-
Vagrant  are you still develop in a non-virtual environment-Vagrant  are you still develop in a non-virtual environment-
Vagrant are you still develop in a non-virtual environment-
 
Using Docker to build and test in your laptop and Jenkins
Using Docker to build and test in your laptop and JenkinsUsing Docker to build and test in your laptop and Jenkins
Using Docker to build and test in your laptop and Jenkins
 
Puppet and Vagrant in development
Puppet and Vagrant in developmentPuppet and Vagrant in development
Puppet and Vagrant in development
 
codemotion-docker-2014
codemotion-docker-2014codemotion-docker-2014
codemotion-docker-2014
 
Security Testing Using Infrastructure-As-Code
Security Testing Using Infrastructure-As-CodeSecurity Testing Using Infrastructure-As-Code
Security Testing Using Infrastructure-As-Code
 
Why everyone is excited about Docker (and you should too...) - Carlo Bonamic...
Why everyone is excited about Docker (and you should too...) -  Carlo Bonamic...Why everyone is excited about Docker (and you should too...) -  Carlo Bonamic...
Why everyone is excited about Docker (and you should too...) - Carlo Bonamic...
 
Vagrant Up in 5 Easy Steps
Vagrant Up in 5 Easy StepsVagrant Up in 5 Easy Steps
Vagrant Up in 5 Easy Steps
 
Create Development and Production Environments with Vagrant
Create Development and Production Environments with VagrantCreate Development and Production Environments with Vagrant
Create Development and Production Environments with Vagrant
 
Docker navjot kaur
Docker navjot kaurDocker navjot kaur
Docker navjot kaur
 
Warden @ Meet magento Romania 2021
Warden @ Meet magento Romania 2021Warden @ Meet magento Romania 2021
Warden @ Meet magento Romania 2021
 
Linux containers and docker
Linux containers and dockerLinux containers and docker
Linux containers and docker
 
Vagrant Binding JayDay 2013
Vagrant Binding JayDay 2013Vagrant Binding JayDay 2013
Vagrant Binding JayDay 2013
 
Foundation of starting your drupal project to vagrant environment
Foundation of starting your drupal project to vagrant environmentFoundation of starting your drupal project to vagrant environment
Foundation of starting your drupal project to vagrant environment
 
AtoM and Vagrant: Installing and Configuring the AtoM Vagrant Box for Local T...
AtoM and Vagrant: Installing and Configuring the AtoM Vagrant Box for Local T...AtoM and Vagrant: Installing and Configuring the AtoM Vagrant Box for Local T...
AtoM and Vagrant: Installing and Configuring the AtoM Vagrant Box for Local T...
 

Recently uploaded

Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
Français Patch Tuesday - Avril
Français Patch Tuesday - AvrilFrançais Patch Tuesday - Avril
Français Patch Tuesday - AvrilIvanti
 
Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#Karmanjay Verma
 
All These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDFAll These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDFMichael Gough
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...JET Technology Labs White Paper for Virtualized Security and Encryption Techn...
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...amber724300
 
WomenInAutomation2024: AI and Automation for eveyone
WomenInAutomation2024: AI and Automation for eveyoneWomenInAutomation2024: AI and Automation for eveyone
WomenInAutomation2024: AI and Automation for eveyoneUiPathCommunity
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024TopCSSGallery
 
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Mark Simos
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...panagenda
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observabilityitnewsafrica
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesBernd Ruecker
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
Infrared simulation and processing on Nvidia platforms
Infrared simulation and processing on Nvidia platformsInfrared simulation and processing on Nvidia platforms
Infrared simulation and processing on Nvidia platformsYoss Cohen
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditSkynet Technologies
 
A Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxA Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxAna-Maria Mihalceanu
 

Recently uploaded (20)

Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
Français Patch Tuesday - Avril
Français Patch Tuesday - AvrilFrançais Patch Tuesday - Avril
Français Patch Tuesday - Avril
 
Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#
 
All These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDFAll These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDF
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...JET Technology Labs White Paper for Virtualized Security and Encryption Techn...
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...
 
WomenInAutomation2024: AI and Automation for eveyone
WomenInAutomation2024: AI and Automation for eveyoneWomenInAutomation2024: AI and Automation for eveyone
WomenInAutomation2024: AI and Automation for eveyone
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024
 
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architectures
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
Infrared simulation and processing on Nvidia platforms
Infrared simulation and processing on Nvidia platformsInfrared simulation and processing on Nvidia platforms
Infrared simulation and processing on Nvidia platforms
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance Audit
 
A Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxA Glance At The Java Performance Toolbox
A Glance At The Java Performance Toolbox
 

Node.js, Vagrant, Chef, and Mathoid @ Benetech

  • 1. Node.js with Vagrant and Chef @ Benetech April 24, 2014 Chris Bumgardner
  • 2. Why Vagrant?  Speed and Portability  Get a working uniform development environment running in about 15 minutes while getting a coffee.  This often takes hours or days for a modern environment getting specific libraries, tools, and versions for a specific operating system.  Open source and mature. Around since 2010.
  • 3. Advantages to a VM Image  Vagrant is small: just text files in source control  A snapshot is typically around 0.5GB – 1GB. Hard to host and transfer.  A snapshot is binary: changing a version of a library is hard, but in Vagrant it is just a configuration change.  Abstraction: Vagrant can run on top of different providers, such as AWS, Docker or Azure in addition to a local virtual machine.  https://github.com/mitchellh/vagrant-aws  https://github.com/10thmagnitude/vagrant-azure
  • 4. Installing Vagrant & VirtualBox  Install Vagrant here: http://www.vagrantup.com/downloads.html  Install VirtualBox here: https://www.virtualbox.org/wiki/Downloads  Cloud boxes are automatically downloaded and installed with Vagrant 1.5+  Be sure to upgrade Vagrant if you have an older version.
  • 5. Configuration Management via Chef  Idempotent  You can run Chef multiple times on the same system with identical results.  Not the case with shell scripts: running more than once will usually lead to unpredictable results.  Cross-platform  Chef supports Linux, Mac, Windows  Shell scripts are system dependent  Existing ecosystem of cookbooks: don’t reinvent the wheel.  Chef Solo: runs on local machine, does not require server infrastructure.
  • 6. Docker, Packer, etc: More DevOps  DevOps tools appear daily.  Chef alternatives: Puppet, Ansible, Salt, etc.  Docker.io  Promising tool that contains and virtualizes processes.  Think of Vagrant but for a specific process.  Example: turn a server application into a portable image.  Packer.io  Automates creation of machine images.  A meta layer above a tool like Vagrant.
  • 7. Mathoid using Vagrant  https://github.com/cbumgard/mathoid-vagrant  Once running you can access at localhost:10042  Built on Ubuntu Precise 12.04 64-bit base box. Found 14.04 not compatible yet with Mathoid.  First time you “vagrant up” it has to download the base box (~300MB). Boxes are cached locally however.  Added Chef cookbooks as Git submodules. Requires just an extra two commands the first time you clone the repo, makes for a cleaner repository.
  • 8. Mathoid + Vagrant continued  All configuration done in the Vagrantfile: https://github.com/cbumgard/mathoid- vagrant/blob/master/Vagrantfile  Non-provisioning changes to Vagrantfile, such as networking configuration, will take effect on a “vagrant reload” (halt + up).  Provisioning changes will not run unless you destroy and re-up, or do a “vagrant provision”.  This Vagrantfile is a combination of shell, file, and chef provisioning.
  • 9. Vagrant: Things to Note  Pick your base box carefully.  Ideally has the configuration manager (e.g. Chef) installed that you will use for provisioning.  Avoid anything else if possible. For example a base box with Node.js built in will be trickier to upgrade to a new version than if you add Node.js as a Chef cookbook.  You can always see installed boxes via “vagrant box list”  When creating a Vagrantfile test incrementally via “vagrant provision”  Vagrant commands you should learn:  init, up, ssh, suspend, resume, halt, destroy  reload: halt + up
  • 10. Vagrant: continued  When switching networks on the host (e.g. changing WIFI networks on your laptop) you may need to “vagrant reload” for the guest VM networking.  If you want to access files from your host machine inside the guest vm, be sure to use NFS:true in your synchronized folder setup.  Gives ~10x performance accessing files. Noticeable if running a webserver like Node.js in the VM on files on your host.  Requires nfs-common installed.  Requires password on “vagrant up”. Fix for that at: https://gist.github.com/GUI/2864683
  • 11. Vagrant: continued  When shell provisioning keep in mind:  Your script is running as root. No need for sudo.  Interactive prompts will hang and timeout. Make sure to add flags like “-y” to command-line calls like “apt-get”.  You can enable a GUI from the Vagrantfile if you want to do graphical work in the VM  Provisioning usually requires download files from many sources: occasionally there will be intermitent problems downloading from certain sources.  Check out Vagrant Shares. New in 1.5. Allows giving others outside your local network access to your running machine.
  • 12. Node.js: Lessons Learned  Node.js runs all Javascript code on a single thread.  So you can’t do heavy operations in the JS layer.  Consider message queues or pub/sub like Redis.io  Thinking asynchronously takes getting used to. Learn libraries like async at the start: https://github.com/caolan/async.  Flow control is very important.  Also greatly helps exception handling.  Control your versioning carefully for dependencies.  Follow semantic versioning: http://semver.org/.  If your versioning isn’t specific enough a deployment can break.  Often best to package dependencies during deployment.
  • 13. Node.js: Lessons Continued  Amazing ecosystem: always check for an existing npm module before writing something new.  I strongly recommend Grunt for building your project, and Bower for client-side web package management.  http://gruntjs.com/  http://bower.io/  Yeoman generators are a great way to bootstrap a project: http://yeoman.io/  Daemonize your app with tools like forever: https://github.com/nodejitsu/forever
  • 14. Node.js: Lessons Continued  Use clustering module: will run a copy of your Node process on each available core.  Think stateless: in general for web apps, and especially here so you can scale out.  Follow CommonJS module for code organization: http://www.commonjs.org/specs/modules/1.0/  Don’t expect to share a lot of code between the browser and the server. However the lack of context switching (all JS all the time) is the real benefit.
  • 15. Thanks!  Chris Bumgardner  https://github.com/cbumgard  https://www.linkedin.com/in/chrisbumgardner  Please don’t hesitate to contact me 
  • 16. Links  http://www.slideshare.net/chrisbumgardner/benetech-nodejsvagrant  https://github.com/cbumgard/mathoid-vagrant  http://www.vagrantup.com/downloads.html  https://www.virtualbox.org/wiki/Downloads  https://github.com/mitchellh/vagrant-aws  https://github.com/10thmagnitude/vagrant-azure  https://gist.github.com/GUI/2864683  https://github.com/caolan/async  http://semver.org/

Editor's Notes

  1. My first experience with Vagrant was on the Obama 2012 campaign with the West Coast TFO.
  2. Give demo of working instance
  3. Walk through the Vagrant fileExplain private network & synced folder options
  4. I have been experiencing difficulty with official Ubuntu boxes (ubuntu/*) lately. Downloads aren’t working.
  5. Grunt: asset pipeline, packaging, tests, etc.