• This repository has been archived on 27/Apr/2021
  • Stars
    star
    368
  • Rank 115,958 (Top 3 %)
  • Language
    PHP
  • Created about 11 years ago
  • Updated almost 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Starter project for running WordPress on Google Cloud Platform

status: inactive

This project is no longer actively developed or maintained.

For new work on this check out A helper command for running WordPress on Google Cloud Platform

WordPress on App Engine Starter Project

Note: This repo is essentially the "source" of the starter projects, allowing you to browse our code, suggest changes, etc. We provide already-built-and-zipped WordPress projects for Windows, Mac, and Linux at Quick Start WordPress for Google App Engine.

Prerequisites

  1. Install the PHP SDK for Google App Engine
  2. Install MySQL
  3. Sign up for a Google Cloud Platform project, and set up a Cloud SQL instance, as described here, and a Cloud Storage bucket, as described here. You'll want to name your Cloud SQL instance "wordpress" to match the config files provided here. To keep costs down, we suggest signing up for a D0 instance with package billing.
  4. Visit your project in the Google Cloud Console, going to the App Engine section's Application Settings area, and make a note of the Service Account Name for your application, which has an e-mail address (e.g. <PROJECT_ID>@appspot.gserviceaccount.com). Then, visit the Cloud Storage section of your project, select the checkbox next to the bucket you created in step 3, click Bucket Permissions, and add your Service Account Name as a User account that has Writer permission.

Cloning and setup

Step 1: Clone

Clone this git repo and its submodules by running the following commands:

git clone --recursive https://github.com/GoogleCloudPlatform/appengine-php-wordpress-starter-project.git
cd appengine-php-wordpress-starter-project/

You now have a copy of WordPress, the App Engine plugin for WordPress, Batcache, and Memcached Object Cache.

Step 2: Edit the config files

Edit wp-config.php and app.yaml, replacing your-project-id to match the Project ID (not the name) that was assigned to your Google Cloud Platform project.

Step 3: Move files into place:

Because of GitHub and licensing limitations, we can't put these files in the right places for you.

Run this script to move all the files into place:

move_files_after_editing.sh

This script:

  1. Moves wp-config.php from root into wordpress/, replacing the file there.
  2. Moves batcache/advanced-cache.php to wordpress/wp-content/
  3. Moves batcache/batcache.php to wordpress/wp-content/plugins/
  4. Moves wp-memcache/object-cache.php to wordpress/wp-content/
  5. Moves the contents of appengine-wordpress-plugin/ to wordpress/wp-content/plugins/

Running WordPress locally

First, edit wp-config.php so that the local environment password for root is not literally the string "password" -- unless that's what you used when setting up MySQL locally.

Using MySQL's command line version, run databasesetup.sql to set up your local database. For a default installation (no root password) this would be:

mysql -u root < databasesetup.sql

But really, all it's doing is running this line -- the WordPress installation script will do the heavy lifting when it comes to setting up your database.

CREATE DATABASE IF NOT EXISTS wordpress_db;

To run WordPress locally on Windows and OS X, you can use the Launcher by going to File > Add Existing Project or you can run one of the commands below.

On Mac and Windows, the default is to use the PHP binaries bundled with the SDK:

$ APP_ENGINE_SDK_PATH/dev_appserver.py path_to_this_directory

On Linux, or to use your own PHP binaries, use:

$ APP_ENGINE_SDK_PATH/dev_appserver.py --php_executable_path=PHP_CGI_EXECUTABLE_PATH path_to_this_directory

Now, with App Engine running locally, visit http://localhost:8080/wp-admin/install.php in your browser and run the setup process, changing the port number from 8080 if you aren't using the default. Or, to install directly from the local root URL, define WP_SITEURL in your wp-config.php, e.g.:

define( 'WP_SITEURL', 'http://localhost:8080/');

You should be able to log in, and confirm that your app is ready to deploy.

Deploy!

If all looks good, you can upload your application using the Launcher or by using this command:

$ APP_ENGINE_SDK_PATH/appcfg.py update APPLICATION_DIRECTORY

Just like you had to do with the local database, you'll need to set up the Cloud SQL instance. The SDK includes a tool for doing just that:

google_sql.py <PROJECT_ID>:wordpress

This launches a browser window that authorizes the google_sql.py tool to connect to your Cloud SQL instance. After clicking Accept, you can return to the command prompt, which has entered into the SQL command tool and is now connected to your instance. Next to sql>, enter this command:

CREATE DATABASE IF NOT EXISTS wordpress_db;

You should see that it inserted 1 row of data creating the database. You can now type exit -- we're done here.

Now, just like you did when WordPress was running locally, you'll need to run the install script by visiting:

http://<PROJECT_ID>.appspot.com/wp-admin/install.php

Or, to install directly from the root URL, you can define WP_SITEURL in your wp-config.php, e.g.:

define( 'WP_SITEURL', 'http://<YOUR_PROJECT_ID>.appspot.com/');

Activating the plugins, configuring email, and hooking up WordPress to your Cloud Storage

The following steps should be performed on your hosted copy of WordPress on App Engine

Activating the plugins

Now, we just need to activate the plugins that were packaged with your app. Log into the WordPress administration section of your blog at http://<PROJECT_ID>.appspot.com/wp-admin, and visit the Plugins section. Click the links to activate Batcache Manager and Google App Engine for WordPress.

Configuring email and hooking WordPress up to your Cloud Storage

Now visit Settings > App Engine. Enable the App Engine mail service - this will use the App Engine Mail API to send notifications from WordPress. Optionally, enter a valid e-mail address that mail should be sent from (if you leave this blank, the plugin will determine a default address to use). The address of the account you used to the create the Cloud Console project should work.

Stay on this page, because in order to be able to embed images and other multimedia in your WordPress content, you need to enter the name of the Cloud Storage bucket you created when going through all the Prequisites earlier under Upload Settings.

Hit Save Changes to commit everything.

That's all! (PHEW)

Congratulations! You should now have a blog that loads rapidly, caches elegantly, sends email properly, and can support adding images and other media to blog posts! Most importantly, it will take advantage of Google's incredibly powerful infrastructure and scale gracefully to accomodate traffic that is hitting your blog.

Maintaining

You'll want to keep your local copy of the application handy because that's how you install other plugins and update the ones that are packaged with this project. Due to the tight security of the App Engine sandbox, you can't directly write to files in the application area -- they're static. That's also why we hooked your uploads up to Cloud Storage. So, to install plugins, you log into the admin area of your local WordPress instance, install or update any plugins you want there, and redeploy. Then go into the admin area for your hosted WordPress instance to activate the plugins.

More Repositories

1

code-prettify

An embeddable script that makes source-code snippets in HTML prettier.
JavaScript
5,768
star
2

chromedeveditor

Chrome Dev Editor is a developer tool for building apps on the Chrome platform - Chrome Apps and Web Apps, in JavaScript or Dart. (NO LONGER IN ACTIVE DEVELOPMENT)
Dart
2,924
star
3

android-Camera2Basic

Migrated:
Java
2,863
star
4

android-ConstraintLayoutExamples

Migrated:
Java
2,571
star
5

firebase-jobdispatcher-android

DEPRECATED please see the README.md below for details.
Java
1,796
star
6

vrview

Library for embedding immersive media into traditional websites.
JavaScript
1,709
star
7

tiger

Java
1,645
star
8

flipjs

A helper library for doing FLIP animations.
JavaScript
1,409
star
9

android-PictureInPicture

Migrated:
Java
1,393
star
10

android-FingerprintDialog

Migrated:
Java
1,375
star
11

observe-js

A library for observing Arrays, Objects and PathValues
JavaScript
1,357
star
12

PyDrive

Google Drive API Python wrapper library
Python
1,304
star
13

js-marker-clusterer

A marker clustering library for the Google Maps JavaScript API v3.
JavaScript
1,279
star
14

android-RuntimePermissions

This sample has been deprecated/archived. Check this repo for related samples:
Java
1,263
star
15

android-Camera2Video

Migrated:
Java
1,201
star
16

chromium-webview-samples

Useful examples for Developing apps with the Chromium based WebView
Java
1,173
star
17

androidtv-Leanback

Migrated:
Java
1,148
star
18

caja

Caja is a tool for safely embedding third party HTML, CSS and JavaScript in your website.
Java
1,126
star
19

android-ui-toolkit-demos

Migrated:
Java
1,118
star
20

android-ScreenCapture

Migrated:
Java
1,021
star
21

android-BluetoothChat

Migrated:
Java
986
star
22

android-BluetoothLeGatt

Migrated:
Java
911
star
23

sample-media-pwa

A sample video-on-demand media Progressive Web App
JavaScript
889
star
24

ChromeWebLab

The Chrome Web Lab for Makers, Hackers and everyone
JavaScript
877
star
25

big-rig

A proof-of-concept Performance Dashboard, CLI and Node module
CSS
857
star
26

android-instant-apps

Migrated:
Java
847
star
27

cloud-functions-emulator

A local emulator for deploying, running, and debugging Google Cloud Functions.
JavaScript
827
star
28

guitar-tuner

A web-based guitar tuner
JavaScript
822
star
29

android-JobScheduler

This sample has been deprecated/archived. Check this repo for related samples:
Java
773
star
30

flashlight

A pluggable integration with ElasticSearch to provide advanced content searches in Firebase.
JavaScript
757
star
31

friendlypix

FriendlyPix is a cross-platform Firebase example app
726
star
32

voice-memos

A Progressive Web App for recording and playing back voice memos.
JavaScript
724
star
33

android-audio-high-performance

We now recommend you use the Oboe libraries:
C++
715
star
34

android-EmojiCompat

Migrated:
Java
707
star
35

android-RecyclerView

Migrated:
Java
675
star
36

ios-swift-chat-example

FireChat implemented in Swift!
Objective-C
673
star
37

leanback-showcase

Migrated:
Java
639
star
38

android-transition-examples

Migrated:
581
star
39

geofire

Realtime location queries with Firebase
569
star
40

drive-music-player

Fully client side Music Player for Google Drive
JavaScript
566
star
41

android-viewpager2

Migrated:
552
star
42

science-journal-ios

Use the sensors in your mobile devices to perform science experiments. Science doesn’t just happen in the classroom or labβ€”tools like Science Journal let you see how the world works with just your phone.
Swift
532
star
43

topeka

quiz app
HTML
532
star
44

android-PdfRendererBasic

Migrated:
Java
522
star
45

science-journal

Use the sensors in your mobile devices to perform science experiments. Science doesn’t just happen in the classroom or labβ€”tools like Science Journal let you see how the world works with just your phone.
Java
508
star
46

tango-examples-java

Example projects for Project Tango [deprecated] Java API
Java
500
star
47

AndroidChat

Demonstrates using the Firebase Android SDK to back a ListView.
Java
499
star
48

android-nearby

Migrated:
Java
494
star
49

android-play-places

Deprecated:
Java
479
star
50

tango-examples-unity

Project Tango [deprecated] UnitySDK Example Projects
C#
475
star
51

easygoogle

Simple wrapper library for Google APIs
Java
471
star
52

firefeed

JavaScript
461
star
53

android-dynamic-features

Migrated:
Kotlin
460
star
54

android-MediaBrowserService

This sample is deprecated.
Java
457
star
55

graphd

The Metaweb graph repository server
C
445
star
56

drive-zipextractor

Extract (decompress) ZIP files into Google Drive using the Google Drive API
JavaScript
435
star
57

android-AutofillFramework

Migrated:
Java
432
star
58

webplatform-samples

HTML5 Samples/Demos
430
star
59

cloud-functions-go

Unofficial Native Go Runtime for Google Cloud Functions
Go
427
star
60

android-unsplash

Deprecated:
424
star
61

android-MultiWindowPlayground

Migrated:
Java
418
star
62

appengine-flask-skeleton

A skeleton for creating Python applications using the Flask framework on App Engine
Python
416
star
63

angularfire-seed

Seed project for AngularFire apps
JavaScript
412
star
64

node-big-rig

A CLI version of Big Rig
JavaScript
410
star
65

firebase-dart

Dart wrapper for Firebase
Dart
409
star
66

android-Camera2Raw

Migrated:
Java
386
star
67

js-store-locator

A library for easily building store-locator-type applications using the Google Maps JavaScript API v3
JavaScript
380
star
68

ADBPlugin

Google Chrome Extension with ADB Daemon
C++
372
star
69

android-fit

Migrated:
Java
372
star
70

android-NotificationChannels

This sample has been deprecated/archived. Check this repo for related samples:
Java
369
star
71

android-ActivitySceneTransitionBasic

Migrated:
368
star
72

android-text

Migrated:
Kotlin
363
star
73

android-XYZTouristAttractions

Migrated:
356
star
74

firebase-angular-starter-pack

A Firebase + AngularJS Starter Pack
JavaScript
348
star
75

android-OurStreets

Migrated:
345
star
76

tango-examples-c

JNI example projects for Project Tango [deprecated] C-API
C++
334
star
77

simian

Simian is an enterprise-class Mac OS X software deployment solution. Google App Engine hosted server, with a client powered by the Munki open-source project.
Python
334
star
78

OpenInChrome

Open in Chrome
Objective-C
333
star
79

android-DownloadableFonts

Migrated:
Java
319
star
80

friendlypix-web

FriendlyPix is a cross-platform Firebase example app - This is the web version
JavaScript
312
star
81

pywebsocket

WebSocket server and extension for Apache HTTP Server for testing
Python
310
star
82

android-DarkTheme

migrated:
Java
302
star
83

firereader

Firereader: A feed reader built with Firebase and AngularJS
JavaScript
301
star
84

android-WatchFace

Migrated:
300
star
85

android-MediaRecorder

Migrated:
Java
299
star
86

backbonefire

Backbone bindings for Firebase
JavaScript
291
star
87

TemplateBinding

TemplateBinding Prolyfill
JavaScript
291
star
88

firebase-login-demo-android

Java
280
star
89

Firebase-Unity

Objective-C
279
star
90

seed-element

Polymer element boilerplate
HTML
278
star
91

firebase-util

An experimental toolset for Firebase
JavaScript
276
star
92

android-NavigationDrawer

This sample has been deprecated/archived. Check this repo for related samples:
Java
276
star
93

android-DisplayingBitmaps

Migrated:
Java
272
star
94

wReader-app

RSS Reader written using AngularJS
JavaScript
271
star
95

gcm-playground

CSS
268
star
96

android-CardView

Migrated:
Java
265
star
97

soundstagevr

C#
263
star
98

ShadowDOM

ShadowDOM Polyfill
JavaScript
263
star
99

android-credentials

Migrated:
Java
260
star
100

gamebuilder

Game Builder is an application that allows users to create games with little or no coding experience.
C#
253
star