This tutorial is designed to assist you with a step-by-step guide to deploy the Lumber-generated admin backend to Google Cloud Platform, using Google's App Engine.
You first need to install the Cloud SDK CLI as you will need it to execute the commands listed below.
To create a new project, run the following command in your terminal:
gcloud projects create [YOUR_PROJECT_ID]
[YOUR_PROJECT_ID] with a string of characters that uniquely identifies your project.
To check if your project has been successfully created, run
gcloud projects describe [YOUR_PROJECT_ID]
The next step is to initialize App Engine for your newly created project. This will create an app attached to the project.
gcloud app create --project=[YOUR_PROJECT_ID]
Your App Engine application in your project has been created 🎊.
The last steps needed before you can deploy your Forest Admin backend are to:
ensure the billing account linked to your new project is the correct one
enable the Cloud Build API on your project
Now back to your terminal and run the following command in the Forest Admin backend's project directory.
touch app.yaml && echo 'runtime: nodejs12' > app.yaml
This will create an
app.yaml config file in your admin backend directory. This file acts as a deployment descriptor for your service, it generally contains CPU, memory, network and disk resources, scaling, and other general settings including environment variables.
Now, you are ready to deploy, please run:
gcloud app deploy
Congratulations, your admin backend has been deployed 🎊. You can run the following command to make sure it is up and running.
gcloud app browse
When required to add the environment variables to configure your production environment, you need to add them to the
app.yaml file of your admin backend repository. The file should look like this:
app.yamlruntime: nodejs12env_variables:FOREST_ENV_SECRET: '63f51525814bdfec9dd99690a656757e251770c34549c5f383d909f5cce41eb9'FOREST_AUTH_SECRET: '93d33e1b2a9f9b03aeac687d5a811ac872bf145e9f2c4b28'DATABASE_URL: 'postgres://user:password@remotehost:5432/db_name'NODE_ENV: 'production'
Once the environment variables are added, you can deploy the code base again to sync your production app with your Forest Admin Production environment.
gcloud app deploy