Skip to content

Commit

Permalink
Merge pull request #235 from dbist/postgresql-refactor
Browse files Browse the repository at this point in the history
refactor and upgrade to PG 16
  • Loading branch information
dbist authored Sep 21, 2023
2 parents 94af35d + 64a0aa5 commit 5133a5e
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 75 deletions.
82 changes: 15 additions & 67 deletions docker-compose-postgresql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,76 +2,10 @@ version: '3.9'

services:

roach-0:
container_name: roach-0
hostname: roach-0
image: cockroachdb/cockroach:latest-v22.2
command: start --insecure --join=roach-0,roach-1,roach-2 --listen-addr=roach-0:26257 --advertise-addr=roach-0:26257 --max-sql-memory=.25 --cache=.25
environment:
- 'ALLOW_EMPTY_PASSWORD=yes'

roach-1:
container_name: roach-1
hostname: roach-1
image: cockroachdb/cockroach:latest-v22.2
command: start --insecure --join=roach-0,roach-1,roach-2 --listen-addr=roach-1:26257 --advertise-addr=roach-1:26257 --max-sql-memory=.25 --cache=.25
environment:
- 'ALLOW_EMPTY_PASSWORD=yes'

roach-2:
container_name: roach-2
hostname: roach-2
image: cockroachdb/cockroach:latest-v22.2
command: start --insecure --join=roach-0,roach-1,roach-2 --listen-addr=roach-2:26257 --advertise-addr=roach-2:26257 --max-sql-memory=.25 --cache=.25
environment:
- 'ALLOW_EMPTY_PASSWORD=yes'

init:
container_name: init
image: cockroachdb/cockroach:latest-v22.2
command: init --host=roach-0 --insecure
depends_on:
- roach-0

lb:
container_name: lb
hostname: lb
build: haproxy
ports:
- "26257:26257"
- "8080:8080"
- "8081:8081"
depends_on:
- roach-0
- roach-1
- roach-2

client:
container_name: client
image: cockroachdb/cockroach:latest-v22.2
entrypoint: ["/usr/bin/tail", "-f", "/dev/null"]
hostname: client
depends_on:
- lb

postgresql:
container_name: postgresql
hostname: postgresql
build: postgresql/.
entrypoint: ["/usr/bin/tail", "-f", "/dev/null"]
environment:
- PGHOST=lb
- PGUSER=root
- PGPORT=26000
- PGDATABASE=example
- SCALE=10
depends_on:
- lb

flyway:
container_name: flyway
hostname: flyway
image: flyway/flyway:9.15.2
image: flyway/flyway
entrypoint: ["flyway", "migrate"]
volumes:
- ./postgresql/flyway/sql:/flyway/sql
Expand All @@ -84,3 +18,17 @@ services:
start_period: 10s
depends_on:
- lb

postgresql:
container_name: postgresql
hostname: postgresql
build: postgresql/.
entrypoint: ["/usr/bin/tail", "-f", "/dev/null"]
environment:
- PGHOST=lb
- PGUSER=root
- PGPORT=26000
- PGDATABASE=example
- SCALE=10
depends_on:
- lb
10 changes: 5 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,30 @@ services:
roach-0:
container_name: roach-0
hostname: roach-0
image: cockroachdb/cockroach:latest-v23.1
image: us-docker.pkg.dev/cockroach-cloud-images/cockroachdb/cockroach:v23.2.0-alpha.00000000-3468-g7cef593cfe1
command: start --insecure --join=roach-0,roach-1,roach-2 --listen-addr=roach-0:26257 --advertise-addr=roach-0:26257 --max-sql-memory=.25 --cache=.25
environment:
- 'ALLOW_EMPTY_PASSWORD=yes'

roach-1:
container_name: roach-1
hostname: roach-1
image: cockroachdb/cockroach:latest-v23.1
image: us-docker.pkg.dev/cockroach-cloud-images/cockroachdb/cockroach:v23.2.0-alpha.00000000-3468-g7cef593cfe1
command: start --insecure --join=roach-0,roach-1,roach-2 --listen-addr=roach-1:26257 --advertise-addr=roach-1:26257 --max-sql-memory=.25 --cache=.25
environment:
- 'ALLOW_EMPTY_PASSWORD=yes'

roach-2:
container_name: roach-2
hostname: roach-2
image: cockroachdb/cockroach:latest-v23.1
image: us-docker.pkg.dev/cockroach-cloud-images/cockroachdb/cockroach:v23.2.0-alpha.00000000-3468-g7cef593cfe1
command: start --insecure --join=roach-0,roach-1,roach-2 --listen-addr=roach-2:26257 --advertise-addr=roach-2:26257 --max-sql-memory=.25 --cache=.25
environment:
- 'ALLOW_EMPTY_PASSWORD=yes'

init:
container_name: init
image: cockroachdb/cockroach:latest-v23.1
image: us-docker.pkg.dev/cockroach-cloud-images/cockroachdb/cockroach:v23.2.0-alpha.00000000-3468-g7cef593cfe1
command: init --host=roach-0 --insecure
depends_on:
- roach-0
Expand All @@ -49,5 +49,5 @@ services:
client:
container_name: client
hostname: client
image: cockroachdb/cockroach:latest-v23.1
image: us-docker.pkg.dev/cockroach-cloud-images/cockroachdb/cockroach:v23.2.0-alpha.00000000-3468-g7cef593cfe1
entrypoint: ["/usr/bin/tail", "-f", "/dev/null"]
6 changes: 3 additions & 3 deletions postgresql/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
FROM postgres:15.1
FROM postgres

LABEL maintainer="artemervits at gmail dot com"
LABEL version="1.0"
LABEL version="1.1"
LABEL description="postgresql container"
ENV REFRESHED_AT 2023_04_17
ENV REFRESHED_AT 2023_09_21

COPY tpcb-original.sql .
COPY tpcb-cockroach.sql .

0 comments on commit 5133a5e

Please sign in to comment.