Skip to content

Commit 405ae20

Browse files
authored
Updates WordPress README.md (GoogleCloudPlatform#689)
1 parent 2dc0286 commit 405ae20

File tree

5 files changed

+152
-135
lines changed

5 files changed

+152
-135
lines changed

appengine/php72/wordpress/README.md

Lines changed: 66 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -4,81 +4,61 @@ This is a simple command-line tool for downloading and configuring
44
WordPress on App Engine Standard for PHP 7.2.
55
## Common Prerequisites
66

7-
* Install [Composer][composer]
87
* Create a new Cloud Project using the [Cloud Console][cloud-console]
98
* Enable Billing on that project
10-
* [Enable Cloud SQL API][cloud-sql-api-enable]
119
* Install [Google Cloud SDK][gcloud-sdk]
12-
* Install the [mysql-client][mysql-client] command line tool
13-
14-
## Project preparation
15-
16-
Configure Google Cloud SDK with your account and the appropriate project ID:
17-
18-
```
19-
$ gcloud init
20-
```
21-
22-
Create an App Engine application within your new project:
23-
24-
```
25-
$ gcloud app create
26-
```
27-
28-
Then configure the App Engine default GCS bucket for later use. The default App
29-
Engine bucket is named YOUR_PROJECT_ID.appspot.com. Change the default Access
30-
Control List (ACL) of that bucket as follows:
31-
32-
```
33-
$ gsutil defacl ch -u AllUsers:R gs://YOUR_PROJECT_ID.appspot.com
34-
```
10+
* [Enable Cloud SQL API][cloud-sql-api-enable]
11+
* Install [Composer][composer]
3512

36-
### Create and configure a Cloud SQL for MySQL 2nd generation instance
13+
### Create and configure a Cloud SQL for MySQL instance
3714

38-
Note: In this guide, we use `wordpress` for the instance name and the database
15+
> **Note**: In this guide, we use `wordpress` for the instance name and the database
3916
name. We use `root` for the database user name.
4017

41-
Create a new Cloud SQL for MySQL Second Generation instance with the following
18+
1. Create a new Cloud SQL for MySQL Second Generation instance with the following
4219
command:
43-
44-
```sh
45-
$ gcloud sql instances create wordpress \
46-
--activation-policy=ALWAYS \
47-
--tier=db-n1-standard-1
48-
```
49-
50-
Note: you can choose `db-f1-micro` or `db-g1-small` instead of
51-
`db-n1-standard-1` for the Cloud SQL machine type, especially for the
52-
development or testing purpose. However, those machine types are not
53-
recommended for production use and are not eligible for Cloud SQL SLA
54-
coverage. See our [Cloud SQL SLA](https://cloud.google.com/sql/sla)
55-
for more details.
56-
57-
Then change the root password for your instance:
58-
59-
```sh
60-
$ gcloud sql users set-password root \
61-
--host=% \
62-
--instance wordpress \
63-
--password=YOUR_INSTANCE_ROOT_PASSWORD # Don't use this password!
64-
```
65-
66-
You will also need to create the database you want your WordPress site to use:
67-
68-
```sh
69-
$ gcloud sql databases create wordpress --instance wordpress
70-
```
71-
72-
## SetUp
73-
74-
First install the dependencies in this directory as follows:
75-
76-
```sh
77-
$ composer install
78-
```
79-
80-
If it complains about extensions, please install `phar` and `zip` PHP
81-
extensions and retry.
20+
```sh
21+
$ gcloud sql instances create wordpress \
22+
--activation-policy=ALWAYS \
23+
--tier=db-n1-standard-1
24+
```
25+
> **Note**: you can choose `db-f1-micro` or `db-g1-small` instead of
26+
`db-n1-standard-1` for the Cloud SQL machine type, especially for the
27+
development or testing purpose. However, those machine types are not
28+
recommended for production use and are not eligible for Cloud SQL SLA
29+
coverage. See our [Cloud SQL SLA](https://cloud.google.com/sql/sla)
30+
for more details.
31+
32+
1. Next, create the database you want your WordPress site to use:
33+
```sh
34+
$ gcloud sql databases create wordpress --instance wordpress
35+
```
36+
1. Finally, change the root password for your instance:
37+
```sh
38+
$ gcloud sql users set-password root \
39+
--host=% \
40+
--instance wordpress \
41+
--password=YOUR_INSTANCE_ROOT_PASSWORD # Don't use this password!
42+
```
43+
44+
## Create or Update a WordPress project for App Engine
45+
46+
The `wordpress.php` command provides a convenient way for you to to either create
47+
a new WordPress project or add the required configuration to an existing one.
48+
49+
### Setup
50+
51+
1. Download this repository and `cd` into the `appengine/php72/wordpress` directory
52+
```sh
53+
$ git clone https://github.com/GoogleCloudPlatform/php-docs-samples.git
54+
$ cd php-docs-samples/appengine/php72/wordpress
55+
```
56+
1. Install the dependencies in this directory using composer
57+
```sh
58+
$ composer install
59+
```
60+
> **Note** If you receive an error about extensions, install `phar` and `zip` PHP
61+
extensions and retry.
8262

8363
### Create a new WordPress Project
8464

@@ -92,6 +72,8 @@ The command asks you several questions, please answer them. Then you'll have a
9272
new WordPress project. By default it will create `my-wordpress-project` in the
9373
current directory.
9474
75+
> **Note**: To determine the region your database is in, run `gcloud sql instances describe wordpress`
76+
9577
### Update an existing WordPress Project
9678
9779
If you are migrating an existing project to Google Cloud, you can use the
@@ -111,16 +93,27 @@ CD into your WordPress project directory and run the following command to
11193
deploy:
11294
11395
```sh
114-
$ gcloud app deploy \
115-
--promote --stop-previous-version app.yaml cron.yaml
96+
$ gcloud app deploy app.yaml cron.yaml
11697
```
11798
11899
Then access your site, and continue the installation step. The URL is:
119100
https://PROJECT_ID.appspot.com/
120101
121-
Go to the Dashboard at https://PROJECT_ID.appspot.com/wp-admin. On the Plugins
122-
page, activate the `Google App Engine for WordPress` plugin. Also set your
123-
e-mail address in its settings page.
102+
### Enable the Google Cloud Storage plugin
103+
104+
To use the [Google Cloud Storage plugin][gcs-plugin] for media uploads, follow
105+
these steps.
106+
107+
1. Configure the App Engine default GCS bucket for later use. The default App
108+
Engine bucket is named YOUR_PROJECT_ID.appspot.com. Change the default Access
109+
Control List (ACL) of that bucket as follows:
110+
```
111+
$ gsutil defacl ch -u AllUsers:R gs://YOUR_PROJECT_ID.appspot.com
112+
```
113+
1. Go to the Dashboard at https://PROJECT_ID.appspot.com/wp-admin. On the
114+
Plugins page, activate the `Google Cloud Storage plugin`.
115+
1. In the plugins Settings page, set your Bucket name to the bucket you
116+
configured in Step 1.
124117
125118
After activating the plugin, try uploading a media object in a new post
126119
and confirm the image is uploaded to the GCS bucket by visiting the
@@ -207,3 +200,4 @@ the production environment.
207200
[gcloud-sdk]: https://cloud.google.com/sdk/
208201
[cloud-sql-proxy-download]: https://cloud.google.com/sql/docs/mysql/connect-external-app#install
209202
[credentials-section]: https://console.cloud.google.com/apis/credentials/
203+
[gcs-plugin]: https://wordpress.org/plugins/gcs/

appengine/php72/wordpress/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"ext-zip": "*",
55
"paragonie/random_compat": "^1.3",
66
"symfony/console": "^3.0",
7-
"google/cloud-tools": "^0.8.1"
7+
"google/cloud-tools": "^0.8.3"
88
},
99
"require-dev": {
1010
"phpunit/phpunit": "^5"

0 commit comments

Comments
 (0)