Skip to content

Wait for nats (and asterisk) #37

@blaggacao

Description

@blaggacao

In k8s reconciliation model, a failing ari-proxy that triggers a container restart might indicate a problem.

Therefore, shift the reconciliation loop from the scheduler into the container run time.

The best place seems to be the init script. Just saw: its FROM scratch, so a built-in reconciliation loop would probably be the right choice?

Interestingly the binary already iterates on the asterisk availability. Hare are the complete logs that triggered a restart:

t=2020-10-27T16:43:42+0000 lvl=info msg="starting ari-proxy server" version=5.0.1
t=2020-10-27T16:43:42+0000 lvl=eror msg="failed to connect to Asterisk" error="websocket.Dial ws://localhost:8088/ari/events?app=demo: dial tcp [::1]:8088: connect: connection refused"
t=2020-10-27T16:43:43+0000 lvl=eror msg="failed to connect to Asterisk" error="websocket.Dial ws://localhost:8088/ari/events?app=demo: dial tcp [::1]:8088: connect: connection refused"
t=2020-10-27T16:43:44+0000 lvl=eror msg="failed to connect to Asterisk" error="websocket.Dial ws://localhost:8088/ari/events?app=demo: dial tcp [::1]:8088: connect: connection refused"
t=2020-10-27T16:43:45+0000 lvl=eror msg="failed to connect to Asterisk" error="websocket.Dial ws://localhost:8088/ari/events?app=demo: dial tcp [::1]:8088: connect: connection refused"
t=2020-10-27T16:43:46+0000 lvl=eror msg="failed to connect to Asterisk" error="websocket.Dial ws://localhost:8088/ari/events?app=demo: dial tcp [::1]:8088: connect: connection refused"
Error: failed to connect to NATS: nats: no servers available for connection
Usage:
  ari-proxy [flags]
Flags:
      --ari.application string     ARI Stasis Application
      --ari.http_url string        HTTP Base URL for connecting to ARI (default "http://localhost:8088/ari")
      --ari.password string        Password for connecting to ARI
      --ari.username string        Username for connecting to ARI
      --ari.websocket_url string   Websocket URL for connecting to ARI (default "ws://localhost:8088/ari/events")
      --config string              config file (default is $HOME/.ari-proxy.yaml)
  -h, --help                       help for ari-proxy
      --nats.url string            URL for connecting to the NATS cluster (default "nats://127.0.0.1:4222")
  -v, --verbose                    Enable verbose logging
  -V, --version                    Print version information and exit
t=2020-10-27T16:43:48+0000 lvl=eror msg="server died" error="failed to connect to NATS: nats: no servers available for connection"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions