Skip to content

Commit 3bf2723

Browse files
fix: postgres container locale (#438)
1 parent 5a98d20 commit 3bf2723

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

docker-compose-indexer.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ services:
5353
DB_SECRET: ${DB_SECRET}
5454
DB_USER: ${DB_USER}
5555
DB_NAME: ${DB_NAME}
56+
DB_PORT: ${DB_PORT}
5657
NETWORK: ${NETWORK}
5758
PGPASSWORD: postgres
5859

@@ -79,7 +80,7 @@ services:
7980
volumes:
8081
- ${DB_PATH}:/var/lib/postgresql/data
8182
healthcheck:
82-
test: [ "CMD-SHELL", "pg_isready -U ${DB_USER} -d ${DB_NAME} -p ${DB_PORT} -h localhost"]
83+
test: [ "CMD-SHELL", "PGPASSWORD=${DB_SECRET} pg_isready -U ${DB_USER} -d ${DB_NAME} -p ${DB_PORT} -h localhost"]
8384
interval: 10s
8485
timeout: 3s
8586
retries: 10

docker/dockerfiles/postgres/Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ RUN apt update && apt install -y \
1010
git \
1111
ca-certificates \
1212
sudo \
13+
locales \
14+
&& sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen \
15+
&& locale-gen \
16+
&& update-locale LANG=en_US.UTF-8 \
1317
&& apt clean
1418

1519
ENV PG_VERSION_TAG=REL_14_11

docker/dockerfiles/postgres/entrypoint.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,13 @@ configure_postgres() {
8484
fi
8585
done
8686

87-
echo "host all all 0.0.0.0/0 md5" \
88-
>> $PG_DATA/pg_hba.conf
87+
if ! grep -q "^host all all 0.0.0.0/0 md5\$" "$PG_DATA/pg_hba.conf"; then
88+
echo "host all all 0.0.0.0/0 md5" >> "$PG_DATA/pg_hba.conf"
89+
fi
8990

90-
echo "listen_addresses='*'" \
91-
>> $PG_DATA/postgresql.conf
91+
if ! grep -q "^listen_addresses *= *'\*'\$" "$PG_DATA/postgresql.conf"; then
92+
echo "listen_addresses='*'" >> "$PG_DATA/postgresql.conf"
93+
fi
9294

9395
echo "PostgreSQL configuration updated successfully!"
9496
}

0 commit comments

Comments
 (0)