router-docker-compose
router-docker-compose copied to clipboard
Production-ready docker-compose for Connext routers.
Router Docker Compose
Production-ready docker-compose for Connext routers.
Router Setup Using docker-compose
Requirements
- Docker CE (Community Edition) version 20.10.5 or higher
- Docker Compose version 1.27.4 or higher
Run docker-compose Stack
- Clone repo
cd ~
git clone https://github.com/connext/router-docker-compose.git
cd ~/router-docker-compose
- Rename file
.env.exampleto.envand modify it. You need to set the following environment variables:
ROUTER_VERSION- version to use, get router version from either https://github.com/connext/nxtp/pkgs/container/router-publisher or#amarok-routerschannel in DiscordGRAFANA_PASSWORD- your password for GrafanaLOGDNA_KEY- LogDNA key, you need to register in Mezmo App and get it from there. You can optionally setLOGDNA_TAGas wellUSERID- if you use docker rootless, then it should be ID of your user e.g. 1001.*_VERSION- you can optionally set docker container versions of other apps
-
Modify
data/alertmanagerConfig/alertmanager.ymlfile and set alert notifications to Mail, Slack, Discord, Telegram, Pagerduty, Opsgenie, etc. Additional configuration might be required. -
Create NXTP configuration file
~/router-docker-compose/config.json, it will be mounted into router container. See Connext Configuration docs for configuration description. You can useconfig.example.mainnet.jsonorconfig.example.testnet.jsonas an example. -
(Optional) Create external Redis instance and insert URL into
redisUrlin config. (currently the docker-compose file includes redis container as well). If you want to use highly available RabbitMQ service - you can spin up it as well and updateconfig.jsonas well. -
(Optional) Follow security best practices from Connext Security docs
-
(Optional) Use docker rootless configuration for better security. Just use
docker-compose-rootless.ymlinstead ofdocker-compose.ymland follow Docker Rootless Guide to enable it. -
(Optional) Edit
docker-compose.ymlto enable port forwarding for Router services and/or Prometheus/Alertmanager. It's disabled by default for security reasons. Do NOT expose these port to public networks, otherwise use proven authentication methods. -
Rename file
key.example.yamltokey.yamland modify it. Web3Signer yaml key file~/router-docker-compose/key.yamlwill be mounted into the signer container. This example file uses raw unencrypted files method. See Web3Signer docs. And for more custom commands of web3signer, edit~/router-docker-compose/data/signerConfig/config.yaml. Refer Web3Signer Command docs -
Create docker-compose services, volumes and network.
docker-compose create
- Run docker-compose stack.
docker-compose up -d
- Check the status.
docker-compose ps
OR
docker ps -a
- Check logs to ensure router started successfully
docker-compose logs router-publisher | tail -n 200| grep 'Router publisher boot complete!'
docker-compose logs router-subscriber | tail -n 200| grep 'Router subscriber boot complete!'
- Check the full logs if needed
docker-compose logs
OR
docker-compose logs router-publisher
docker-compose logs router-subscriber
You can also use these commands.
docker logs router-publisher
docker logs router-subscriber
Other Tasks
Stop and delete containers.
docker-compose down
Delete data
docker-compose down -v
Restart Stack
docker-compose restart
Update Version
- Modify
.envto changeROUTER_VERSION - Update stack
docker-compose pull
docker-compose up -d
Infrastructure model
