0
votes

We're migrating a website from a VPS at DigialOcean to Google Cloud. Google Cloud probably won't be cheaper but as it's a small website that we do on the side we don't want to spend time on dev-ops too much. The techniques we're using are:

  • AngularJS as frontend
  • Flask, with Python3, as backend
  • PostgreSQL as database, with SQLAlchemy as ORM
  • GitLab as git repository, with GitLab CI

The frontend and the backend are two separate projects, communication with REST, and we would like to keep it this way. The reason is that we want to deploy one project without having to deploy the other. Don't think that we're unique in that way.

We have 2 environments: one production and one test and would like to keep it that way.

We don't have any previous experience with Google Cloud and it's products, but all examples we've found serves the frontend on a static-route from the backend from within a Google App Engine. From our point of view this doesn't seem like a great separation of concern, and we don't want to have a monolithic repository.

Is it possible to keep our setup with two separate projects and two different environments with Google Cloud?

Some more information

backend/app.yaml

runtime: python37
service: test-flask

backend/dispatch.yaml

dispatch:
  - url: "*/api*"
    service: test-flask

frontend/app.yaml

runtime: nodejs10
service: test-angularjs
handlers:
  - url: /(.*\.(js|css|svg)?(.*))
    static_files: dist/\1
    upload: dist/(.*)

  - url: /(.*\.(png|xml|)?(.*))
    static_files: dist/\1
    upload: dist/assets/(.*)

  - url: /
    static_files: dist/index.html
    upload: dist/index.html

  - url: /(.*(a|pa|friends|faq).*)
    static_files: dist/index.html
    upload: dist/index.html
1

1 Answers

0
votes

It is possible to keep the Backend and Frontend in two different projects with two different App Engine applications and use HTTP requests to communicate between your separate applications. Here you can find the useful information about how requests are handled by a Google App Engine application deployed with Node.js runtime (the Frontend) and for the same with Python 3.7 runtime (the Backend).

I would recommend you to start by reading the relevant section of the Google Cloud Platform's documentation and specially this article to get a grasp for all the possibilities offered by Google Cloud Platform for serving websites. A comprehensive, yet not complete lists of architectural possibilities could be:

  1. In one project deploy one App Engine application and use different services for the Frontend and Backend. Find here all the relevant information about the available methods to communicate between the services.
  2. Use other products like virtual machines with Compute Engine.
  3. Dockerize your applications and use Cloud Run services.

You can also use Cloud SQL for the PostgreSQL database and use Cloud Build and Cloud Source Repositories for a CI/CD pipeline. You can find more information here and use this quickstart to understand CD for App Engine with Cloud Build, as you intend for your application.