22
33This is a small command line tool for downloading and configuring
44WordPress for Google Cloud Platform. The script allows you to create a
5- working WordPress project for
6- [ App Engine standard environment] [ appengine-standard ] or
5+ working WordPress project for the
6+ [ App Engine standard environment] [ appengine-standard ] or the
77[ App Engine flexible environment] [ appengine-flexible ] .
88
99## Common Prerequisites
1010
1111* Install [ Composer] [ composer ]
12- * Create a new Cloud Project on [ Developers Console] [ dev -console]
12+ * Create a new Cloud Project using the [ Cloud Console] [ cloud -console]
1313* Enable Billing on that project
1414* [ Enable Cloud SQL API] [ cloud-sql-api-enable ]
1515* Install [ Google Cloud SDK] [ gcloud-sdk ]
16-
17- ## Prerequisites for standard environment only
18- * Install mysql
16+ * [ Install mysql-client] [ mysql-client ]
17+ * [ Install Memcache] [ memcache-installation ]
1918
2019## Project preparation
2120
@@ -31,22 +30,21 @@ Create an App Engine application within your new project:
3130$ gcloud app create
3231```
3332
34- Then configure the App Engine default GCS bucket for later use. The
35- default App Engine bucket looks like
36- YOUR_PROJECT_ID.appspot.com. Change the default acl of that bucket as
37- follows:
33+ Then configure the App Engine default GCS bucket for later use. The default App
34+ Engine bucket looks like YOUR_PROJECT_ID.appspot.com. Change the default Access
35+ Control List (ACL) of that bucket as follows:
3836
3937```
4038$ gsutil defacl ch -u AllUsers:R gs://YOUR_PROJECT_ID.appspot.com
4139```
4240
43- ### Create and configure a Cloud SQL 2nd generation instance
41+ ### Create and configure a Cloud SQL for MySQL 2nd generation instance
4442
4543Note: In this guide, we use ` wp ` for various resource names; the instance
4644name, the database name, and the user name.
47-
48- You can create a new Cloud SQL Second Generation instance with the
49- following command:
45+
46+ Create a new Cloud SQL for MySQL Second Generation instance with the following
47+ command:
5048
5149```
5250$ gcloud sql instances create wp \
@@ -61,11 +59,11 @@ $ gcloud sql users set-password root % \
6159 --instance wp --password=YOUR_INSTANCE_ROOT_PASSWORD # Don't use this password!
6260```
6361
64- To access this MySQL instance, we’ll use Cloud SQL Proxy. Follow
65- [ these instructions ] [ cloud-sql-proxy-download ] to install the Cloud SQL Proxy
66- client on your local machine and make it executable.
62+ To access this MySQL instance, use Cloud SQL Proxy.
63+ Download an appropriate binary from
64+ [ the download page ] [ cloud-sql-proxy-download ] and make it executable.
6765
68- If you haven’t created a service account for the project, please
66+ If you haven’t created a service account for the project,
6967create it on [ the Credentials section] [ credentials-section ] in the
7068Console. Click 'Create credentials' and then click 'Service account key.' For
7169the Service account, select 'App Engine app default service account.' Then
@@ -78,23 +76,20 @@ Run the proxy by the following command:
7876$ cloud_sql_proxy \
7977 -dir /tmp/cloudsql \
8078 -instances=YOUR_PROJECT_ID:us-central1:wp=tcp:3306 \
81- -credential_file=PATH_TO_YOUR_SERVICE_ACCOUNT_JSON
79+ -credential_file=PATH_TO_YOUR_SERVICE_ACCOUNT_JSON_FILE
8280```
8381
84- Now you can access to the Cloud SQL instance with the normal MySQL
85- client. Please create a new database and a user as follows:
82+ Now you can access the Cloud SQL instance with the MySQL client. Create a new
83+ database and a user as follows:
8684
8785```
8886$ mysql -h 127.0.0.1 -u root -p
8987mysql> create database wp;
9088mysql> create user 'wp'@'%' identified by 'PASSWORD'; // Don't use this password!
9189mysql> grant all on wp.* to 'wp'@'%';
9290mysql> exit
93- Bye
9491```
9592
96- In the above example, I created a new database wp and a new user wp.
97-
9893## How to use
9994
10095First install the dependencies in this directory as follows:
@@ -104,17 +99,17 @@ $ composer install
10499```
105100
106101If it complains about extensions, please install ` phar ` and ` zip ` PHP
107- extesions and retry.
102+ extensions and retry.
108103
109104Then run the helper command.
110105
111106```
112107$ php wordpress-helper.php setup
113108```
114109
115- The command asks you several questions, please answer them. Then
116- you'll have a new WordPress project. By default it will create
117- ` my-wordpress-project ` in the current directory.
110+ The command asks you several questions, please answer them. Then you'll have a
111+ new WordPress project. By default it will create ` my-wordpress-project ` in the
112+ current directory.
118113
119114## Run WordPress locally and create a new user (for standard environment)
120115
@@ -134,7 +129,7 @@ $ vendor/bin/wp server --path=wordpress
134129
135130Then access http://localhost:8080/ . Follow the installation steps,
136131create the admin user and its password. Login to the Dashboard and
137- update if any of the plugins have update .
132+ update if any of the plugins have updates .
138133
139134Now it’s ready for the first deployment.
140135
@@ -150,25 +145,26 @@ $ gcloud app deploy \
150145Then access your site, and continue the installation step. The URL is:
151146https://PROJECT_ID.appspot.com/
152147
153- Go to the Dashboard, and in the Plugins page, activate the following
148+ Go to the Dashboard at https://PROJECT_ID.appspot.com/wp-admin . On the Plugins page, activate the following
154149plugins:
155150
156151
157- - For standard environment
158- - App Engine WordPress plugin (also set the e-mail address in its
159- setting page)
152+ - For the standard environment
160153 - Batcache Manager
161- - For flexible environment
154+ - Google App Engine for WordPress (also set the e-mail address in its
155+ settings page)
156+ - For the flexible environment
162157 - Batcache Manager
163158 - GCS media plugin
164159
165- After activating the plugins, try uploading a media and confirm the
166- image is uploaded to the GCS bucket.
160+ After activating the plugins, try uploading a media object in a new post
161+ and confirm the image is uploaded to the GCS bucket by visiting the
162+ [ Google Cloud console's Storage page] [ cloud-storage-console ] .
167163
168164## Check if the Batcache plugin is working
169165
170- On the plugin page in the WordPress dashboard, you should see 2
171- drop-ins are activated; ` advanced-cache.php ` and ` object-cache.php ` .
166+ On the plugin page in the WordPress dashboard, click on the Drop-ins tab. You
167+ should see 2 drop-ins are activated: ` advanced-cache.php ` and ` object-cache.php ` .
172168
173169To make sure it’s really working, you can open an incognito window and
174170visit the site because the cache plugin only serves from cache to
@@ -178,14 +174,17 @@ check the hit ratio and number of items in cache.
178174
179175## Various workflows
180176
181- ### Install/Update plugins/ themes
177+ ### Install/Update Wordpress, plugins, and themes
182178
183179Because the wp-content directory on the server is read-only, you have
184180to do this locally. Run WordPress locally and update plugins/themes in
185181the local Dashboard, then deploy, then activate them in the production
186- Dashboard. You can also use the ` wp-cli ` utility as follows:
182+ Dashboard. You can also use the ` wp-cli ` utility as follows (be sure to keep
183+ the cloud SQL proxy running):
187184
188185```
186+ # To update Wordpress itself
187+ $ vendor/bin/wp core update --path=wordpress
189188# To update all the plugins
190189$ vendor/bin/wp plugin update --all --path=wordpress
191190# To update all the themes
@@ -198,17 +197,10 @@ First Deactivate them in the production Dashboard, then remove them
198197completely locally. The next deployment will remove those files from
199198the production environment.
200199
201- ### Update WordPress itself
202-
203- Most of the case, just download the newest WordPress and overwrite the
204- existing wordpress directory. It is still possible that the existing
205- config files are not compatible with the newest WordPress, so please
206- update the config file manually in that case.
207-
208200### Update the base image
209201
210- We sometimes release the security update for
211- [ the php-docker image] [ php-docker ] . Then you’ll have to re-deploy your
202+ We sometimes release a security update for
203+ [ the php-docker image] [ php-docker ] . You have to re-deploy your
212204WordPress instance to get the security update.
213205
214206Enjoy your WordPress installation!
@@ -217,8 +209,11 @@ Enjoy your WordPress installation!
217209[ appengine-flexible ] : https://cloud.google.com/appengine/docs/flexible/
218210[ sql-settings ] : https://console.cloud.google.com/sql/instances
219211[ memcache-dashboard ] : https://console.cloud.google.com/appengine/memcache
212+ [ memcache-installation ] : https://www.digitalocean.com/community/tutorials/how-to-install-and-use-memcache-on-ubuntu-12-04#install-memcache
213+ [ mysql-client ] : https://dev.mysql.com/doc/refman/5.7/en/mysql.html
220214[ composer ] : https://getcomposer.org/
221- [ dev-console ] : https://console.cloud.google.com/
215+ [ cloud-console ] : https://console.cloud.google.com/
216+ [ cloud-storage-console ] : https://www.console.cloud.google.com/storage
222217[ cloud-sql-api-enable ] : https://console.cloud.google.com/flows/enableapi?apiid=sqladmin
223218[ app-engine-setting ] : https://console.cloud.google.com/appengine/settings
224219[ gcloud-sdk ] : https://cloud.google.com/sdk/
0 commit comments