Skip to content
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
40 changes: 20 additions & 20 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# target version of Postgres. In the Makefile, we use that to our advantage
# and tag test images such as pg_auto_failover_test:pg14.
#
ARG PGVERSION=14
ARG PGVERSION=17

#
# Define a base image with all our build dependencies.
Expand All @@ -18,18 +18,18 @@ RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
build-essential \
ca-certificates \
curl \
gnupg \
git \
gawk \
flex \
bison \
curl \
gnupg \
git \
gawk \
flex \
bison \
iproute2 \
libcurl4-gnutls-dev \
libicu-dev \
libncurses-dev \
libxml2-dev \
zlib1g-dev \
libcurl4-gnutls-dev \
libicu-dev \
libncurses-dev \
libxml2-dev \
zlib1g-dev \
libedit-dev \
libkrb5-dev \
liblz4-dev \
Expand All @@ -41,27 +41,27 @@ RUN apt-get update \
libxslt1-dev \
libzstd-dev \
uuid-dev \
make \
autoconf \
make \
autoconf \
openssl \
pipenv \
python3-nose \
python3 \
python3-setuptools \
python3-psycopg2 \
python3-setuptools \
python3-psycopg2 \
python3-pip \
sudo \
sudo \
tmux \
watch \
lsof \
psutils \
psmisc \
htop \
less \
mg \
mg \
valgrind \
postgresql-common \
&& rm -rf /var/lib/apt/lists/*
&& rm -rf /var/lib/apt/lists/*

RUN curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
RUN echo "deb http://apt.postgresql.org/pub/repos/apt bullseye-pgdg main ${PGVERSION}" > /etc/apt/sources.list.d/pgdg.list
Expand All @@ -84,7 +84,7 @@ RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
FROM base AS citus

ARG PGVERSION
ARG CITUSTAG=v11.1.2
ARG CITUSTAG=v13.0.1

ENV PG_CONFIG=/usr/lib/postgresql/${PGVERSION}/bin/pg_config

Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ CLUSTER_OPTS = ""
# XXXX This should be in Makefile.citus only
# but requires to clean up dockerfile and make targets related to citus first.
# Default Citus Data version
CITUSTAG ?= v13.0.0
CITUSTAG ?= v13.0.1

# TODO should be abs_top_dir ?
TOP := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
Expand Down Expand Up @@ -273,8 +273,8 @@ endif

# We use pg not PG in uppercase in the var name to ease implicit rules matching
BUILD_ARGS_pg13 = --build-arg PGVERSION=13 --build-arg CITUSTAG=v10.2.9
BUILD_ARGS_pg14 = --build-arg PGVERSION=14 --build-arg CITUSTAG=$(CITUSTAG)
BUILD_ARGS_pg15 = --build-arg PGVERSION=15 --build-arg CITUSTAG=$(CITUSTAG)
BUILD_ARGS_pg14 = --build-arg PGVERSION=14 --build-arg CITUSTAG=v12.1.5
BUILD_ARGS_pg15 = --build-arg PGVERSION=15 --build-arg CITUSTAG=v12.1.5
BUILD_ARGS_pg16 = --build-arg PGVERSION=16 --build-arg CITUSTAG=$(CITUSTAG)
BUILD_ARGS_pg17 = --build-arg PGVERSION=17 --build-arg CITUSTAG=$(CITUSTAG)

Expand Down
2 changes: 1 addition & 1 deletion Makefile.citus
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Default Citus Data version
CITUSTAG ?= v13.0.0
CITUSTAG ?= v13.0.1

# Citus testing
CITUS = 0
Expand Down
66 changes: 46 additions & 20 deletions src/bin/pg_autoctl/cli_do_tmux_compose.c
Original file line number Diff line number Diff line change
Expand Up @@ -252,10 +252,6 @@ tmux_compose_add_volume(PQExpBuffer script, const char *name)
static void
prepare_tmux_compose_config(TmuxOptions *options, PQExpBuffer script)
{
/* that's optional, but we still fill it as an header of sorts */
appendPQExpBuffer(script, "version: \"3.9\"\n");
appendPQExpBuffer(script, "\n");

appendPQExpBuffer(script, "services:\n");

/* first, the monitor */
Expand Down Expand Up @@ -348,16 +344,17 @@ tmux_compose_docker_build(TmuxOptions *options)

log_info("docker compose build");

char dockerCompose[MAXPGPATH] = { 0 };
char docker[MAXPGPATH] = { 0 };

if (!search_path_first("docker", dockerCompose, LOG_ERROR))
if (!search_path_first("docker", docker, LOG_ERROR))
{
log_fatal("Failed to find program docker compose in PATH");
log_fatal("Failed to find program docker in PATH");
exit(EXIT_CODE_INTERNAL_ERROR);
}

char pgversion[5] = { 0 };
char pgversionArg[15] = { 0 };
char citustagArg[20] = { 0 };

if (env_exists("PGVERSION"))
{
Expand All @@ -373,16 +370,53 @@ tmux_compose_docker_build(TmuxOptions *options)
strlcpy(pgversion, "14", sizeof(pgversion));
}

/* prepare Postgres/Citus compatibility matrix */
char *pgCitusMatrix[18] = { 0 };
pgCitusMatrix[13] = "v10.2.9";
pgCitusMatrix[14] = "v12.1.5";
pgCitusMatrix[15] = "v12.1.5";
pgCitusMatrix[16] = "v13.0.1";
pgCitusMatrix[17] = "v13.0.1";

int pgVersionNum;
char *citustag = NULL;

if (!stringToInt(pgversion, &pgVersionNum))
{
log_error("Failed to parse PGVERSION \"%s\" into an int", pgversion);
exit(EXIT_CODE_INTERNAL_ERROR);
}

if (pgVersionNum > 12 && pgVersionNum < 18)
{
citustag = pgCitusMatrix[pgVersionNum];
}
else
{
log_fatal("Unsupported PGVERSION=%s", pgversion);
exit(EXIT_CODE_INTERNAL_ERROR);
}

if (citustag == NULL)
{
log_fatal("Unknown CITUSTAG for PGVERSION=%s", pgversion);
exit(EXIT_CODE_INTERNAL_ERROR);
}

/* prepare our --build-arg PGVERSION=XX */
sformat(pgversionArg, sizeof(pgversionArg), "PGVERSION=%s", pgversion);
sformat(citustagArg, sizeof(citustagArg), "CITUSTAG=%s", citustag);

char *args[16];
int argsIndex = 0;

args[argsIndex++] = (char *) dockerCompose;
args[argsIndex++] = (char *) docker;
args[argsIndex++] = "compose";
args[argsIndex++] = "build";
args[argsIndex++] = "--build-arg";
args[argsIndex++] = (char *) pgversionArg;
args[argsIndex++] = "--build-arg";
args[argsIndex++] = (char *) citustagArg;
args[argsIndex++] = "--quiet";
args[argsIndex] = NULL;

Expand Down Expand Up @@ -519,19 +553,19 @@ tmux_compose_rm_volume(const char *docker, const char *nodeName)
static bool
tmux_compose_down(TmuxOptions *options)
{
char dockerCompose[MAXPGPATH] = { 0 };
char docker[MAXPGPATH] = { 0 };

if (!search_path_first("docker", dockerCompose, LOG_ERROR))
if (!search_path_first("docker", docker, LOG_ERROR))
{
log_fatal("Failed to find program docker compose in PATH");
log_fatal("Failed to find program docker in PATH");
return false;
}

/* first docker compose down */
log_info("docker compose down");

Program program =
run_program(dockerCompose, "down",
run_program(docker, "compose", "down",
"--volumes", "--remove-orphans", NULL);

if (program.returnCode != 0)
Expand All @@ -552,14 +586,6 @@ tmux_compose_down(TmuxOptions *options)
/*
* Now remove all the docker volumes
*/
char docker[MAXPGPATH] = { 0 };

if (!search_path_first("docker", docker, LOG_ERROR))
{
log_fatal("Failed to find program docker in PATH");
return false;
}

(void) tmux_compose_rm_volume(docker, "monitor");

for (int i = 0; i < tmuxNodeArray.count; i++)
Expand Down