Install Centrifugo
Centrifugo server is written in Go language. It's an open-source software, the source code is available on Github.
Install from the binary release
For a local development the simplest way to get Centrifugo is from binary release (i.e. single all-contained executable file).
Binary releases available on Github. Download latest release for your operating system, unpack it and you are done. Centrifugo is pre-built for:
- Linux 64-bit (linux_amd64)
- Linux 32-bit (linux_386)
- Linux ARM 64-bit (linux_arm64)
- MacOS (darwin_amd64)
- MacOS on Apple Silicon (darwin_arm64)
- Windows (windows_amd64)
- FreeBSD (freebsd_amd64)
- ARM v6 (linux_armv6)
Archives contain a single statically compiled binary centrifugo
file that is ready to run:
./centrifugo -h
See the version of Centrifugo:
./centrifugo version
Centrifugo requires a configuration file with several secret keys. If you are new to Centrifugo then there is genconfig
command which generates a minimal configuration file to get started:
./centrifugo genconfig
It creates a configuration file config.json
with some auto-generated option values in a current directory (by default).
It's possible to generate file in YAML or TOML format, i.e. ./centrifugo genconfig -c config.toml
Having a configuration file you can finally run Centrifugo instance:
./centrifugo --config=config.json
We will talk about a configuration in detail in the next sections.
You can also put or symlink centrifugo
into your bin
OS directory and run it from anywhere:
centrifugo --config=config.json
Docker image
Centrifugo server has a docker image available on Docker Hub.
docker pull centrifugo/centrifugo
Run:
docker run --ulimit nofile=65536:65536 -v /host/dir/with/config/file:/centrifugo -p 8000:8000 centrifugo/centrifugo centrifugo -c config.json
Note that docker allows setting nofile
limits in command-line arguments which is pretty important to handle lots of simultaneous persistent connections and not run out of open file limit (each connection requires one file descriptor). See also infrastructure tuning chapter.
Pin to the exact Docker Image tag in production, for example: centrifugo/centrifugo:v3.0.0
, this will help to avoid unexpected problems during re-deploy process.