Expected proxy log output when running in docker-compose?

Hi,

I am making my initial forays into AkkaServerless, based on the preview course at Lightbend academy
(Course | Akka-Serverless-for-JavaScript | Lightbend Academy)

I’ve been stuck trying to run the proxy locally on Ubuntu with docker-compose.

I have made some changes to the preview course docker-compose.yml file to use a newer version of the proxy image, and since I’m using linux, define “extra_hosts”. (My current yml file contents shown at the bottom).

But I now get these warnings: “Could not connect to user function not available for discovery”, as below. This persists even once I have started the service, so I imagine it is not because it is waiting for that to be available, rather something else is effecting the “discovery”.

What should I expect to see logged by the proxy to know that it is working as expected?

Thanks,
David

proxy log messages:

as-proxy_1  | {"timestamp":"2022-01-26T13:50:16.869Z","mdc":{"akkaAddress":"akka://akkaserverless-proxy@172.19.0.2:25520","akkaSource":"akka://akkaserverless-proxy/user/discovery-manager","sourceActorSystem":"akkaserverless-proxy"},"logger":"com.akkaserverless.proxy.DiscoveryManager","message":"**Connecting to host.docker.internal:8080 to discover the user function specification**","severity":"INFO","thread":"akkaserverless-proxy-akka.actor.default-dispatcher-8"}
as-proxy_1  | {"timestamp":"2022-01-26T13:50:17.058Z","mdc":{"akkaAddress":"akka://akkaserverless-proxy@172.19.0.2:25520","akkaSource":"akka://akkaserverless-proxy/user/discovery-manager","sourceActorSystem":"akkaserverless-proxy"},"logger":"com.akkaserverless.proxy.DiscoveryManager","message":"**Supervisor RestartSupervisor saw failure [1]: Could not connect to user function not available for discovery**","exception":"com.akkaserverless.proxy.DiscoveryManager$$anon$1: Could not connect to user function not available for discovery\n","severity":"WARN","thread":"akkaserverless-proxy-akka.actor.default-dispatcher-2"}

modified docker-compose.yml:

version: "3"
services:
  as-proxy:
    # image: gcr.io/akkaserverless-public/akkaserverless-proxy:0.7.0-beta.9
    image: gcr.io/akkaserverless-public/akkaserverless-proxy:0.8.5
    command: -Dconfig.resource=dev-mode.conf -Dakkaserverless.proxy.protocol-compatibility-check=false
    ports:
      - "9000:9000"
    extra_hosts:
      - "host.docker.internal:host-gateway"
    environment:
      USER_FUNCTION_HOST: ${USER_FUNCTION_HOST:-host.docker.internal}
      USER_FUNCTION_PORT: ${USER_FUNCTION_PORT:-8080}

After starting the service:

> hello-world@0.1.0 start /home/david/src/lightbend/AkkaServerlessForJavaScript/exercises/hello-world
> node index.js

gRPC server started on 127.0.0.1:8080

Successful proxy startup should look something like this…

It seems like there is some network snafu happening. But I’m not a linux docker person so not sure. But the above should be close to what you see, upon successful start of the proxy.

1 Like

I wonder if it is that you bind the service to 127.0.0.1, at least if I look at our Java/Scala sample projects we do bind to 0.0.0.0, that could perhaps explain why the proxy docker container cannot access your user function.

With the JS/TS SDK it should be possible to do that by exporting HOST=0.0.0.0 before starting the user function.

1 Like

Ohh…that’s right! Great call @johanandren !

It has been a while since I’ve done something with JS/TS. If memory serves me well, that’s exactly it.

1 Like

Hello both, thank you very much.

After running with a HOST=0.0.0.0 npm run start I saw some new happy logs in the proxy, and my grpcurl command also produced an expected result.

I’ll proceed with my forays now, thank you!