Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c20221d

Browse files
committed
chore - check local in setup
1 parent 52e0866 commit c20221d

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

Dockerfile

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ RUN apt-get update && apt-get install -y \
3232
ca-certificates \
3333
wget \
3434
netcat \
35+
postgresql-client \
3536
&& rm -rf /var/lib/apt/lists/*
3637

3738
# Install IPFS
@@ -47,8 +48,6 @@ COPY --from=builder /usr/src/graph-node/target/release/graph-node /usr/local/bin
4748

4849
# Set environment variables
4950
ENV RUST_LOG=info
50-
ENV PGDATA="/var/lib/postgresql/data"
51-
ENV POSTGRES_INITDB_ARGS="-E UTF8 --locale=C"
5251

5352
# Expose necessary ports
5453
EXPOSE 8000 8001 8030 5001
@@ -57,6 +56,16 @@ EXPOSE 8000 8001 8030 5001
5756
RUN echo '#!/bin/bash\n\
5857
set -e\n\
5958
\n\
59+
echo "Checking database locale..."\n\
60+
DB_LOCALE=$(psql -tAc "SHOW lc_collate;" $POSTGRES_URL)\n\
61+
if [ "$DB_LOCALE" != "C" ]; then\n\
62+
echo "Database locale is not C. Attempting to modify..."\n\
63+
psql $POSTGRES_URL << EOF\n\
64+
UPDATE pg_database SET datcollate="C", datctype="C" WHERE datname="railway";\n\
65+
EOF\n\
66+
echo "Database locale updated. Please restart the database for changes to take effect."\n\
67+
fi\n\
68+
\n\
6069
echo "Initializing IPFS..."\n\
6170
if [ ! -f /root/.ipfs/config ]; then\n\
6271
ipfs init\n\

0 commit comments

Comments
 (0)