Install via Docker
If you install Docker, it is easy to run both NATS server and Resgate as containers:
docker network create res docker run -d --name nats -p 4222:4222 --net res nats docker run --name resgate -p 8080:8080 --net res resgateio/resgate --nats nats://nats:4222
Both images are small, less than 10 MB each.
Install release binary
Unzip the file. Inside the folder, there is a single command-line executable ready to run. That’s it!
Install from source
An alternative is to build the binaries yourself. First make sure you have:
- installed Go and set your
- optionally added
$GOPATH/bin(where compiled binaries are stored) to your
Download and build Resgate using
go get -u github.com/resgateio/resgate
To run Resgate with default settings:
When started successfully, it will connect to NATS on TCP port 4222 and output something like:
2006/01/02 15:04:05.786375 [INF] Starting resgate version 1.7.5 2006/01/02 15:04:05.869360 [INF] Connecting to NATS at nats://127.0.0.1:4222 2006/01/02 15:04:05.874344 [INF] Listening on http://0.0.0.0:8080 2006/01/02 15:04:05.875345 [INF] Server ready
If you get the following error:
Failed to connect to messaging system: nats: no servers available for connection
Then you either don’t have NATS server running, or Resgate is configured to connect to the wrong port.
For more options, read about Resgate configuration and usage.
Try out Resgate with one of the examples.
In production environments, Resgate should be restarted on failure.
Resgate is designed to exit with an error code if something goes wrong, and will recover once restarted. This can be done by using
Restart=on-failurein the systemd service configuration on Linux, or using the Docker restart policy,