Secure CockroachDB Cluster, inspired by Docker tutorial
Simple 3 node secure CockroachDB cluster with HAProxy acting as load balancer
- UPDATED: 11/11/20
Prerequisites:
roach-0
- CockroachDB noderoach-1
- CockroachDB noderoach-2
- CockroachDB nodelb
- HAProxy acting as load balancerroach-cert
- Holds certificates as volume mounts
If you are using Google Chrome as your browser, you may want to navigate here
chrome://flags/#allow-insecure-localhost
and set this flag toEnabled
.
docker-compose run web django-admin startproject composeexample .
14:32 $ docker-compose run web django-admin startproject composeexample .
Starting roach-cert ... done
Starting roach-0 ... done
- because operation order is important, execute
./up.sh
instead ofdocker-compose up
- monitor the status of services via
docker-compose logs
- in case you need to adjust something in composexample/settings.py, you can
use
docker-compose logs web
,docker-compose kill web
,docker-compose up -d web
to debug and proceed.
- monitor the status of services via
- visit the CockroachDB Admin UI and login with username
test
and passwordpassword
- visit the HAProxy UI
docker exec -ti roach-0 /bin/bash
docker exec -ti roach-1 /bin/bash
docker exec -ti roach-2 /bin/bash
docker exec -ti lb /bin/sh
# shell
docker exec -ti roach-cert /bin/sh
# cli inside the container
cockroach sql --certs-dir=/certs --host=roach-0
# directly
docker exec -ti roach-0 cockroach sql --certs-dir=/certs --host=roach-0