0

I have an application with Spring backend and Angular frontend. I am using docker-compose and it is creating 2 containers.

I have bridge network, so locally I am able to test.

Now I want to deploy to Google Cloud.

Question: (1) Do I need to create any gcp specific yaml file?

The cluster I created seems not good enough, Using GKE in this case

Does not have minimum availability

I haven't seen any examples where spring and angular are deployed using CloudRun individually. But is this possible?

I desperately need to deploy my containers. IS there a way?

Edit:

The backend spring is able to talk to CloudSQL (answered in another post)

The angular app is not running because it doesnt know upstream host

nginx-py-sha256-2
2021/07/14 15:21:13 [emerg] 1#1: host not found in upstream "appserver:2623" in /etc/nginx/conf.d/default.conf:2 

In my docker compose -

services:
  # App backend service
  appserver:
    container_name: appserver
    image: appserver
  pui:
    container_name: nginx-py
    image: nginx-py

and my nginx.conf refers as appserver

The image I push is

docker push eu.gcr.io/myapp/appserver

what name should I use in nginx.conf so that it can identify host upstream? nice If I can disable prefix

GCP Kubernetes workload "Does not have minimum availability" is unanswered. so not a duplicate

Kris Swat
  • 788
  • 1
  • 10
  • 39
  • Does this answer your question? [GCP Kubernetes workload "Does not have minimum availability"](https://stackoverflow.com/questions/53452120/gcp-kubernetes-workload-does-not-have-minimum-availability) – Pit Jul 14 '21 at 07:28
  • @Pit because of cloudsql database connectivity issue, (not enabled by default), nodes were not starting. So I think its not a real unavailability issue (anyways sorted now) – Kris Swat Jul 14 '21 at 15:51

1 Answers1

0

You have a container for the backend and a front end with static file. the best pattern for that is:

And, of course, forgot Docker Compose.


Note: if you have a container for your frontend, with a webserver (Angular server, NGINX or something else) you can deploy it on Cloud Run also, but you will pay processing for nothing. Cloud Storage is a better solution.

In both cases, a load balancer is recommended to avoid CORS issue. And in addition, you will be able to add CDN on the load balancer if you need it in your business

guillaume blaquiere
  • 66,369
  • 2
  • 47
  • 76
  • There are so many options. make war file with spring+ng and deploy to APp engine...and struggle connecting to db. So I have to make a clear goal - use GKE and deploy my docker compose images, and let them talk. Now question is why my nginx.conf doesnt know upstream "appserver". Should I use localhost instead? – Kris Swat Jul 16 '21 at 09:37
  • I am bundling frontend into backend and creating war. My Development environment completely changed - No longer using Docker. I do have problems executing tests that need a container like tomcat (now using editor for such tests) – Kris Swat Jul 19 '21 at 22:17