Skip to content
This repository has been archived by the owner on Feb 13, 2023. It is now read-only.

Why does a vagrant provision rebuild the machine? #755

Closed
mixplex opened this issue Jun 24, 2016 · 5 comments
Closed

Why does a vagrant provision rebuild the machine? #755

mixplex opened this issue Jun 24, 2016 · 5 comments
Labels

Comments

@mixplex
Copy link

mixplex commented Jun 24, 2016

Hello

I am using the latest Drupalvm and building an Unbuntu 1604, PHP 7 machine. When I reloaded and provisioned, it rebuilt the machine, wiping out my dbs and my custom .bashrc file. I can't figure out why it did this. I made a minor change to a site alias name. I have experienced it before with this php 7 machine but not with another machine I use with php 5.6. I would like to know how to prevent this from happening again as I get further into development on multiple sites. Is this too little information to provide?

@geerlingguy
Copy link
Owner

geerlingguy commented Jun 24, 2016

@mixplex - Did you use vagrant reload --provision? What was the exact command you ran to build the VM?

By default, there's no way for the roles in Drupal VM to delete any databases, but if you do things manually to database permissions after the VM is built then provision again, Ansible will put all the databases back into the state as defined in config.yml/default.config.yml, but no data will ever be deleted/no databases will be reset.

If you run vagrant destroy, then the VM will be deleted entirely. When it's rebuilt, it will all be fresh/new and any data that was previously there will be gone.

But I run vagrant provision (or vagrant reload --provision) very frequently, sometimes 20+ times per day on a particular VM, and it doesn't affect any data inside the VM. It will simply bring all the configuration in line with settings in your config file.

@mixplex
Copy link
Author

mixplex commented Jun 25, 2016

Yes. I used vagrant reload --provision. I'll see if I can replicate it and let you know. I had pulled changes first and then ran the provision which wanted to update.

  • Updating drupal/devel (dev-8.x-1.x 5c6a506 => 8.1.0-alpha1)
    The package has modified files:
    M run-tests-drush.sh
    Discard changes [y,n,v,d,s,?]? y
    Checking out 930b7b89c2fa2047ebbb0fb3ba53f45a67409242
    • Updating drupal/field_collection dev-1.0.x (cce8ad8 => e3a9fd4)
      The package has modified files:
      M field_collection.info.yml
      M templates/field-collection-item.html.twig
      Discard changes [y,n,v,d,s,?]? y
      Checking out e3a9fd405488b707b6cf189e92b742015d0267cf

I chose to discard the changes. I am new to composer builds and executed a composer update from /drupal/composer.json while I was building the vm in another shell - thinking this task would complete before vagrant got up to that part. It seemed to, but then it couldn't finish, reporting that the composer.lock was busy.

That's what I recall, though this may be inaccurate.

Thanks for your response. All is well otherwise with three VM's working as expected.

@mixplex
Copy link
Author

mixplex commented Jun 25, 2016

I figured it out. I have been following the thread on switchable php versions, #667; #714 but I am not there yet. Meanwhile, I have two directories I am swapping out - but my shell sticks to the directory I move. When I run vagrant up from the vm I moved, it makes a new machine in the new directory location. I needed to use a new terminal window or make sure I was in the right place.

@mixplex
Copy link
Author

mixplex commented Jun 25, 2016

The exports file kept track of new machine builds in different locations...

@mixplex mixplex closed this as completed Jun 25, 2016
@geerlingguy
Copy link
Owner

@mixplex - Ah, that definitely makes sense then. Vagrant doesn't like directory changes much :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants