Monday, 17 February 2020

Route Domains to Different Service Ports Using Pure Google Cloud Balancer or Nginx

Solution 1: Use Google Balancer for simple mapping domains to service ports:
  1. Create different backends for different service ports
  2. Create host and path rules for mapping domains to backends
  3. Create the frontend (proxy) to receive requests
  4. Notes:
    1. Client -> Proxy -> Host/path rules -> Backend:Port
    2. Use SSL/TLS cert on frontend, not necessary elsewhere
  5. Pros:
    1. Multiple healthchecks for multiple services
  6. Cons:
    1. No advanced config on proxy
Solution 2: Use Google Balancer + Nginx for advanced mapping domains to service ports:
  1. Create a single backend to Nginx at port 80
  2. No need host/path rules
  3. Create frontend (proxy) to receive requests
  4. Config Nginx on all instances to add custom configurations, e.g. HTTP Upgrade for socket.io, etc.
  5. Notes:
    1. Client -> Frontend (Proxy) -> Skip:Host/path rules --> Nginx --> Service:Port
    2. Use SSL/TLS cert on frontend, not necessary elsewhere.
  6. Pros:
    1. Advanced config on Nginx proxy
  7. Cons:
    1. Only a single healthcheck, when deploying services on an instance, shutting down Nginx is required to notify the healthcheck; all services on this instance is down at the same time. When all services on this instance are up back, turn on Nginx to notify healthcheck again.

No comments:

Post a Comment