PHP Developer Guide
Other documentationsDemoCommunityGitHub
  • Forest Admin
  • Getting started
    • How it works
    • Quick start
      • Symfony
      • Laravel
    • Create your agent
    • Troubleshooting
    • Migrating legacy agents
      • Pre-requisites
      • Recommendations
      • Migration steps
      • Code transformations
        • API Charts
        • Live Queries
        • Smart Charts
        • Route overrides
        • Smart Actions
        • Smart Fields
        • Smart Relationships
        • Smart Segments
  • Data Sources
    • Getting Started
      • Collection selection
      • Naming conflicts
      • Query interface and Native Queries
        • Fields and projections
        • Filters
        • Aggregations
    • Provided data sources
      • Doctrine
      • Eloquent
        • Polymorphic relationships
    • Write your own
      • Translation strategy
        • Structure declaration
        • Capabilities declaration
        • Read implementation
        • Write implementation
        • Intra-data source Relationships
      • Contribute
  • Agent customization
    • Getting Started
    • Actions
      • Scope and context
      • Result builder
      • Static Forms
      • Dynamic Forms
      • Related data invalidation
    • Charts
      • Value
      • Objective
      • Percentage
      • Distribution
      • Leaderboard
      • Time-based
    • Fields
      • Add fields
      • Move, rename and remove fields
      • Override binary field mode
      • Override writing behavior
      • Override filtering behavior
      • Override sorting behavior
      • Validation
    • Hooks
      • Collection hook
      • Collection override
    • Pagination
    • Plugins
      • Write your own
    • Relationships
      • To a single record
      • To multiple records
      • Computed foreign keys
      • Under the hood
    • Search
    • Segments
  • Frontend customization
    • Smart Charts
      • Create a table chart
      • Create a bar chart
      • Create a cohort chart
      • Create a density map
    • Smart Views
      • Create a Map view
      • Create a Calendar view
      • Create a Shipping view
      • Create a Gallery view
      • Create a custom tinder-like validation view
      • Create a custom moderation view
  • Deploying to production
    • Environments
      • Deploy on AWS
      • Deploy on Heroku
      • Deploy on GCP
      • Deploy on Ubuntu
    • Development workflow
    • Using branches
    • Deploying your changes
    • Forest Admin CLI commands
      • init
      • login
      • branch
      • switch
      • set-origin
      • push
      • environments:create
      • environments:reset
      • deploy
  • Upgrade
    • Laravel agent upgrade to v3
  • Under the hood
    • .forestadmin-schema.json
    • Data Model
      • Typing
      • Relationships
    • Security & Privacy
Powered by GitBook
On this page

Was this helpful?

  1. Deploying to production
  2. Environments

Deploy on GCP

PreviousDeploy on HerokuNextDeploy on Ubuntu

Last updated 1 year ago

Was this helpful?

This is the official documentation of the forestadmin/laravel-forestadmin v2+ and forestadmin/symfony-forestadmin PHP 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, . Then, 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 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:

gcloud projects create [YOUR_PROJECT_ID]

Replace [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]

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.

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:

Deploy your application

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

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:

app.yaml
runtime: nodejs12
env_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 codebase again to sync your production app with your Forest Admin Production Environment.

gcloud app deploy

account linked to your new project is the correct one

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 . Note that you will get a USD 300 free credit when you register to App Engine.

For a complete list of all the supported elements in this configuration file, please refer to Google Cloud Platform documentation's . We chose to keep it very simple here.

This does not mean your project is deployed to production on Forest Admin. To deploy to production, check out after you've completed the above steps.

Having problems deploying? Check out in our community.

sign up here β†—
create a billing account β†—
Cloud SDK CLI β†—
ensure the billing β†—
enable the Cloud Build API β†—
here β†—
app.yaml reference β†—
troubleshooting common problems β†—
this section