services: nats: container_name: nats image: nats:latest restart: always networks: app-shared-net: aliases: - nats ports: - '4222:4222' # client connections - '8222:8222' # HTTP monitor / health command: - '--jetstream' - '--store_dir=/data' - '--max_payload=8MB' volumes: - nats_data:/data healthcheck: test: ['CMD-SHELL', 'wget --spider http://localhost:8222/healthz || exit 1'] interval: 15s timeout: 5s retries: 3 start_period: 10s volumes: nats_data: networks: app-shared-net: name: app-shared-net external: true