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

Commit

Permalink
Issue #704: Update documentation for Composer-based install default.
Browse files Browse the repository at this point in the history
  • Loading branch information
geerlingguy committed Jun 6, 2016
1 parent 68abe76 commit cc708d4
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 23 deletions.
27 changes: 10 additions & 17 deletions docs/deployment/composer.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
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`).
Drupal VM is configured to use `composer create-project` to build a Drupal 8 codebase by default but supports building Drupal from a custom composer.json or [Drush make file](drush-make.md).

## Using composer.json

1. Copy `example.drupal.composer.json` to `drupal.composer.json` and modify it to your liking.
2. Switch the build system by setting `build_makefile: false` and `build_composer: true` in your `config.yml`.
2. Use the Composer build system by setting `build_composer: true` in your `config.yml` (make sure `build_makefile` is set to `false`).

This comment has been minimized.

Copy link
@oxyc

oxyc Jun 6, 2016

Collaborator

build_composer_project needs to be set to false.

3. Configure `drupal_core_path` to point to the webroot directory: `drupal_core_path: {{ drupal_composer_install_dir }}/docroot`

```yaml
Expand All @@ -28,14 +28,14 @@ drupal_core_path: "{{ drupal_composer_install_dir }}/docroot"

## Creating a project from a composer package: `composer create-project`

There's a couple of things you need to configure in your `config.yml`:
This is the default Drupal VM build configuration, set up by the following settings in `config.yml`:

- Switch the build system by setting `build_makefile: false`, `build_composer: false` and `build_composer_project: true`.
- Configure the composer package in `drupal_composer_project_package`.
- Additionally you can adjust the create-project CLI options in `drupal_composer_project_options` as well as add additional dependencies in `drupal_composer_dependencies`.
- Ensure that the webroot configured in the composer package matches the one set in `drupal_core_path`.
- Composer will build the project if `build_composer_project` is `true`, and `build_makefile` and `build_composer` are both `false`.
- The Composer package is defined by `drupal_composer_project_package`.
- Adjust the create-project CLI options in `drupal_composer_project_options` as well as add additional dependencies in `drupal_composer_dependencies`.
- Ensure that the webroot configured in the Composer package matches the one set in `drupal_core_path`.

With [drupal-composer/drupal-project](https://github.com/drupal-composer/drupal-project) as an example your `config.yml` overrides would be:
With [drupal-composer/drupal-project](https://github.com/drupal-composer/drupal-project) as an example your `config.yml` settings would be:

```yaml
build_makefile: false
Expand All @@ -57,15 +57,8 @@ Opting for composer based installs will most likely increase your VM's time to p
If you manage multiple VM's own your computer, you can use the [`vagrant-cachier` plugin](http://fgrehm.viewdocs.io/vagrant-cachier/) to share Composer's package cache across all VM's. The first build will be as slow as before but subsequent builds with the same `vagrant_box` (eg `geerlingguy/ubuntu1604`) will be much faster.

1. Install the plugin on your host computer: `vagrant plugin install vagrant-cachier`
2. Create a `Vagrantfile.local` next to your `config.yml` with the following:
Install the plugin on your host computer: `vagrant plugin install vagrant-cachier`.

```rb
config.cache.scope = :box
config.cache.auto_detect = false
config.cache.enable :generic, { :cache_dir => "/home/vagrant/.composer/cache" }
```

_Note: Out of the box, sharing the Composer cache is not supported as the plugin requires PHP to be installed when the VM first boots up. This is why the generic cache bucket is used instead._
Drupal VM's `Vagrantfile` includes the appropriate `vagrant-cachier` configuration to cache Composer and apt dependencies.

_You can also use this plugin to share other package manager caches. For more information read the [documentation](http://fgrehm.viewdocs.io/vagrant-cachier/usage/)._
4 changes: 2 additions & 2 deletions docs/deployment/drush-make.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Drupal VM is configured by default to use a Drush make file to build a Drupal site on the VM inside `/var/www/drupalvm/drupal` (in a folder that's synced to your local machine, so you can work with the Drupal codebase either locally or inside the VM).
Drupal VM is configured to use Composer by default to build a Drupal site on the VM inside `/var/www/drupalvm/drupal` (in a folder that's synced to your local machine, so you can work with the Drupal codebase either locally or inside the VM).

You can use any make file you want, just copy it or symlink it into the root of the Drupal VM folder with the filename `drupal.make.yml`. You can also set a separate path to the makefile using the `drush_makefile_path` variable.
If you want to build a Drupal site using a [Drush make file](http://www.drush.org/en/master/make/) instead, you can either use the `example.drupal.make.yml` file as a base, or use your own Drush make file: just place it or symlink it into the root of the Drupal VM folder with the filename `drupal.make.yml`. You can also set a separate path to the makefile using the `drush_makefile_path` variable.

Have a look at the defaults in `default.config.yml` and tweak the settings as you'd like in your `config.yml`, then run `vagrant up` as in the Quick Start Guide. Within a few minutes, you should have your site running and available at the `drupal_domain` configured in `config.yml`, falling back to the default `http://drupalvm.dev` set in `default.config.yml`.
8 changes: 5 additions & 3 deletions docs/deployment/local-codebase.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@ vagrant_synced_folders:
type: nfs
```
## Disable the Drush make build and site install
## Disable the Composer project build and site install
Set `build_makefile` and `install_site` to `false`:
Set all the `build_` variables and `install_site` to `false`:

```yaml
build_makefile:: false
build_makefile: false
build_composer: false
build_composer_project: true
...
install_site: false
```
Expand Down
2 changes: 1 addition & 1 deletion docs/deployment/multisite.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
For multisite installations, make the changes outlined in the [Local Drupal codebase](local-codebase.md) guide, but, using the `apache_vhosts` variable, configure as many domains pointing to the same docroot as you need:
For multisite installations, make the changes outlined in the [Local Drupal codebase](local-codebase.md) guide, but, using the `apache_vhosts` variable (or `nginx_hosts` if using Nginx), configure as many domains pointing to the same docroot as you need:

```yaml
drupal_core_path: "/var/www/my-drupal-site"
Expand Down

0 comments on commit cc708d4

Please sign in to comment.