Foundation of starting your drupal project to vagrant environment
-
Upload
eleison-cruz -
Category
Technology
-
view
68 -
download
2
Transcript of Foundation of starting your drupal project to vagrant environment
Setting VDD Vagrant for Drupal Development
Prepared by:
Eleison B. CruzFront-end Web Developer
Wembassy Ltd.
Who I am ??
Front end developer at Wembassy Ltd.
Former junior officer in BDO, career shifter
Develop websites using Drupal 7, and Wordpress.
What is Vagrant?
Vagrant is an open source software that wraps around VirtualBox virtualization platform that
manages server instances for the user.
Vagrant creates automation for every workstations that eliminates inconsistencies in
the software due to different environment.
Vagrant will b.e running under Ubuntu 12
What is Vagrant?
Vagrant may replace XAMPP/MAMPP/WAMPP
Windows users will be more familiar in Ubuntu Environment
Vagrant may also use other CMS technologies such Wordpress, and Magento.
Setting up your first Vagrant environment.
Softwares needed: Virtual Box Vagrant Drupal Environment (VDD) Vagrant For Windows users (PuTTy will be needed for Vagrant box)
Setting up your first Vagrant environment
Setting up your first Vagrant environment
Download VDD from https://www.drupal.org/node/2008792
After installing VirtualBox and Vagrant, paste the uncompressed VDD to any directory you want.
Open the Terminal (for Windows install Git, then it will provide Git Bash console)
Go to your chosen VDD directory then type:
$ vagrant up
Setting up your first Vagrant environment
In your local machine, set up the usual vhost configuration but with another IP address for localhost:
# Sites declared in VDD's config.json192.168.44.44 mydrupal7.dev # your project name 192.168.44.44 www.mydrupal7.dev # IP address alias
Setting up your first Vagrant environment
Paste your project files (either CMS project files such drupal7, wordpress, magento, etc) to /vdd/data/
Access the config.json file under /vdd :
"mydrupal7": { "account_name": "root", "account_pass": "root", "account_mail": "[email protected]", "site_name": "Drupal 7", "site_mail": "[email protected]", "vhost": { "document_root": "drupal7", "url": "mydrupal7.dev", "alias": ["www.mydrupal7.dev"] } }
Setting up your first Vagrant environment
Now use your Terminal, go to /vdd directory, then type this vagrant command:
$ vagrant reload (it will take sometime … so get some coffee or some stretching)
$ vagrant ssh (it will access to the server thru ssh (secure server shell) )
Setting up your first Vagrant environment
Note: Vagrant VDD already installed PhP, Apache Server, MySQL, and GiT. The default username and password of MySQL is root → root.
Set up now your MySQL database in accordance of your project.
Setting up your first Vagrant environment
Access your /etc/hosts Then type this at the bottom:
192.168.44.44 mydrupal7.dev 192.168.44.44 www.drupal7.dev
Note: You should be familiar in the default IDE in server side such Nano and Vim
Setting up your first Vagrant environment
Now access your localhost.conf thru: $ sudo nano
/etc/apache2/sites-available/localhost.conf Then add this vhost configuration to suit your vagrant environment:
<VirtualHost *:80> DocumentRoot /var/www/mydrupal7 ServerName mydrupal7.dev ServerAlias www.mydrupal7.dev ServerAdmin [email protected] RewriteEngine On ErrorLog /var/log/apache2/mydrupal7.error.log LogLevel warn CustomLog /var/log/apache2/mydrupal7.access.log combined ServerSignature On </VirtualHost>
Setting up your first Vagrant environment
Restart your server : $ sudo service apache2 restart
Exit to your SSH by typing “exit” Reload your vagrant to take effect changes and install necessary updates if needed. $ vagrant reload
Access your SSH once again.
Setting up your first Vagrant environment
Your project should be able to display in your favorite browsers: http://www.mydrupal7.dev or mydrupal.dev
Setting up your first Vagrant environment
Your project should be able to display in your favorite browsers: http://www.mydrupal7.dev or mydrupal.dev
To fasten Drupal website under Vagrant Environment
For Linux/Ubuntu, type this on your local machine:
sudo apt-get install nfs-kernel-server Change your config.json, find this setup: "synced_folders": [ { "host_path": "data/", "guest_path": "/var/www", "type": "default" } ],
To fasten Drupal website under Vagrant Environment
Then change it into: "type": "nfs"
Then reload the vagrant: $ vagrant reload
For more info please refer for this link: https://www.drupal.org/node/2008792
Additional Resources
https://www.andrewmunsell.com/blog/development-environments-with-vagrant-and-puppet
https://www.andrewmunsell.com/blog/development-environments-with-vagrant-and-puppet
StackOverflow https://www.drupal.org/node/200879
Additional Notes
Notes: There 5 necessary tasks you have to do in setting projects under VDD Vagrant : In your local machine:
Paste your project under /vdd/data/ Set your config.json file Configure your vhost IP address and alias in /etc/hosts
In your SSH environment Set your IP and alias in /etc/hosts Configure your Vhost in
/etc/apache2/sites-available/localhost.conf
Thank You!!!