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

Consider using Bitnami image for replication #9

Open
D3f0 opened this issue Aug 23, 2022 · 1 comment
Open

Consider using Bitnami image for replication #9

D3f0 opened this issue Aug 23, 2022 · 1 comment

Comments

@D3f0
Copy link

D3f0 commented Aug 23, 2022

Hi, I found your repository looking for a way to make django test use read replicas.

I think a good addition could be to use the bitnami's pre-prepared replication based on environment variables as described in this gist

The code looks like:

services:
  postgresql:
    image: 'docker.io/bitnami/postgresql:13'
    ports:
      - '5432:5432'
    environment:
      - POSTGRESQL_PGAUDIT_LOG=READ,WRITE
      - POSTGRESQL_LOG_HOSTNAME=true
      - POSTGRESQL_REPLICATION_MODE=master
      - POSTGRESQL_REPLICATION_USER=repl_user
      - POSTGRESQL_REPLICATION_PASSWORD=repl_password
      - POSTGRESQL_USERNAME=postgres
      - POSTGRESQL_DATABASE=my_database
      - ALLOW_EMPTY_PASSWORD=yes
  replica:
    image: 'docker.io/bitnami/postgresql:13'
    ports:
      - '5433:5432'
    depends_on:
      - postgresql-primary
    environment:
      - POSTGRESQL_USERNAME=postgres
      - POSTGRESQL_PASSWORD=my_password
      - POSTGRESQL_MASTER_HOST=postgresql-primary
      - POSTGRESQL_PGAUDIT_LOG=READ,WRITE
      - POSTGRESQL_LOG_HOSTNAME=true
      - POSTGRESQL_REPLICATION_MODE=slave
      - POSTGRESQL_REPLICATION_USER=repl_user
      - POSTGRESQL_REPLICATION_PASSWORD=repl_password
      - POSTGRESQL_MASTER_PORT_NUMBER=5432

volumes:
  postgresql_master_data:
    driver: local
@caleb15
Copy link

caleb15 commented Aug 23, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants