Skip to content

Instantly share code, notes, and snippets.

@lucj
Created July 31, 2020 16:28
Show Gist options
  • Save lucj/887ca57e24a3a486258fac56d90e9926 to your computer and use it in GitHub Desktop.
Save lucj/887ca57e24a3a486258fac56d90e9926 to your computer and use it in GitHub Desktop.
gateway {
name: "EXTERNAL"
listen: "0.0.0.0:7222"
authorization {
user: gwu
password: gwp
}
gateways: [
{name: "INTERNAL", url: "nats://gwu:gwp@internal1:7222"},
{name: "INTERNAL", url: "nats://gwu:gwp@internal2:7222"}
]
}
gateway {
name: "INTERNAL"
listen: "0.0.0.0:7222"
authorization {
user: gwu
password: gwp
}
gateways: [
{name: "EXTERNAL", url: "nats://gwu:gwp@external1:7222"}
{name: "EXTERNAL", url: "nats://gwu:gwp@external2:7222"}
]
}
version: '3'
services:
external1: &external
image: nats
command: >-
--tlscert /etc/nats/tls/mq.pem
--tlskey /etc/nats/tls/mq.key
--tlscacert /etc/nats/tls/ca.pem
--client_advertise mq1.example.net:4222
--cluster nats://0.0.0.0:6222
--routes nats://external1:6222,nats://external2:6222
--config /etc/nats/external.conf
networks:
- external
- shared
volumes:
- "./tls:/etc/nats/tls"
- "./conf/external.conf:/etc/nats/external.conf"
ports:
- 4222:4222
external2:
<<: *external
command: >-
--tlscert /etc/nats/tls/mq.pem
--tlskey /etc/nats/tls/mq.key
--tlscacert /etc/nats/tls/ca.pem
--client_advertise mq2.example.net:4223
--cluster nats://0.0.0.0:6222
--routes nats://external1:6222,nats://external2:6222
--config /etc/nats/external.conf
ports:
- 4223:4222
internal1: &internal
image: nats
command: >-
--cluster nats://0.0.0.0:6222
--routes nats://internal1:6222,nats://internal2:6222
--config /etc/nats/internal.conf
networks:
- shared
volumes:
- "./conf/internal.conf:/etc/nats/internal.conf"
ports:
- 4322:4222
internal2:
<<: *internal
ports:
- 4323:4222
networks:
shared: {}
external: {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment