Deploy on GCP
This is the official documentation of the forestadmin-agent-django
and forestadmin-agent-flask
Python agents.
This tutorial is designed to assist you with a step-by-step guide to deploy the admin backend to Google Cloud Platform, using Google's App Engine.
If you don’t have a Google Cloud Platform account yet, sign up here ↗. Then, create a billing account ↗ if you haven't already. You will need it to be able to use App Engine.
Install the Google Cloud SDK CLI
You first need to install the Cloud SDK CLI ↗ as you will need it to execute the commands listed below.
Create a new project on your Google Cloud Platform
To create a new project, run the following command in your terminal:
Replace [YOUR_PROJECT_ID]
with a string of characters that uniquely identifies your project.
To check if your project has been successfully created, run
Create an app within your Project using App Engine
The next step is to initialize App Engine for your newly created project. This will create an app attached to the project.
Choose carefully your application's region when prompted, you will not be able to change this setting later.
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
GCP offers a free tier for the use of Google App Engine. However, it may not be sufficient for your usage in production. You can check the free plan limitations here ↗. Note that you will get a USD 300 free credit when you register to App Engine.
Deploy your application
Now back to your terminal and run the following command in the Forest Admin backend's project directory.
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.
For a complete list of all the supported elements in this configuration file, please refer to Google Cloud Platform documentation's app.yaml
reference ↗. We chose to keep it very simple here.
Now, you are ready to deploy, please run:
Congratulations, your admin backend has been deployed 🎊. You can run the following command to make sure it is up and running:
This does not mean your project is deployed to production on Forest Admin. To deploy to production, check out this section after you've completed the above steps.
Adding environment variables
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:
Once the environment variables are added, you can deploy the codebase again to sync your production app with your Forest Admin Production Environment.
Having problems deploying? Check out troubleshooting common problems ↗ in our community.
Last updated