There are two alternatives to start with the SDK:
- install SDK locally;
- use provided Linux VM in the cloud via ssh.
Note: everyone will get a separate index, ie. hacker02, hacker03, etc.
$ ssh hacker01@wp-workshop.hosting.lv
Use your Google account to sign-in into Google Cloud Developers Console and create a new project. Choose nice and unique Project ID.
Until billing is enabled you won't be able to create Cloud SQL instances - that's a paid feature with no free tier. Instead we'll be using a MySQL instance from another Google Cloud project that has billing in-place.
Now, you must tell me the Project ID so I could add an access to Cloud SQL MySQL instance and Cloud Storage bucket, which is also a paid feature.
In case you're setting up the billing and creating your own Cloud SQL instance, it must be created in United States Region. Also, create Cloud Storage bucket for media files and add your-project-id@appspot.gserviceaccount.com
as bucket Writer.
Download and unpack WordPress:
$ mkdir wp-workshop
$ cd wp-workshop
$ curl http://wordpress.org/latest.tar.gz | tar xz
$ ls -ld wordpress
Download wp-config and App Engine manifests:
$ wget -P wordpress/ \
https://gist.githubusercontent.com/arkadijs/9b0f3e17e08471ed4c5f/raw/wp-config.php
$ wget \
https://gist.githubusercontent.com/arkadijs/9b0f3e17e08471ed4c5f/raw/app.yaml \
https://gist.githubusercontent.com/arkadijs/9b0f3e17e08471ed4c5f/raw/cron.yaml \
https://gist.githubusercontent.com/arkadijs/9b0f3e17e08471ed4c5f/raw/php.ini
Now, edit wordpress/wp-config.php
, replacing index in DB_NAME
with the index you've got for hacker01
ssh login. Also edit app.yaml
, replacing application: your-project-id
to match the Project ID (not the name) that is assigned to your Google Cloud Platform project.
Download necessary plug-ins, first Google App Engine for WordPress:
$ wget -O appengine-wordpress-plugin.zip \
https://github.com/GoogleCloudPlatform/appengine-wordpress-plugin/archive/master.zip
$ unzip appengine-wordpress-plugin.zip -d wordpress/wp-content/plugins/
$ rm appengine-wordpress-plugin.zip
then Batcache and Memcached Object Cache:
$ wget -P wordpress/wp-content/ \
https://raw.githubusercontent.com/jeremyfelt/Memcached-Object-Cache/master/object-cache.php \
https://raw.githubusercontent.com/Automattic/batcache/master/advanced-cache.php
$ wget -P wordpress/wp-content/plugins/ \
https://raw.githubusercontent.com/Automattic/batcache/master/batcache.php
Ready to deploy in wp-workshop
directory:
wp-workshop $ appcfg.py -e your-account@gmail.com \
--oauth2 --noauth_local_webserver update .
Note trailing dot.
Create schema in provided Cloud SQL instance:
$ mysql -h wp-workshop-db.hosting.lv -u root -pwp-workshop-password
mysql> create database wordpress_db01 default character set utf8;
Query OK, 1 row affected (0.26 sec)
Use your own 02, 03, etc. index!
Open https://your-project-id.appspot.com/wp-admin/install.php in browser. Fill-in the form, press the button, wait a little bit.
Login and choose Plugins in menu on the left. Enable Batcache Manager and Google App Engine for WordPress plug-ins.
Go to GAE plug-in settings and enter wp-workshop-bucket
into Upload Settings / Bucket Name, then save changes.
That's it!