A Drupal development box with Vagrant and Docker.
- We can create a fresh project with latest version of drupal installed with all necessary php libraries.
- We can use this as a development environment for our existing project.
- Clone the repo.
Remember the
$ git clone https://github.com/brainstation-au/vagrant-docker-drupal.git myprojectmyprojectin the line above is your project folder. you can name this folder as you like. - Get into the project folder.
$ cd myproject - Create a new folder for drupal installation.
This new folder name has to be
$ mkdir drupaldrupal. You have another folder at herevagrantcame from the repo. - Set your own installation parameter in
vars.shfile invagrant/bindirectory. (If you are happy to go with default values, you can skip this step.) You could use your preferred IDE to change the default parameters. - Start the vagrant box
I assume that you are now in your project folder and you have a folder called
$ cd vagrant $ vagrant upvagrantcame from the repo. - Boom, you are done.
- Wait, your site is not ready is not ready yet.
- If you keep an eye in the
drupaldirectory that you created, you will start getting new directories and files in there. Wait until your installation is finished, then you can seedrupal/web/sites/default/settings.php. - Once the vagrant box is successfully built, there are some background process is still running and it will take time to download around 200MB of files and install them. So wait untill you can access http://192.168.33.100/.
- You can find all your drupal code in the
drupaldirectory in your project root and any modification in the code will take effect to the site, that means it's auto synced.
- Get your project database file ready as
drupal.sql.gz. - If your project is a drupal 7 project, the path for the private files should
be
sites/default/private - Please note that we handle data directories in a way that every time you rebuild your box, you will get fresh data files that matches with you dbdump.
- Clone the repo.
Remember the
$ git clone https://github.com/brainstation-au/vagrant-docker-drupal.git myprojectmyprojectin the line above is your project folder. you can name this folder as you like. - Get into the project folder.
$ cd myproject - Create a new folder for drupal installation.
This new folder name has to be
$ mkdir drupaldrupal. You have another folder at herevagrantcame from the repo. - Create another folder named
webindrupal, get your drupal instance indrupal/web. - Go to
drupal/web/sites/defaultdirectory and make a zip file for data directories.$ tar -czvf files.tar.gz $(find * -maxdepth 0 -type d) - Move this files.tag.gz to
/vagrant/apps/drupal/directory. - Delete all the diretories in
/drupal/web/sites/default/. While you are in this directory run:$ rm -rf $(find * -maxdepth 0 -type d) - Create symlinks for data directories (
privateone is for D7):$ ln -s /drupal/sites-default/files files $ ln -s /drupal/sites-default/private private - Set your own installation parameter in
vars.shfile invagrant/bindirectory. (If you are happy to go with default values, you can skip this step.) Make sure the mysql connection parameters indrupal/web/sites/default/settings.phpmatches withvars.shparameters. You could use your preferred IDE to change the default parameters. - Now put your database dump file
drupal.sql.gzin thevagrant/apps/mysqldirectory. - Start the vagrant box
I assume that you are now in your project folder and you have a folder called
$ cd vagrant $ vagrant upvagrantcame from the repo. - I'll now take 4-5 minutes untill you can access http://192.168.33.100/.