omgnetwork / omg-childchain-v2

pronounced /Ch-ch/
Apache License 2.0
5 stars 2 forks source link

use single nginx container #159

Closed ayrat555 closed 3 years ago

ayrat555 commented 3 years ago

should be merged after https://github.com/omgnetwork/specs/pull/20/files

fixes https://github.com/omgnetwork/childchain/issues/153

InoMurko commented 3 years ago

how does NGINX behave if the underlying service isn't reachable? childchain has a route:

get "health.check" do
    Health.call(conn, %{})
  end

that works as: if everything is OK, return 200. if requests shouldn't be routed to this childchain, return 503.

can you make sure that:

ayrat555 commented 3 years ago

@InoMurko Initially, I was trying to use health_check directive, but it turns out this directive is available only in the commercial version of nginx. what I did:

  1. I added childchain upstream which should contain a list of childchain server https://github.com/omgnetwork/childchain/pull/159/files#diff-4a09c0a0fa902cb0f31dbe2d49b7e9455ad37b89f60dab3857fa7b2fe3d9481eR8

When one server is not available, the next server will be chosen.

  1. https://github.com/omgnetwork/childchain/pull/159/files#diff-4a09c0a0fa902cb0f31dbe2d49b7e9455ad37b89f60dab3857fa7b2fe3d9481eR22-R27

If all servers are not available, by default Nginx returns 502 or 504 errors. I changed it to 503

InoMurko commented 3 years ago

thats great!

InoMurko commented 3 years ago

we'll see now how pull_childchain_health works with nginx in front

ayrat555 commented 3 years ago

@InoMurko I fixed port conflicts in pull_childchain_health