SlideShare a Scribd company logo
1 of 16
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

How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGSujit Pal
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 

Recently uploaded (20)

How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAG
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 

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.