nats-io / nats-docker

Official Docker image for the NATS server
Apache License 2.0
135 stars 47 forks source link

Problem running NATS service in GitHub Actions #169

Open diogobaeder opened 4 months ago

diogobaeder commented 4 months ago

Hi folks,

I'm trying to run NATS as a service in GitHub Actions, but I can't get it to run correctly somehow. Here's how I'm running it, with a few health check options that I added after I noticed that the service was unreachable:

      nats:
        image: nats
        options: >-
          --health-cmd "nats account info"
          --health-interval 2s
          --health-timeout 2s
          --health-retries 2
        ports:
          - 4222:4222
          - 6222:6222
          - 8222:8222

Does anyone spot anything wrong with the block above? Even if I leave out the health check, I just can't access it using hostname nats, and with the health check it just fails hard when spawning the container.

Thanks!

lneoe commented 2 months ago

I encountered the same problem too, part of my workflow config was

jobs:
  test:
    runs-on: ubuntu-latest
    service:
      jetstream:
        image: nats

I can see the server start log in action log, but I can't connect nats server with nats://jetstream:4222, my program panic with test panicked: dial tcp: lookup jetstream on 127.0.0.53:53: server misbehaving

   [1] 2024/09/25 14:20:35.906689 [INF] Starting nats-server
   [1] 2024/09/25 14:20:35.906893 [INF]   Version:  2.10.20
   [1] 2024/09/25 14:20:35.906923 [INF]   Git:      [7140387]
   [1] 2024/09/25 14:20:35.906963 [INF]   Cluster:  my_cluster
   [1] 2024/09/25 14:20:35.906991 [INF]   Name:     NCQCY5SLGQJ5KGAB5TF5L55NSCWZPVQSHMK2WGIVPI6RDIWFHEEH32DP
   [1] 2024/09/25 14:20:35.907009 [INF]   ID:       NCQCY5SLGQJ5KGAB5TF5L55NSCWZPVQSHMK2WGIVPI6RDIWFHEEH32DP
   [1] 2024/09/25 14:20:35.907037 [INF] Using configuration file: nats-server.conf
   [1] 2024/09/25 14:20:35.907997 [INF] Starting http monitor on 0.0.0.0:8222
   [1] 2024/09/25 14:20:35.908361 [INF] Listening for client connections on 0.0.0.0:4222
   [1] 2024/09/25 14:20:35.908609 [INF] Server is ready
   [1] 2024/09/25 14:20:35.908723 [INF] Cluster name is my_cluster
   [1] 2024/09/25 14:20:35.908948 [INF] Listening for route connections on 0.0.0.0:6222