Provisioning using a dump of a large test database

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Provisioning using a dump of a large test database

Scott Danzig
I'd like to do a mongorestore upon provisioning my dev environment.  The database is pretty big (a 10GB mongo dump), but useful for development purposes.  I'd need the dump just for the initial provisioning, and then it ideally should no longer be in the VM.  For now, I'm just keeping the dump in an expected location, ~/vagrant-support/test-db

Question 1:
Is there any way to avoid copying it?  It'd be nice if I could symbolically link to it without copying via syncing.

Question 2:
I was going to ask how to copy over a whole folder, rather than just a file, like the file provisioner allows, but I'd rather have it run a script, which wgets from a URL if the dump is not local.  So how would I run an arbitrary script just for the provisioning?

Thanks!

--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Provisioning using a dump of a large test database

Terrance Shepherd
You would use the shell provider to do such actions. Additionally with shared folders you have share entire directories from the host to the dev machine. If you wanted to you could actually host the file on the dev machine and then mongo restore would just have access to it in the shared folder.


On Wed, Aug 20, 2014 at 12:50 PM, Scott Danzig <[hidden email]> wrote:
I'd like to do a mongorestore upon provisioning my dev environment.  The database is pretty big (a 10GB mongo dump), but useful for development purposes.  I'd need the dump just for the initial provisioning, and then it ideally should no longer be in the VM.  For now, I'm just keeping the dump in an expected location, ~/vagrant-support/test-db

Question 1:
Is there any way to avoid copying it?  It'd be nice if I could symbolically link to it without copying via syncing.

Question 2:
I was going to ask how to copy over a whole folder, rather than just a file, like the file provisioner allows, but I'd rather have it run a script, which wgets from a URL if the dump is not local.  So how would I run an arbitrary script just for the provisioning?

Thanks!

--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.

--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Provisioning using a dump of a large test database

Alvaro Miranda Aguilera
In reply to this post by Scott Danzig

On Thu, Aug 21, 2014 at 4:50 AM, Scott Danzig <[hidden email]> wrote:
~/vagrant-support/test-db


On top of what Terrance said, what you can do is.

set a shared folder .. will be OK read the file, just don't use it from here as may be issues with performance or sync... but to read will be fine:

https://docs.vagrantup.com/v2/synced-folders/basic_usage.html

config.vm.synced_folder "~/vagrant-support/test-db", "/test-db"

for the 2nd question, you can use the rsync sync to copy a folder from the host to the guest

if the host is osx or linux it should work easyly.

if the host is windows, then check the mailing list archive for some recipes of combination of versions rsync etc

rsync:
https://docs.vagrantup.com/v2/synced-folders/rsync.html


other option will be mount the shared folder and then run an script

provisioning scripts will be run at vagrant up the first time, or later you can re-run them with

vagrant up --provision

or vagrant provision    if the guest is up and running.


shell:
https://docs.vagrantup.com/v2/provisioning/shell.html


Alvaro.

--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.