|
| 1 | +Drupal 8 on Managed VMs |
| 2 | +======================= |
| 3 | + |
| 4 | +## Overview |
| 5 | + |
| 6 | +This guide will help you deploy Drupal 8 on [App Engine Managed VMs][1] |
| 7 | + |
| 8 | +## Prerequisites |
| 9 | + |
| 10 | +Before setting up Drupal 8 on Managed VMs, you will need to complete the following: |
| 11 | + |
| 12 | + 1. Create a [Google Cloud Platform project][2]. Note your **Project ID**, as you will need it |
| 13 | + later. |
| 14 | + 1. Create a [Google Cloud SQL instance][3]. You will use this as your Drupal MySQL backend. |
| 15 | + |
| 16 | +## Install Drupal 8 |
| 17 | + |
| 18 | +### Download |
| 19 | + |
| 20 | +Use the [Drupal 8 Console][4] to install a drupal project with the following command: |
| 21 | + |
| 22 | +```sh |
| 23 | +drupal site:new PROJECT_NAME 8.0.0 |
| 24 | +``` |
| 25 | + |
| 26 | +Alternatively, you can download a compressed file from the [Drupal Website][5]. |
| 27 | + |
| 28 | +### Installation |
| 29 | + |
| 30 | + 1. Set up your Drupal 8 instance using the web interface |
| 31 | + ```sh |
| 32 | + cd /path/to/drupal |
| 33 | + php -S localhost:8080 |
| 34 | + ``` |
| 35 | + Open [http://localhost:8080](http://localhost:8080) in your browser after running these steps |
| 36 | + |
| 37 | + 1. **BETA** You can also try setting up your Drupal 8 instance using the [Drupal 8 Console][4] |
| 38 | + ```sh |
| 39 | + cd /path/to/drupal |
| 40 | + drupal site:install \ |
| 41 | + --langcode en \ |
| 42 | + --db-type mysql \ |
| 43 | + --db-name DATABASE_NAME |
| 44 | + --db-user DATABASE_USERNAME |
| 45 | + --db-pass DATABASE_PASSWORD |
| 46 | + --site-name 'My Drupal Site On Google' \ |
| 47 | + |
| 48 | + --account-name admin \ |
| 49 | + --account-mail [email protected] \ |
| 50 | + --account-pass admin |
| 51 | + ``` |
| 52 | + |
| 53 | +You will want to use the Cloud SQL credentials you created in the **Prerequisites** section as your |
| 54 | +Drupal backend. |
| 55 | + |
| 56 | +## Copy over App Engine files |
| 57 | + |
| 58 | +For your app to deploy on App Engine Managed VMs, you will need to copy over the files in this |
| 59 | +directory: |
| 60 | + |
| 61 | +```sh |
| 62 | +# clone this repo somewhere |
| 63 | +git clone https://github.com/GoogleCloudPlatform/php-docs-samples /path/to/php-docs-samples |
| 64 | +cd /path/to/php-docs-samples/ |
| 65 | + |
| 66 | +# copy the four files below to the root directory of your Drupal project |
| 67 | +cp managed_vms/drupal8/{app.yaml,php.ini,Dockerfile,nginx-app.conf} /path/to/drupal |
| 68 | +``` |
| 69 | + |
| 70 | +The four files needed are as follows: |
| 71 | + |
| 72 | + 1. [`app.yaml`](app.yaml) - The App Engine configuration for your project |
| 73 | + 1. [`Dockerfile`](Dockerfile) - Container configuration for the PHP runtime |
| 74 | + 1. [`php.ini`](php.ini) - Optional ini used to extend the runtime configuration. |
| 75 | + 1. [`nginx-app.conf`](nginx-app.conf) - Nginx web server configuration needed for `Drupal 8` |
| 76 | + |
| 77 | +## Disable CSS and JS Cache |
| 78 | + |
| 79 | +For now, you need to disable the CSS and JS preprocessed caching that Drupal 8 enables by default. |
| 80 | +To do this, go to `/admin/config/development/performance` and deselect the two |
| 81 | +chechboxes (`Aggregate CSS files` and `Aggregate JS files`) under **Bandwidth Optimizations**. |
| 82 | + |
| 83 | +Alternatively, you can use the [Drupal 8 Console][4] to change this config setting: |
| 84 | + |
| 85 | +```sh |
| 86 | +# this command must be run inside the root directory of a drupal project |
| 87 | +$ cd /path/to/drupal |
| 88 | +# this will expand your text editor |
| 89 | +$ drupal config:edit system.performance |
| 90 | +``` |
| 91 | + |
| 92 | +Change the values `preprocess` under `css` and `js` to `false`. |
| 93 | + |
| 94 | +[1]: https://cloud.google.com/appengine/docs/managed-vms/ |
| 95 | +[2]: https://console.cloud.google.com |
| 96 | +[3]: https://cloud.google.com/sql/docs/getting-started |
| 97 | +[4]: https://www.drupal.org/project/console |
| 98 | +[5]: https://www.drupal.org/8/download |
0 commit comments