1

Pgbouncer 1.12.0 with rr patch I want the docker image with pgbouncer-rr patch, does any body previously did this and run in docker. please let me know and provide the solution to this issue.

  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – MD. RAKIB HASAN Dec 22 '21 at 09:00

1 Answers1

0

Sadly pgbouncer-rr doesn't use release tags at the moment, and furthermore they are quite behind on documenting which version of PgBouncer is the patch compatible with -- it appears to be 1.16.1 at the time of writing. (For future reference, pgbouncer-rr-patch is at commit 96d89db89).

This Dockerfile seems to work. It's based on CentOS 8 and uses a build stage in order to minimize the resulting image. Place a folder named config with the appropriate config files (pgbouncer.ini, users.txt, ...) alongside it.

Note that this will cease to work once pgbouncer-rr-patch updates to a newer version and drops support for 1.16.1, so it might be a good idea to add a git checkout 96d89db89 to freeze to the current patch version and update manually.

FROM centos:8 AS builder

RUN yum install -y \
        git \
        libevent-devel \
        libtool \
        make \
        openssl-devel \
        patch \
        python38-devel

RUN git clone --recurse-submodules --branch pgbouncer_1_16_1 https://github.com/pgbouncer/pgbouncer.git /opt/pgbouncer &&\
    git clone https://github.com/awslabs/pgbouncer-rr-patch.git /opt/pgbouncer-rr-patch &&\
    cd /opt/pgbouncer-rr-patch && ./install-pgbouncer-rr-patch.sh /opt/pgbouncer &&\
    cd /opt/pgbouncer && ./autogen.sh && ./configure && make && make install

FROM centos:8 AS pgbouncer

RUN yum install -y \
        libevent \
        python38-libs &&\
    yum -y clean all &&\
    rm -rf /var/cache

COPY --from=builder /usr/local/bin/pgbouncer /usr/local/bin/pgbouncer

RUN useradd pgbouncer

COPY --chown=pgbouncer:pgbouncer config /etc/pgbouncer-rr

USER pgbouncer

CMD ["/usr/local/bin/pgbouncer", "/etc/pgbouncer-rr/pgbouncer.ini"]
Jan Pokorný
  • 1,418
  • 15
  • 22