@@ -4,81 +4,61 @@ This is a simple command-line tool for downloading and configuring
4
4
WordPress on App Engine Standard for PHP 7.2.
5
5
## Common Prerequisites
6
6
7
- * Install [ Composer] [ composer ]
8
7
* Create a new Cloud Project using the [ Cloud Console] [ cloud-console ]
9
8
* Enable Billing on that project
10
- * [ Enable Cloud SQL API] [ cloud-sql-api-enable ]
11
9
* 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 ]
35
12
36
- ### Create and configure a Cloud SQL for MySQL 2nd generation instance
13
+ ### Create and configure a Cloud SQL for MySQL instance
37
14
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
39
16
name. We use ` root ` for the database user name.
40
17
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
42
19
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.
82
62
83
63
# ## Create a new WordPress Project
84
64
@@ -92,6 +72,8 @@ The command asks you several questions, please answer them. Then you'll have a
92
72
new WordPress project. By default it will create `my-wordpress-project` in the
93
73
current directory.
94
74
75
+ > **Note**: To determine the region your database is in, run `gcloud sql instances describe wordpress`
76
+
95
77
### Update an existing WordPress Project
96
78
97
79
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
111
93
deploy:
112
94
113
95
```sh
114
- $ gcloud app deploy \
115
- --promote --stop-previous-version app.yaml cron.yaml
96
+ $ gcloud app deploy app.yaml cron.yaml
116
97
```
117
98
118
99
Then access your site, and continue the installation step. The URL is:
119
100
https://PROJECT_ID.appspot.com/
120
101
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.
124
117
125
118
After activating the plugin, try uploading a media object in a new post
126
119
and confirm the image is uploaded to the GCS bucket by visiting the
@@ -207,3 +200,4 @@ the production environment.
207
200
[gcloud-sdk]: https://cloud.google.com/sdk/
208
201
[cloud-sql-proxy-download]: https://cloud.google.com/sql/docs/mysql/connect-external-app#install
209
202
[credentials-section]: https://console.cloud.google.com/apis/credentials/
203
+ [gcs-plugin]: https://wordpress.org/plugins/gcs/
0 commit comments