Skip to content

vml-jbartlett/JB-DrupalVM

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

58 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Installation Profile Instructions

Updated: 2016-06-29

Requirements

The basic tools needed to install this box are:

Installation instructions

  1. Create a fork in the %project_name% Repo and clone the site to your ~/Sites folder: git clone %project_origin_repo% ~/Sites/%production_url%
  2. CD into your site folder: cd ~/Sites/%production_url%
  3. Copy the example.local.config.yml and save as local.config.yml: cp dvm/example.local.config.yml dvm/local.config.yml
  4. Edit the local.config.yml and update the "ssh_username" with your ssh login name: vi dvm/local.config.yml
  5. Bring up Vagrant (This might take a while!): vagrant up
  6. Once complete, Vagrant will open the dashboard in your default browser - http://dashboard.%vagrant_hostname%. Your site should now be available at https://%vagrant_hostname%

Troubleshooting:

If vagrant throws an error on vagrant up:

  • Try updating your Vagrant box: vagrant box update and run vagrant up --provision.
  • Run vagrant box list to see if the box "%vagrant_box%" exists. If it does, remove it with vagrant box remove %vagrant_box% then run vagrant up again.

If you get an "ECDSA host key" error, check your "known_host" file sudo vi ~/.ssh/known_hosts for instances of "%vagrant_hostname%" - most likely at the bottom of the file. Remove the line and save the file. Then, run vagrant up again.

Drush Aliases

The site install should have added Drush aliases for the available environments. They are as follows:

To use these, cd into the (core Drupal file): cd %drupal_core_path% (or from anywhere if Drush is installed globally on your machine.) and run your Drush commands, e.g., drush @%project_name%.local status .

Installing authorized ssh keys

Note: This step may no longer be required.

If needed, install your public key: cat ~/.ssh/id_rsa.pub | ssh vagrant@%vagrant_autoip% 'cat >> .ssh/authorized_keys' For the local alias, the default password for user "vagrant" is "vagrant." All other aliases should use your normal login info following the example given.

Initial Database and File updates

Image and file syncing

Images and other files are updated automatically on your local through the Stage File Proxy module.

Database updating

Implementing a recent version of Production database is now a part of the initialization process of the Vagrant build. If your site launches without a database install or you wish to update your local with what is currently on production, follow the instructions below.

To update your data to what is currently available on Production, download a recent backup by logging into the %project_name% Prod site and go to Backup and Migrate. From here, you can either generate a new backup or download a recent file from the "Saved backups" tab. (You will need Admin access to %project_name% in order to do this.)

With the downloaded file, do one of the following tasks:

  • Go to Backup and Migrate on your local site and restore the database with your backup file.
  • Using Drush, sync from the SQL dump file with: drush @%project_name%.local sql-cli < %vagrant_local_path%/*.mysql.gz
  • Import the backup through other third party software (e.g.: Sequel Pro) using the SQL settings found on the dashboard.

Running Vagrant without sudo password

Since this Vagrant install uses "vagrant-hostsupdater" to write to the /etc/hosts file, the up/halt/reload processes will persistently ask for sudo password information. This can cause problems when trying to run vagrant from programs like PHPStorm, where it might not typically run askpass processes.

To bypass this, you will need to make modifications to your sudoers file to give Vagrant permission to write to the hosts file. You can do this by following these steps:

  1. From the command line, edit the sudoers file by running sudo visudo

  2. Scroll to the bottom of the file and type i to enter "insert mode"

  3. Insert the following code:

     # vagrant-hostsupdater
     Cmnd_Alias VAGRANT_HOSTS_ADD = /bin/sh -c echo "*" >> /etc/hosts
     Cmnd_Alias VAGRANT_HOSTS_REMOVE = /usr/bin/sed -i -e /*/ d /etc/hosts
     %admin ALL=(root) NOPASSWD: VAGRANT_HOSTS_ADD, VAGRANT_HOSTS_REMOVE
     # end vagrant-hostsupdater
     
     # vagrant-nfs
     Cmnd_Alias VAGRANT_EXPORTS_ADD = /usr/bin/tee -a /etc/exports
     Cmnd_Alias VAGRANT_NFSD = /sbin/nfsd restart
     Cmnd_Alias VAGRANT_EXPORTS_REMOVE = /usr/bin/sed -E -e /*/ d -ibak /etc/exports
     %admin ALL=(root) NOPASSWD: VAGRANT_EXPORTS_ADD, VAGRANT_NFSD, VAGRANT_EXPORTS_REMOVE
     # end vagrant-nfs
    
  4. Type :wq to save the changes and exit the sudoers file

  5. Restart your terminal sessions to apply the changes (in some cases, rebooting the computer works best.)

  6. You should now be able to run vagrant up without the password requirement.

Note - The above code should work as expected from most MacOS environments. Other environments may require updates to the system paths (particularly the path to sed). Use "which" from the command line to determine your system path (e.g., which sed).

For more information, review the "Helpful modifications to /etc/sudoers" section of this post from Jeff Geerling's blog.

More on Drupal VM

More documentation on the Drupal VM project can be found at http://docs.drupalvm.com/en/latest

About

Customized version of Jeff Geerling's Drupal VM (https://github.com/geerlingguy/drupal-vm)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published