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

Commit a21dfaa

Browse files
committed
Update docs [ci skip]
1 parent df17e38 commit a21dfaa

File tree

8 files changed

+60
-170
lines changed

8 files changed

+60
-170
lines changed
Lines changed: 20 additions & 137 deletions
Original file line numberDiff line numberDiff line change
@@ -1,151 +1,34 @@
1-
To make future Drupal VM updates easier to integrate with an existing project, you might consider the more complex setup of installing Drupal VM as a `composer` dependency. Using a delegating `Vagrantfile` you are able to run `vagrant` commands anywhere in your project as well as separate your custom configuration files from Drupal VM's own files.
1+
If you're setting up a new project you can get up and running quickly using [drupal-composer/drupal-project](https://github.com/drupal-composer/drupal-project) as a project template.
22

3-
### Add Drupal VM as a Composer dependency
4-
5-
Add Drupal VM as a development dependency to your `composer.json`.
6-
7-
```
8-
composer require --dev geerlingguy/drupal-vm
9-
```
10-
11-
### Setup your configuration files
12-
13-
Add and configure the `config.yml` anywhere you like, in this example we place it in a `config/` directory.
14-
15-
_Note: This will be the directory where Drupal VM looks for other local configuration files as well. Such as `drupal_build_makefile` and `local.config.yml`._
16-
17-
```
18-
├── composer.json
19-
├── config/
20-
│ ├── config.yml
21-
│ ├── local.config.yml
22-
│ └── Vagrantfile.local
23-
├── docroot/
24-
│ ├── ...
25-
│ └── index.php
26-
└── vendor/
27-
├── ...
28-
└── geerlingguy/
29-
└── drupal-vm/
30-
```
31-
32-
Change the [build strategy to use your `composer.json`](composer.md#using-composer-when-drupal-vm-is-a-composer-dependency-itself) file by setting:
33-
34-
```yaml
35-
drupal_build_composer_project: false
36-
drupal_build_composer: true
37-
drupal_composer_path: false
38-
drupal_composer_install_dir: "/var/www/drupalvm"
39-
drupal_core_path: "{{ drupal_composer_install_dir }}/docroot"
40-
```
41-
42-
If you intened to use the devel module, it must be added as a requirement to your `composer.json` file. Alternatively, if you do not intend to use it remove it from `drupal_enabled_modules` in your `config.yml` file:
43-
44-
```yaml
45-
drupal_enabled_modules: []
46-
```
47-
48-
If you're using `pre_provision_scripts` or `post_provision_scripts` you also need to adjust their paths to take into account the new directory structure. The examples used in `default.config.yml` assume the files are located in the Drupal VM directory. You can use the `config_dir` variable which is the absolute path of the directory where your `config.yml` is located.
49-
50-
```yaml
51-
post_provision_scripts:
52-
# The default provided in `default.config.yml`:
53-
- "../../examples/scripts/configure-solr.sh"
54-
# With Drupal VM as a Composer dependency:
55-
- "{{ config_dir }}/../examples/scripts/configure-solr.sh"
56-
```
57-
58-
### Create a delegating `Vagrantfile`
59-
60-
Create a delegating `Vagrantfile` that will catch all your `vagrant` commands and send them to Drupal VM's own `Vagrantfile`. Place this file in your project's root directory.
61-
62-
```ruby
63-
# The absolute path to the root directory of the project. Both Drupal VM and
64-
# the config file need to be contained within this path.
65-
ENV['DRUPALVM_PROJECT_ROOT'] = "#{__dir__}"
66-
# The relative path from the project root to the config directory where you
67-
# placed your config.yml file.
68-
ENV['DRUPALVM_CONFIG_DIR'] = "config"
69-
# The relative path from the project root to the directory where Drupal VM is located.
70-
ENV['DRUPALVM_DIR'] = "vendor/geerlingguy/drupal-vm"
71-
72-
# Load the real Vagrantfile
73-
load "#{__dir__}/#{ENV['DRUPALVM_DIR']}/Vagrantfile"
74-
```
75-
76-
When you issue `vagrant` commands anywhere in your project tree this file will be detected and used as a delegator for Drupal VM's own Vagrantfile.
77-
78-
Your project structure should now look like this:
79-
80-
```
81-
├── Vagrantfile
82-
├── composer.json
83-
├── config/
84-
│ ├── config.yml
85-
│ ├── local.config.yml
86-
│ └── Vagrantfile.local
87-
├── docroot/
88-
│ ├── ...
89-
│ └── index.php
90-
└── vendor/
91-
├── ...
92-
└── geerlingguy/
93-
└── drupal-vm/
3+
```sh
4+
composer create-project drupal-composer/drupal-project:8.x-dev <some-dir> --stability dev --no-interaction
945
```
956

96-
### Provision the VM
97-
98-
Finally provision the VM using the delegating `Vagrantfile`.
7+
### Add Drupal VM as a Composer dependency
998

100-
```sh
101-
vagrant up
102-
```
9+
Require Drupal VM as a development dependency to your project.
10310

104-
_Important: you should never issue `vagrant` commands through Drupal VM's own `Vagrantfile` from now on. If you do, it will create a secondary VM in that directory._
11+
composer require --dev geerlingguy/drupal-vm
10512

106-
## Drupal VM in a subdirectory without composer
13+
_This command will scaffold a `Vagrantfile` in the root of your project. Feel free to add it to your `.gitignore` as the file is now managed by Drupal VM and will be reset each time you run `composer update`._
10714

108-
If you're not using `composer` in your project you can still download Drupal VM (or add it as a git submodule) to any subdirectory in your project. As an example let's name that directory `box/`.
15+
### Create a `config.yml` to configure the VM
10916

110-
```
111-
├── docroot/
112-
│ ├── ...
113-
│ └── index.php
114-
└── box/
115-
├── ...
116-
├── default.config.yml
117-
└── Vagrantfile
118-
```
17+
Create and configure a config.yml file, eg. in `vm/config.yml`. You'll need at least the following variables:
11918

120-
Configure your `config.yml` as mentioned in the [`composer` section](#setup-your-configuration-files) above.
19+
# Change the build strategy to use a composer.json file.
20+
drupal_build_composer: true
21+
drupal_build_composer_project: false
12122

122-
```yaml
123-
post_provision_scripts:
124-
# The default provided in `default.config.yml`:
125-
- "../../examples/scripts/configure-solr.sh"
126-
# With Drupal VM in a toplevel subdirectory
127-
- "{{ config_dir }}/../examples/scripts/configure-solr.sh"
128-
```
23+
# Tell Drupal VM that the composer.json file already exists and doesn't need to be transfered.
24+
drupal_composer_path: false
12925

130-
Your directory structure should now look like this:
26+
# Set the location of the composer.json file and Drupal core.
27+
drupal_composer_install_dir: "/var/www/drupalvm"
28+
drupal_core_path: "{{ drupal_composer_install_dir }}/web"
13129

132-
```
133-
├── Vagrantfile
134-
├── config/
135-
│ ├── config.yml
136-
│ ├── local.config.yml
137-
│ └── Vagrantfile.local
138-
├── docroot/
139-
│ ├── ...
140-
│ └── index.php
141-
└── box/
142-
├── ...
143-
├── default.config.yml
144-
└── Vagrantfile
145-
```
30+
_Note that `drupal_core_path` needs to match your `composer.json` configuration. `drupal-project` uses `web/` whereas Lightning and BLT uses `docroot/`_
14631

147-
Provision the VM using the delegating `Vagrantfile`.
32+
If you placed the `config.yml` file in a subdirectory, tell Drupal VM where by adding the location to your `composer.json`. If not, Drupal VM will look for all configuration files in the root of your project.
14833

149-
```sh
150-
vagrant up
151-
```
34+
composer config extra.drupalvm.config_dir 'vm'

docs/deployment/composer.md

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,6 @@ drupal_build_composer: true
1010
drupal_core_path: "{{ drupal_composer_install_dir }}/docroot"
1111
```
1212
13-
_The file set in `drupal_composer_path` (which defaults to `drupal.composer.json`) will be copied from your host computer into the VM's `drupal_composer_install_dir` and renamed `composer.json`._
14-
15-
## Using Composer when [Drupal VM is a composer dependency itself](composer-dependency.md)
16-
17-
In the scenario where you have an existing `composer.json` in the root of your project, follow the usual steps for installing with a composer.json but instead of creating a `drupal.composer.json` file, disable the transfering of the file by setting `drupal_composer_path: false`, and change `drupal_composer_install_dir` to point to the the directory where it will be located. If `drupal_composer_path` is not truthy, Drupal VM assumes it already exists.
18-
19-
```yaml
20-
drupal_build_composer_project: false
21-
drupal_build_composer: true
22-
drupal_composer_path: false
23-
drupal_composer_install_dir: "/var/www/drupalvm"
24-
drupal_core_path: "{{ drupal_composer_install_dir }}/docroot"
25-
```
13+
The file set in `drupal_composer_path` (which defaults to `drupal.composer.json`) will be copied from your host computer into the VM's `drupal_composer_install_dir` and renamed `composer.json`.
2614

2715
_Opting for composer based installs will most likely increase your VM's time to provision considerably. Find out how you can [improve composer build performance](../other/performance.md#improving-composer-build-performance)._

docs/deployment/overview.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
There are two supported methods of integrating Drupal VM with your site. You can either download Drupal VM and integrate your site inside the project, or you can add Drupal VM as a Composer dependency to your existing project.
2+
3+
## Download Drupal VM and integrate your project.
4+
5+
The easiest way to get started with Drupal VM is to download the [latest relase](https://www.drupalvm.com/), open the terminal, `cd` to the directory, and type `vagrant up`.
6+
7+
Using this method you have various options of how your site will be built, or if it will be built by Drupal VM at all:
8+
9+
- [Build using a local codebase](../deployment/local-codebase.md)
10+
- [Build using a Composer package](../deployment/composer-package.md) (default)
11+
- [Build using a composer.json](../deployment/composer.md)
12+
- [Build using a Drush Make file](../deployment/drush-make.md)
13+
- [Deploy Drupal via Git](../deployment/git.md)
14+
15+
## Add Drupal VM as a Composer depedency to an existing project
16+
17+
_If you're using Composer to manage your project, having Drupal VM as dependency makes it easier to pull in future updates._
18+
19+
Using this method you only have one option of how your site will be built, it will be built using your parent project's `composer.json` file.
20+
21+
- [Add Drupal VM to your project using Composer](../deployment/composer-dependency.md)

docs/getting-started/installation-linux.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
Please read through the [Quick Start Guiden the README](https://github.com/geerlingguy/drupal-vm#quick-start-guide) to get started.
22

3+
_Note that there are two methods of using Drupal VM; either you [download Drupal VM and configure the project for your site](../deployment/overview.md#download-drupal-vm-and-integrate-your-project), or you require it as a [Composer dependency in an existing project](../deployment/overview.md#add-drupal-vm-as-a-composer-depedency-to-an-existing-project)._
4+
35
For a quick introduction to setting up Drupal VM, the [macOS video tutorial](installation-macos.md) applies somwhat to Linux as well.
46

57
There are a few caveats when using Drupal VM on Linux, and this page will try to identify the main gotchas or optimization tips for those wishing to use Drupal VM on a Linux host.
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
Please read through the [Quick Start Guide](https://github.com/geerlingguy/drupal-vm#quick-start-guide) to get started.
22

3-
<iframe width="560" height="315" src="https://www.youtube.com/embed/PR9uh_GGZhI" frameborder="0" allowfullscreen></iframe>
3+
_Note that there are two methods of using Drupal VM; either you [download Drupal VM and configure the project for your site](../deployment/overview.md#download-drupal-vm-and-integrate-your-project), or you require it as a [Composer dependency in an existing project](../deployment/overview.md#add-drupal-vm-as-a-composer-depedency-to-an-existing-project)._
4+
5+
For a quick overview of how to get started and configuring Drupal VM to build a site, watch the the screencast below.
46

5-
_In this quick overview, Jeff Geerling will show you where you can learn more about Drupal VM, then show you a simple Drupal VM setup._
7+
<iframe width="560" height="315" src="https://www.youtube.com/embed/PR9uh_GGZhI" frameborder="0" allowfullscreen></iframe>

docs/getting-started/installation-windows.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
Please read through the [Quick Start Guide in the README](https://github.com/geerlingguy/drupal-vm#quick-start-guide) to get started.
22

3+
_Note that there are two methods of using Drupal VM; either you [download Drupal VM and configure the project for your site](../deployment/overview.md#download-drupal-vm-and-integrate-your-project), or you require it as a [Composer dependency in an existing project](../deployment/overview.md#add-drupal-vm-as-a-composer-depedency-to-an-existing-project)._
4+
35
<iframe width="560" height="315" src="https://www.youtube.com/embed/mNio_aXMLos" frameborder="0" allowfullscreen></iframe>
46

57
_In this video, Jeff Geerling walk you through getting a Drupal 8 website built on your Windows 10 laptop using Drupal VM 3._

docs/other/wordpress-other-applications.md

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,20 +46,10 @@ composer_global_packages:
4646
- { name: wp-cli/wp-cli, release: '^1.0.0' }
4747
```
4848
49-
Create the delegating `Vagrantfile` in the root of the project:
49+
Tell Drupal VM where this config file is located:
5050
5151
```rb
52-
# The absolute path to the root directory of the project. Both Drupal VM and
53-
# the config file need to be contained within this path.
54-
ENV['DRUPALVM_PROJECT_ROOT'] = "#{__dir__}"
55-
# The relative path from the project root to the config directory where you
56-
# placed your config.yml file.
57-
ENV['DRUPALVM_CONFIG_DIR'] = "config"
58-
# The relative path from the project root to the directory where Drupal VM is located.
59-
ENV['DRUPALVM_DIR'] = "vendor/geerlingguy/drupal-vm"
60-
61-
# Load the real Vagrantfile
62-
load "#{__dir__}/#{ENV['DRUPALVM_DIR']}/Vagrantfile"
52+
composer config extra.drupalvm.config_dir 'config'
6353
```
6454

6555
Edit your `.env` file to match the values you set in `config/config.yml`:

mkdocs.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,14 @@ pages:
2121
- 'Configuring Drupal VM': 'getting-started/configure-drupalvm.md'
2222
- 'Syncing Folders': 'getting-started/syncing-folders.md'
2323
- Building your codebase:
24-
- 'Using a local Drupal codebase': 'deployment/local-codebase.md'
25-
- 'Using a composer package': 'deployment/composer-package.md'
26-
- 'Using composer.json': 'deployment/composer.md'
27-
- 'Using a Drush Make file': 'deployment/drush-make.md'
28-
- 'Drupal VM as a Composer Dependency': 'deployment/composer-dependency.md'
29-
- 'Deploying Drupal via Git': 'deployment/git.md'
24+
- 'Overview': 'deployment/overview.md'
25+
- Add your project to Drupal VM:
26+
- 'Using a local Drupal codebase': 'deployment/local-codebase.md'
27+
- 'Using a composer package': 'deployment/composer-package.md'
28+
- 'Using composer.json': 'deployment/composer.md'
29+
- 'Using a Drush Make file': 'deployment/drush-make.md'
30+
- 'Deploying Drupal via Git': 'deployment/git.md'
31+
- 'Add Drupal VM to your project using Composer': 'deployment/composer-dependency.md'
3032
- Basic configurations:
3133
- 'Using different base OSes': 'configurations/base-os.md'
3234
- 'Using a different PHP version': 'configurations/php.md'

0 commit comments

Comments
 (0)