Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added VictoriaMetrics cluster to demo-lab #105

Merged
merged 2 commits into from
Feb 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
121 changes: 121 additions & 0 deletions deploy/demo-lab/README.VM-CLUSTER.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
# pgSCV demo laboratory (use VictoriaMetrics cluster)

### Requirements

- Docker
- Docker Compose

### List of running containers and ports

- pgscv (listen port: 9890)
- grafana (listen port: 3000)
- vmagent-1 (listen port: 8429)
- vmagent-2 (listen port: 9429)
- vmauth (listen port: 8427)
- vmalert (listen port: 8880)
- alertmanager (listen port: 9093)
- vminsert-1 (listen port: 8480)
- vminsert-2 (listen port: 9480)
- vmselect-1
- vmselect-2
- vmstorage-1
- vmstorage-1
- postgres9 (listen port: 5429)
- postgres10 (listen port: 5430)
- postgres11 (listen port: 5431)
- postgres12 (listen port: 5432)
- postgres13 (listen port: 5433)
- postgres14 (listen port: 5434)
- postgres15 (listen port: 5435)
- postgres16 (listen port: 5436)
- postgres17 (listen port: 5437)
- postgres9replica1 (listen port: 4429)
- postgres9replica2 (cascade, listen port: 3429)
- postgres10replica1 (listen port: 4430)
- postgres11replica1 (listen port: 4431)
- postgres12replica1 (listen port: 4432)
- postgres13replica1 (listen port: 4433)
- postgres14replica1 (listen port: 4434)
- postgres15replica1 (listen port: 4435)
- postgres16replica1 (listen port: 4436)
- postgres17replica1 (listen port: 4437)
- postgres17replica2 (cascade, listen port: 3437)
- pgbouncer9 (listen port: 6429)
- pgbouncer10 (listen port: 6430)
- pgbouncer11 (listen port: 6431)
- pgbouncer12 (listen port: 6432)
- pgbouncer13 (listen port: 6433)
- pgbouncer14 (listen port: 6434)
- pgbouncer15 (listen port: 6435)
- pgbouncer16 (listen port: 6436)
- pgbouncer17 (listen port: 6437)
- etcd1
- etcd2
- etcd3
- patroni1 (listen port: 7432, 8008)
- patroni2 (listen port: 7433, 8009)
- patroni3 (listen port: 7434, 8010)
- haproxy (listen port: 5000, 5001)
- pgbench_9
- pgbench_10
- pgbench_11
- pgbench_12
- pgbench_13
- pgbench_14
- pgbench_15
- pgbench_16
- pgbench_17
- pgbench_patroni
- pgbench_patroni_s

A total of 50 containers are launched!

### Quick start

Prepare demo laboratory::

```bash
cat docker-compose.yml docker-compose.vm-cluster.yml compose.*.yml | grep device | awk -F' ' '{print $2}' | sed -e 's/${PWD}\///g' | xargs mkdir -p
cat docker-compose.yml docker-compose.vm-cluster.yml compose.*.yml | grep device | awk -F' ' '{print $2}' | sed -e 's/${PWD}\///g' | xargs chmod 777
```

Start demo laboratory:

```bash
docker-compose -f docker-compose.vm-cluster.yml up --detach
```

Start pgbench tests:

```bash
./start_pgbench.sh
```

Open Grafana into Web browser URL: <http://127.0.0.1:3000>

Login: admin

Password: admin

Open pgSCV dashboards, enjoy and drink coffee ;)

View pgSCV logs:

```bash
docker logs pgscv -f
```

### Stop demo laboratory and cleanup data

Stop pgbench tests:

```bash
./stop_pgbench.sh
```

Stop pgSCV demo laboratory and cleanup demo data:

```bash
docker-compose -f docker-compose.vm-cluster.yml down --volumes
./stop_and_cleanup_data.sh
```
8 changes: 4 additions & 4 deletions deploy/demo-lab/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,14 @@ A total of 40 containers are launched!
Prepare demo laboratory::

```bash
cat docker-compose.yml | grep device | awk -F' ' '{print $2}' | sed -e 's/${PWD}\///g' | xargs mkdir -p
cat docker-compose.yml | grep device | awk -F' ' '{print $2}' | sed -e 's/${PWD}\///g' | xargs chmod 777
cat docker-compose.yml docker-compose.vm-cluster.yml compose.*.yml | grep device | awk -F' ' '{print $2}' | sed -e 's/${PWD}\///g' | xargs mkdir -p
cat docker-compose.yml docker-compose.vm-cluster.yml compose.*.yml | grep device | awk -F' ' '{print $2}' | sed -e 's/${PWD}\///g' | xargs chmod 777
```

Start demo laboratory:

```bash
docker-compose up -d
docker-compose -f docker-compose.yml up --detach
```

Start pgbench tests:
Expand Down Expand Up @@ -107,6 +107,6 @@ Stop pgbench tests:
Stop pgSCV demo laboratory and cleanup demo data:

```bash
docker-compose down --volumes
docker-compose -f docker-compose.yml down --volumes
./stop_and_cleanup_data.sh
```
164 changes: 164 additions & 0 deletions deploy/demo-lab/compose.patroni.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
services:
etcd1: &etcd
image: cherts/patroni:latest
networks: [ monitoring ]
environment:
ETCD_LISTEN_PEER_URLS: http://0.0.0.0:2380
ETCD_LISTEN_CLIENT_URLS: http://0.0.0.0:2379
ETCD_INITIAL_CLUSTER: etcd1=http://etcd1:2380,etcd2=http://etcd2:2380,etcd3=http://etcd3:2380
ETCD_INITIAL_CLUSTER_STATE: new
ETCD_INITIAL_CLUSTER_TOKEN: tutorial
ETCD_UNSUPPORTED_ARCH: arm64
ETCD_DATA_DIR: "/var/lib/etcd"
container_name: etcd1
volumes:
- etc_data1:/var/lib/etcd
hostname: etcd1
command: etcd --name etcd1 --initial-advertise-peer-urls http://etcd1:2380
healthcheck:
test: ["CMD-SHELL", "etcdctl endpoint health"]
interval: 10s
timeout: 5s
retries: 5
start_period: 10s
etcd2:
<<: *etcd
container_name: etcd2
volumes:
- etc_data2:/var/lib/etcd
hostname: etcd2
command: etcd --name etcd2 --initial-advertise-peer-urls http://etcd2:2380
etcd3:
<<: *etcd
container_name: etcd3
volumes:
- etc_data3:/var/lib/etcd
hostname: etcd3
command: etcd --name etcd3 --initial-advertise-peer-urls http://etcd3:2380
haproxy:
container_name: haproxy
image: cherts/patroni:latest
networks: [ monitoring ]
env_file: ${PWD}/.env
hostname: haproxy
ports:
- "5000:5000"
- "5001:5001"
command: haproxy
environment: &haproxy_env
ETCDCTL_ENDPOINTS: http://etcd1:2379,http://etcd2:2379,http://etcd3:2379
PATRONI_ETCD3_HOSTS: "'etcd1:2379','etcd2:2379','etcd3:2379'"
PATRONI_SCOPE: cluster01
patroni1:
container_name: patroni1
image: cherts/patroni:latest
networks: [ monitoring ]
env_file: ${PWD}/.env
hostname: patroni1
ports:
- "8008:8008"
- "7432:5432"
volumes:
- patroni_data1:/home/postgres
environment:
<<: *haproxy_env
PATRONI_NAME: patroni1
depends_on:
- etcd1
- etcd2
- etcd3
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres -d postgres"]
interval: 30s
timeout: 5s
retries: 10
start_period: 10s
patroni2:
container_name: patroni2
image: cherts/patroni:latest
networks: [ monitoring ]
env_file: ${PWD}/.env
hostname: patroni2
ports:
- "8009:8008"
- "7433:5432"
volumes:
- patroni_data2:/home/postgres
environment:
<<: *haproxy_env
PATRONI_NAME: patroni2
depends_on:
- etcd1
- etcd2
- etcd3
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres -d postgres"]
interval: 30s
timeout: 5s
retries: 10
start_period: 10s
patroni3:
container_name: patroni3
image: cherts/patroni:latest
networks: [ monitoring ]
env_file: ${PWD}/.env
hostname: patroni3
ports:
- "8010:8008"
- "7434:5432"
volumes:
- patroni_data3:/home/postgres
environment:
<<: *haproxy_env
PATRONI_NAME: patroni3
depends_on:
- etcd1
- etcd2
- etcd3
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres -d postgres"]
interval: 30s
timeout: 5s
retries: 10
start_period: 10s

volumes:
patroni_data1:
driver: local
driver_opts:
o: bind
type: rw
device: ${PWD}/patroni/pg_data1
patroni_data2:
driver: local
driver_opts:
o: bind
type: rw
device: ${PWD}/patroni/pg_data2
patroni_data3:
driver: local
driver_opts:
o: bind
type: rw
device: ${PWD}/patroni/pg_data3
etc_data1:
driver: local
driver_opts:
o: bind
type: rw
device: ${PWD}/patroni/etc_data1
etc_data2:
driver: local
driver_opts:
o: bind
type: rw
device: ${PWD}/patroni/etc_data2
etc_data3:
driver: local
driver_opts:
o: bind
type: rw
device: ${PWD}/patroni/etc_data3

networks:
monitoring:
Loading