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

Commit a142bd8

Browse files
committed
Add docs
1 parent 8464e4b commit a142bd8

File tree

4 files changed

+55
-5
lines changed

4 files changed

+55
-5
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ If you want to switch from Drupal 8 (default) to Drupal 7 on the initial install
5252

5353
## Quick Start Guide
5454

55-
This Quick Start Guide will help you quickly build a Drupal 8 site on the Drupal VM using the included example Drush make file. You can also use the Drupal VM with a [Composer based installation](@TODO), with a [Local Drupal codebase](http://docs.drupalvm.com/en/latest/deployment/local-codebase/) or even a [Drupal multisite installation](http://docs.drupalvm.com/en/latest/deployment/multisite/).
55+
This Quick Start Guide will help you quickly build a Drupal 8 site on the Drupal VM using the included example Drush make file. You can also use the Drupal VM with a [Composer based installation](http://docs.drupalvm.com/en/latest/deployment/composer/), with a [Local Drupal codebase](http://docs.drupalvm.com/en/latest/deployment/local-codebase/) or even a [Drupal multisite installation](http://docs.drupalvm.com/en/latest/deployment/multisite/).
5656

5757
### 1 - Install Vagrant
5858

default.config.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ vagrant_public_ip: ""
2121
# http://docs.drupalvm.com/en/latest/extras/syncing-folders/ for more info.
2222
vagrant_synced_folders:
2323
# The first synced folder will be used for the default Drupal installation, if
24-
# build_makefile or build_composer is 'true'. By default it's set to the
25-
# drupal-vm folder.
24+
# any of the build_* settings are 'true'. By default the folder is set to
25+
# the drupal-vm folder.
2626
- local_path: .
2727
destination: /var/www/drupalvm
2828
type: nfs
@@ -47,8 +47,8 @@ drupal_composer_path: "{{ config_dir }}/drupal.composer.json"
4747
drupal_composer_install_dir: "/var/www/drupalvm/drupal"
4848
drupal_composer_dependencies: []
4949

50-
# Set this to 'true' and 'build_makefile' as well as 'build_composer' to
51-
# 'false' you are using Composer's create-project as a site deployment strategy.
50+
# Set this to 'true' and 'build_makefile', 'build_composer' to 'false' if you
51+
# are using Composer's create-project as a site deployment strategy.
5252
build_composer_project: false
5353
drupal_composer_project_package: ""
5454
drupal_composer_project_options: "--prefer-dist --stability dev --no-interaction"

docs/deployment/composer.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
Drupal VM is configured to use [Drush make](drush-make.md) by default but supports building Drupal from a custom composer.json or creating a project from a composer package (`composer create-project`).
2+
3+
## Using composer.json
4+
5+
Add a `drupal.composer.json` next to your `config.yml` and switch the build system by setting `build_makefile: false` and `build_composer: true` in your `config.yml`. By default Drupal VM expects the Drupal code to be installed within a `docroot/` directory, if you use a different webroot directory, you need to adjust `drupal_core_path`.
6+
7+
```yaml
8+
build_makefile: false
9+
build_composer: true
10+
```
11+
12+
_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`. If you already have a composer.json within that directory, you can set `drupal_composer_path: false`._
13+
14+
## Using Composer when [Drupal VM is a composer dependency itself](../other/drupalv-composer-dependency.md)
15+
16+
In the scenario where you already 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` to `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.
17+
18+
```yaml
19+
build_makefile: false
20+
build_composer: true
21+
drupal_composer_path: false
22+
drupal_composer_install_dir: "/var/www/drupalvm"
23+
```
24+
25+
## Creating a project from a composer package: `composer create-project`
26+
27+
There's a couple of things you need to configure in your `config.yml`:
28+
29+
- Switch the build system by setting `build_makefile: false`, `build_composer: false` and `build_composer_project: true`.
30+
- Configure the composer package in `drupal_composer_project_package`.
31+
- Additionally you can adjust the create-project CLI options in `drupal_composer_project_options` as well as add additional dependencies in `drupal_composer_dependencies`.
32+
- Ensure that the webroot configured in the composer package matches the one set in `drupal_core_path`. The default is `docroot/`.
33+
34+
With [drupal-composer/drupal-project](https://github.com/drupal-composer/drupal-project) as an example your `config.yml` overrides would be:
35+
36+
```yaml
37+
build_makefile: false
38+
build_composer: false
39+
build_composer_project: true
40+
41+
drupal_composer_project_package: "drupal-composer/drupal-project:8.x-dev"
42+
# Added `--no-dev` to avoid installing development dependencies.
43+
drupal_composer_project_options: "--prefer-dist --stability dev --no-interaction --no-dev"
44+
drupal_composer_dependencies:
45+
- "drupal/devel:8.*"
46+
47+
drupal_core_path: "{{ drupal_composer_install_dir }}/web"
48+
```
49+

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ pages:
1212
- Home: 'index.md'
1313
- Drupal Deployment Strategies:
1414
- 'Drush Make file': 'deployment/drush-make.md'
15+
- 'Composer': 'deployment/composer.md'
1516
- 'Local Drupal codebase': 'deployment/local-codebase.md'
1617
- 'Drupal multisite': 'deployment/multisite.md'
1718
- Extra Software and Setup:

0 commit comments

Comments
 (0)