Way to resume failed provisioning / tips for debugging a vagrantfile?

568 views
Skip to first unread message

Kevin Schumacher

unread,
Apr 23, 2014, 3:22:04 PM4/23/14
to vagra...@googlegroups.com
Hi all, 

I am very new to vagrant, and have a couple of questions:

1. Is there a way to resume a failed provisioning? 
2. Is there a way to "step through" a vagrantfile? 

For background: 

I am trying to use Vagrant for quick "one click" setup of a development infrastructure environment when new people join the team. We have an unfortunately complicated stack, and have previously been utilizing Docker and dockerfiles to keep everyone's development environments in sync. 

I am hoping to be able to utilize the work put into creating the dockerfiles with Vagrant, and to be able to have someone new just "vagrant up" and provision the full stack in Docker containers (this would lower the barriers to entry -- the new team member would not have to understand immediately how to set up the stack, install docker, how the various parts of the stack are related, etc. before being able to contribute some code to the web app on top of the stack)

However, I am finding that troubleshooting failures during provision is slow and painful. Earlier today I found that a dockerfile no longer worked because of a remote file which moved, which was causing my provision to fail. 


Thanks,
Kevin

Alvaro Miranda Aguilera

unread,
Apr 23, 2014, 8:18:51 PM4/23/14
to vagra...@googlegroups.com
Hello,

Vagrant will automate what you tell Vagrant to automate.

So, what you should think is, what to do fi something change or you go half way trough..

If a end user was using your Vagrantfile, then he should be able to do  vagrant destroy, vagrant up and get a working environment.

In your particular case, you want to be able to troubleshoot, then, you can use puts "running this..." before eachs ection so yoiu can follow what is doing..

if you use scripts, make sure, the script can be called more than once and it won't break anything.. so you can do vagrant provision and should skip what did and continue.


What OS is the host? the docker is inside a Vagran'ts managed vm?

Are you using docker provisioner os just shell provisioner to call vagrant commands?


--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Kevin Schumacher

unread,
Apr 24, 2014, 10:17:11 AM4/24/14
to vagra...@googlegroups.com
I'm using the hashicorp/precise64 box, and using the Docker provisioner. 

I understand that I can issue some print statements (and am doing that). 

When developing dockerfiles, each step is cached so that if there is an error, you can essentially fix the error in the Dockerfile and more or less resume. Vagrant doesn't do something similar, does it?

I see now that if I just do a `vagrant provision` it starts to do the provision steps. So if the provision fails after an initial vagrant up, I can just edit the commands to the provisioner, issue a `vagrant provision`, and it will restart with the docker provisioner (assuming I don't have any other provisioners set up). As long as I make sure the commands the provisioner issues can be run multiple times safely, then this works for me. This is helpful information. Previously I thought I had to do a vagrant destroy && vagrant up to try again (so it would configure the whole VM again). 

Thanks,
Kevin

Alvaro Miranda Aguilera

unread,
Apr 24, 2014, 8:56:24 PM4/24/14
to vagra...@googlegroups.com
docker use layers, vagrant doesn't

so, if you first vagrant up, you have

vagrant provision
vagrant reload --provision
vagrant up --provision
etc,

in my particular use case, some commands like update rpms, I can run them more than one, nothing happen

others, I just include some checks,

example, if the user exits, then all good, if not, then create.. etc

for software install, i check, if the software is installed say /u01/app/oracle/product/12.1.0.1/dbhome_1/bin exits.. then.. skip

etc.

Reply all
Reply to author
Forward
0 new messages