Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vagrant in production

I've been reading about Vagrant, and I find it quite useful for my development. I am currently managing a series of services (mail, web, LDAP, file sharing, etc.), and often one of these falls and needs a quick backup. Is it possible (and recommended) to use Vagrant for these purposes?

So far I've virtual machines installed like real machines.

I would also like to know about an alternative to Vagrant which would allow me to setup a simple configuration file and put a virtual machine, for example, with Zimbra, and quickly have an alternate mail server, enable RabbitMQ, etc.

like image 574
rkmax Avatar asked Nov 15 '12 01:11

rkmax


People also ask

Can Vagrant be used in production?

Users of Vagrant for years have wanted a way to deploy their Vagrant environments to production. Unfortunately, the Vagrantfile doesn't contain enough information to build a proper production environment with industry best practices. An Appfile is made to encode this knowledge, and deployment is a single command away.

What is the purpose of Vagrant?

“Vagrant is a tool for building and managing virtual machine environments in a single workflow. With an easy-to-use workflow and focus on automation, Vagrant lowers development environment setup time, increases production parity, and makes the works on my machine excuse a relic of the past.”

What's a Vagrant file?

The Vagrantfile is a Ruby file used to configure Vagrant on a per-project basis. The main function of the Vagrantfile is to described the virtual machines required for a project as well as how to configure and provision these machines.

What is the difference between Vagrant and VirtualBox?

VirtualBox is basically inception for your computer. You can use VirtualBox to run entire sandboxed operating systems within your own computer. Vagrant is software that is used to manage a development environment.


2 Answers

Vagrant should be used more like a staging environment to test your infrastructure changes. It should be your test bed for automated infrastructure changes.

The way we use it at my company is like so:

  1. Create VMs for our managed servers in Vagrant.
  2. Create puppet definitions for each server.
  3. Create cucumber tests for each server.
  4. Make infrastructure changes via puppet and add cucumber tests.
  5. Launch our servers to test for failures.
  6. Fix bugs, release and/or back to step 4.

Basically when we're happy with our changes, we'll pull our puppet changes into production to make it happen.

I'd not recommend using vagrant to manage VMs for real production. I'd use something else like razor, virsh, OpenStack or one of the many other vm management systems out there.

like image 71
Sekm Avatar answered Oct 19 '22 18:10

Sekm


This page suggests that the Vagrant push command is meant for deploying to production:

https://www.hashicorp.com/blog/vagrant-push-one-command-to-deploy-any-application/

"Additionally, multiple config.push.define declarations can be in a Vagrantfile to define multiple pushes, perhaps one to staging and one to production, for example."

like image 3
skinneejoe Avatar answered Oct 19 '22 18:10

skinneejoe