dergachev / vagrant_drupal

Deploy a local Drupal development stack with Vagrant.
9 stars 2 forks source link

Improvements to documentation #2

Open pixelite opened 11 years ago

pixelite commented 11 years ago

Here are the steps I followed:

I had to create drupal-fresh.sql.gz, I did the following:

vagrant ssh cd /var/shared/sites/drupal-fresh/site
sudo drush site-install

Here are the changes I made to my vagrant file:

diff --git a/Vagrantfile b/Vagrantfile
index e568e36..ebfc620 100644
--- a/Vagrantfile
+++ b/Vagrantfile
@@ -5,7 +5,7 @@ Vagrant::Config.run do |config|
   # config.vm.box = "precise64-customized"
   config.vm.box = "precise64"
   config.vm.customize ["modifyvm", :id, "--memory", "2048"]
-  config.vm.forward_port 80, 8080
+  config.vm.forward_port 80, 8090

   # consider enabling nfs for a speedup
   config.vm.share_folder "v-root", "/vagrant", ".", :nfs => false
@@ -23,10 +23,10 @@ Vagrant::Config.run do |config|
     chef.json.merge!({
       :deploy_drupal => { 
         :apache_group => 'vagrant', # defaults to www-data
-        :sql_load_file => '/vagrant/db/fga.sql.gz', # load this SQL dump file
-        :sql_post_load_script => '/vagrant/db/fga-sql-post-load.sh', # run this bash script after loading db
-        :site_name => 'fga.vbox.local', # used for VHOST configuration, deployment directory, etc.
-        :codebase_source_path =>  "/vagrant/public/fga.vbox.local/www", # deploy drupal from a mounted folder
+        :sql_load_file => '/vagrant/fresh-drupal/drupal-fresh.sql.gz', # load this SQL dump file
+        :sql_post_load_script => '/vagrant/fresh-drupal/fresh-drupal-sql-post-load.sh', # run this bash script after loading db
+        :site_name => 'fresh-drupal.local', # used for VHOST configuration, deployment directory, etc.
+        :codebase_source_path =>  "/vagrant/fresh-drupal/site", # deploy drupal from a mounted folder
         # :apache_port => '80'
       },
       :mysql => {
pixelite commented 11 years ago

In my fresh-drupal-sql-post-load.sh, I just included this line to reset the admin password:

drush user-password admin --password='changeme'

Because I used drush site-install to create the fresh database, the user 1 username is admin.

pixelite commented 11 years ago

Notes on setting up Vagrant on Jan 18

# Add previously created base box to use; sourced from macbook air
vagrant box add precise64-customized-sk precise64-customized-sk.box

# Setup a vagrant repo:
git clone https://github.com/dergachev/vagrant_drupal.git ~/code/vagrant_drupal

# Install Librarian-Chef
sudo gem install librarian --no-rdoc --no-ri
cd ~/code/vagrant_drupal 
librarian-chef install

# download drupal 8 and store it in "site/"
mkdir ~/code/vagrant_drupal/drupal8 
cd ~/code/vagrant_drupal/drupal8
wget http://ftp.drupal.org/files/projects/drupal-8.x-dev.tar.gz 
tar xzvf drupal-8.x-dev.tar.gz
mv drupal-8.x-dev site

# created drupal8-sql-post-load.sh:
echo "drush user-password admin --password='changeme'" > drupal8/db/drupal8-sql-post-load.sh 

Edited Vagrantfile as follows:


diff --git a/Vagrantfile b/Vagrantfile
index 3ae7836..9a6860b 100644
--- a/Vagrantfile
+++ b/Vagrantfile
@@ -3,9 +3,9 @@

 Vagrant::Config.run do |config|
   # config.vm.box = "precise64-customized"
-  config.vm.box = "precise64"
+  config.vm.box = "precise64-customized-sk"
   config.vm.customize ["modifyvm", :id, "--memory", "512"]
-  config.vm.forward_port 80, 8080
+  config.vm.forward_port 80, 8090

   # consider enabling nfs for a speedup
   config.vm.share_folder "v-root", "/vagrant", ".", :nfs => false
@@ -13,6 +13,9 @@ Vagrant::Config.run do |config|
   # mkdir ./tmp/vagrant_aptcache before uncommenting; see https://gist.github.com/3798773
   # config.vm.share_folder("v-apt", "/var/cache/apt/archives", "./tmp/vagrant_aptcache")

+  # quickly add some convenience packages
+  config.vm.provision :shell, :inline => "apt-get -y install vim git curl"
+
   config.vm.provision :chef_solo do |chef|
     chef.cookbooks_path = ["site-cookbooks", "cookbooks"]

@@ -21,20 +24,28 @@ Vagrant::Config.run do |config|
     chef.add_recipe 'deploy_drupal'

     chef.json.merge!({
-      :deploy_drupal => { 
+      :deploy_drupal => {
         :apache_group => 'vagrant', # defaults to www-data
-        :sql_load_file => '/vagrant/db/fga.sql.gz', # load this SQL dump file
-        :sql_post_load_script => '/vagrant/db/fga-sql-post-load.sh', # run this bash script after loading db
-        :site_name => 'fga.vbox.local', # used for VHOST configuration, deployment directory, etc.
-        :codebase_source_path =>  "/vagrant/public/fga.vbox.local/www", # deploy drupal from a mounted folder
+        :sql_load_file => '/vagrant/db/drupal8.sql.gz', # load this SQL dump file
+        :sql_post_load_script => '/vagrant/db/drupal8-sql-post-load.sh', # run this bash script after loading db
+        :site_name => 'drupal8.local', # used for VHOST configuration, deployment directory, etc.
+        :codebase_source_path =>  '/vagrant/drupal8/site', # deploy drupal from a mounted folder
         # :apache_port => '80'
       },
+      # gets Drush 6; necessary for drupal 8
+      # :drush => { :install_method =>  'pear', :version => 'devel' } fails!
+      # see https://github.com/msonnabaum/chef-drush/issues/16
+      :drush => {
+        :install_method => 'git',
+        :version => '8.x-6.x'
+      },
       :mysql => {
-        :server_root_password => "root", # hardcoded MySQL root password.
+        :server_root_password => 'root', # hardcoded MySQL root password.
+        :server_repl_password => 'root', # hardcoded MySQL repl password.
+        :server_debian_password => 'root', # hardcoded MySQL debian password.
       },
     })

     # chef.log_level = :debug
   end
-  
 end

At this point "drush provision" succeeds, but the db isnt yet deployed.