You can create an
.env.gcp file in the project root. This will make
deploying services to GCP a bit easier since the
.env.gcp file will override
values in the
.env file. The
.env.gcp is optional for local development. If
you see warnings in the console about the file missing when running certain
commands, that's ok. The
.env.gcp file will only affect the
.tpl files and you
should only add overrides for GCP specific resources.
Create an App Engine application within your new project:
$ gcloud app create
Configure Google Cloud SDK with your account and the project ID you've just created:
$ gcloud init
Update the following environment variables in
||The unique ID of you Google project. Default is
||The [region][regions-and-zones] where all your resources will be created. For example,
||The preferred [zone][regions-and-zones] in your region that resources will be created, For example,
Configure the App Engine default GCS bucket for later use. The default App Engine bucket is named YOUR_PROJECT_ID.appspot.com. Change the default Access Control List (ACL) of that bucket as follows:
$ gsutil defacl ch -u AllUsers:R gs://YOUR_PROJECT_ID.appspot.com
If you want to upload images to WordPress then you'll need to create a bucket for those images to live (unless you opt to use the local file system). Open the [Cloud Storage Browser][cloud-storage-browser] and click Create Bucket.
Run the following command to change the ACL's of your new bucket:
$ gsutil defacl ch -u AllUsers:R gs://YOUR_BUCKET_NAME
When the API is up and running, log into the WordPress admin and go to the plugin
settings page for
GCS Upload then add your bucket name to the form field and
click Save Settings.
Finally, go to the the Credentials section of your project
in the Console. Click 'Create credentials' and then click 'Service account key.'
For the Service account, select 'App Engine app default service account.' Then
click 'Create' to create and download the JSON service account key to your local
machine. Save it as
service-account.json in the the projects root directory for
use with connecting to both Cloud Storage and Cloud SQL.