App Engine Google Cloud

Set Up WordPress on Google App Engine – Standard

Set Up WordPress on Google App Engine – Standard. Google App Engine is Google’s Infrastructure as a Service offering, which allows to rent computation power from Google itself.

This guide demonstrates how to run WordPress on App Engine standard environment with PHP 7.2.

Not using App Engine? Choose a different Category:

App Engine – Std

Prerequisites

  1. Create a project in the Google Cloud Platform Console.
  2. Enable billing for your project.
  3. Create a Cloud SQL Second Generation Instance.
  4. Enable Cloud SQL and Cloud SQL Admin API.

Enable APIs and Create New Service account

Go to APIs and Services and click Enable APIs and Services and enable Cloud SQL API and Cloud SQL Admin API

Go to IAM & Admin >> Service accounts and click Create service account.

In step 1

Enter Service account Name.

Click Create.

In step 2

Select Role.

Cloud SQL >> Cloud SQL Client
Project >> Editor

Click Continue.

In step 3

Click Create Key.

Choose Key type as JSON

Click Create.

Create Cloud SQL Instance

Follow this tutorial to create a new Cloud SQL Second Generation Instance.

Once you have created a user and a database you can proceed to set up WordPress.

Download GAE Tools

Go to your Google Cloud Console and click on the top right icon which says Activate Cloud Shell.

01. Download the google/cloud-tools package:

composer require google/cloud-tools

This command will create a vendor directory and download all necessary tools to create a new WordPress project.

Once the download is completed you can use the vendor/bin/wp-gae to set up WordPress.

Create WordPress Project

To download WordPress and set it up for GAE, use the below command:

php vendor/bin/wp-gae create

If you get an error about Class 'ZipArchive' not found. Run the following command to install zip for PHP 7.2.

sudo apt-get install php7.2-zip

Then continue to run the create command.

Now you will be prompted to enter a directory path.

Please enter a directory path for the new project (defaults to my-wordpress-project):

Enter a directory name and hit Enter

Next, you need to select the region of your Cloud SQL Instance.

Please select the region of your Cloud SQL instance (defaults to us-central1)

Select your Cloud SQL instance region and hit Enter

Now continue to setup database details as prompted.

Please enter project_id (required): YOUR_PROJECT_ID                    
Please enter db_instance (required): CLOUDSQL_INSTANCE_NAME
Please enter db_name (required): CLOUDSQL_DATABASE_NAME
Please enter db_user (defaults to 'root'): CLOUDSQL_USER
Please enter db_password (required): CLOUDSQL_PASSWORD
Do you want to use the same db user and password for local run? (Y/n)y

Replace YOUR_PROJECT_ID, CLOUDSQL_INSTANCE_NAME, CLOUDSQL_DATABASE_NAME, CLOUDSQL_USER, CLOUDSQL_PASSWORD

Now WordPress project is created in the directory you have created. Additionally app.yaml and cron.yaml file is also created for deployment.

Deploy WordPress to App Engine

Now your application is ready to be deployed to GAE.

Navigate inside the WordPress directory.

cd directory_name

Finally deploy.

gcloud app deploy app.yaml cron.yaml

Now you can access your site, and continue the installation step! The URL is https://YOUR_PROJECT_ID.appspot.com/.

Conclusion

Now you have learned how to deploy WordPress on Google App Engine – Standard Environment.

Thanks for your time. If you face any problem or any feedback, just leave a comment below.

Cloudbooklet builds a large collection of Linux based guides and tutorials on Cloud platforms like Google Cloud, AWS, Azure, DigitalOcean and more

Write A Comment

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.