Switch Gcloud project
gcloud config set project my-project
1) a new Cloud SQL for MySQL Second Generation instance
gcloud sql instances create wordpress \ --activation-policy=ALWAYS \ --tier=db-n1-standard-1
Describe where your database is
gcloud sql instances describe wordpress | grep region
TIPS : delete
gcloud sql instances delete wordpress
2) Create the database
instance name / database name : `wordpress`
database user name : `root`
gcloud sql databases create wordpress --instance wordpress
TIPS : delete
gcloud sql databases delete wordpress --instance wordpress
3) change root password
gcloud sql users set-password root % \ --instance wordpress \ --password=YOUR_INSTANCE_ROOT_PASSWORD # Don't use this password!
composer require google/cloud-tools composer require google/cloud-tools php vendor/bin/wp-gae
wp-gae command provides a convenient way for you to either create a new WordPress project or add the required configuration to an existing one
The wp-gae command will ask you several question in order to set up your Cloud SQL database connection, and then write the required configuration to your wp-config.php configuration file. It also copies the following files into your project directory to allow WordPress to run on Google App Engine:
app.yaml: The App Engine configuration file that specifies the runtime and static asset handlers.
cron.yaml: The App Engine configuration file that ensures wp-cron.php is run every 15 minutes.
php.ini: For setting PHP configuration in App Engine specific to WordPress.
gae-app.php: The Front Controller, which is required for all App Engine applications.
Create a new WordPress project
php vendor/bin/wp-gae create
Migrate existing project to gcloud
php vendor/bin/wp-gae update path/to/your-wordpress-site
gcloud app deploy app.yaml cron.yaml
“for the month of November and December which amounts to $8.05 per month. So it’s almost the same as paying for shared hosting I’d say. It looks like the Cloud SQL instance does not shut down.”