Skip to content
This repository has been archived by the owner on Jan 6, 2023. It is now read-only.

Latest commit

 

History

History
40 lines (32 loc) · 1.38 KB

File metadata and controls

40 lines (32 loc) · 1.38 KB

Secure CockroachDB Cluster

Simple 3 node secure CockroachDB cluster with NGINX acting as load balancer

todo: remove ip's from this example

Services

  • roach-0 - CockroachDB node
  • roach-1 - CockroachDB node
  • roach-2 - CockroachDB node
  • lb - NGINX acting as load balancer
  • roach-cert - Holds certificates as volume mounts

Getting started

If you are using Google Chrome as your browser, you may want to navigate here chrome://flags/#allow-insecure-localhost and set this flag to Enabled.

  1. because operation order is important, execute ./up.sh instead of docker-compose up
  2. visit the CockroachDB UI @ https://localhost:8080 and login with username test and password password
  3. have fun!

Helpful Commands

Create User

The following creates a user called test with password password. This can be used to login to the CockroachDB UI.

docker-compose exec roach-0 /cockroach/cockroach sql --certs-dir=/certs --host=roach-0 --execute="CREATE USER test WITH PASSWORD 'password';"

Create Database

The following creates a database called test.

docker-compose exec roach-0 /cockroach/cockroach sql --certs-dir=/certs --host=roach-0 --execute="CREATE DATABASE test;"

Open Interactive Shells

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