R
Railway8mo ago
Paco

add custom postgres extension

#
# NOTE: THIS DOCKERFILE IS GENERATED VIA "make update"! PLEASE DO NOT EDIT IT DIRECTLY.
#

FROM postgres:16-bullseye


ENV POSTGIS_MAJOR 3
ENV POSTGIS_VERSION 3.4.0+dfsg-1.pgdg110+1
ARG POSTGRES_PASSWORD
ARG POSTGRES_USER
ARG POSTGRES_MULTIPLE_DATABASES

RUN apt-get update \
&& apt-cache showpkg postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR \
&& apt-get install -y --no-install-recommends \
# ca-certificates: for accessing remote raster files;
# fix: https://github.com/postgis/docker-postgis/issues/307
ca-certificates \
\
postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR=$POSTGIS_VERSION \
postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR-scripts \
openssl \
sudo \
&& rm -rf /var/lib/apt/lists/*
RUN echo "postgres ALL=(root) NOPASSWD: /usr/bin/mkdir, /bin/chown," > /etc/sudoers.d/postgres

RUN mkdir -p /docker-entrypoint-initdb.d
COPY init-ssl.sh /docker-entrypoint-initdb.d/
COPY ./initdb-postgis.sh /docker-entrypoint-initdb.d/10_postgis.sh
COPY ./update-postgis.sh /usr/local/bin

RUN chmod +x /docker-entrypoint-initdb.d/init-ssl.sh

CMD ["postgres", "--port=5432"]
#
# NOTE: THIS DOCKERFILE IS GENERATED VIA "make update"! PLEASE DO NOT EDIT IT DIRECTLY.
#

FROM postgres:16-bullseye


ENV POSTGIS_MAJOR 3
ENV POSTGIS_VERSION 3.4.0+dfsg-1.pgdg110+1
ARG POSTGRES_PASSWORD
ARG POSTGRES_USER
ARG POSTGRES_MULTIPLE_DATABASES

RUN apt-get update \
&& apt-cache showpkg postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR \
&& apt-get install -y --no-install-recommends \
# ca-certificates: for accessing remote raster files;
# fix: https://github.com/postgis/docker-postgis/issues/307
ca-certificates \
\
postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR=$POSTGIS_VERSION \
postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR-scripts \
openssl \
sudo \
&& rm -rf /var/lib/apt/lists/*
RUN echo "postgres ALL=(root) NOPASSWD: /usr/bin/mkdir, /bin/chown," > /etc/sudoers.d/postgres

RUN mkdir -p /docker-entrypoint-initdb.d
COPY init-ssl.sh /docker-entrypoint-initdb.d/
COPY ./initdb-postgis.sh /docker-entrypoint-initdb.d/10_postgis.sh
COPY ./update-postgis.sh /usr/local/bin

RUN chmod +x /docker-entrypoint-initdb.d/init-ssl.sh

CMD ["postgres", "--port=5432"]
projet ID 7d848712-e466-4b02-914d-c4d912112009 Hi, I'd like to make a custom image of Postgres. I will to add postgis extension. But with the custom image, postgres15-bulleye I can't run the ssl script I see with @Angelo, and he asked me to make a ticket. I've attached my dockerfile
41 Replies
Percy
Percy8mo ago
Project ID: 7d848712-e466-4b02-914d-c4d912112009
angelo
angelo8mo ago
👋
Paco
Paco8mo ago
hey @Angelo I fixed scripts, I deleted sudo but now I got "LOG: invalid length of startup packet" when I want to connect. As startup, I got this error : "initdb: warning: enabling "trust" authentication for local connections" " In local env, it's worked, I think it's a problem with the proxy ok, I restarted the proxy and it's worked ! But bcs I'm in EU I got 7000ms... :/ It's not really usable cc @Angelo
Brody
Brody8mo ago
uh thats 7 seconds, do you perhaps mean 700ms (0.7s)? either way, youre pro so just relocate the database to the EU region?
Paco
Paco8mo ago
hello @Brody yes 7 seconds 🙂 4811ms rn. The problem I can't move the disk to EU...
No description
Brody
Brody8mo ago
why can't you?
Paco
Paco8mo ago
doesn't worked
Brody
Brody8mo ago
explain?
Paco
Paco8mo ago
Always failed
Brody
Brody8mo ago
?
Paco
Paco8mo ago
I just have a error, disk migration failed contact support
Brody
Brody8mo ago
have you contacted support?
Paco
Paco8mo ago
Nope because I have a call with Angelo who's said it's not worked 100% actually (if I understand) if you want I can try rn
Brody
Brody8mo ago
well if Angelo says its not working then that's good enough for me he does know all
Paco
Paco8mo ago
ahah ! he said if I really understood, when it works he'll ping me
Brody
Brody8mo ago
sounds good
Paco
Paco8mo ago
you cannot move my disk manually ?
Brody
Brody8mo ago
considering I don't work for railway, no I can't 🤣
Paco
Paco8mo ago
AHHH XD 🤣 #🚅|priority-boarding I talked about it here @Brody
Brody
Brody8mo ago
👍
Paco
Paco8mo ago
ok to be sure it's not ok, I migrate the disk, he is succesfull but I got this error idk why
No description
Brody
Brody8mo ago
just wait for an update from the team please
angelo
angelo8mo ago
So you will need to make a new disk within a region, and then mount it
Paco
Paco8mo ago
It's worked @Angelo but I got 2253ms...
No description
Paco
Paco8mo ago
disk and server are in Eu proxy is in usa?
Brody
Brody8mo ago
please dont tag the team #🛂|readme #5 there are edge proxys in all the same regions as there are railway regions are you using some vpn service or something?
Paco
Paco8mo ago
no
Brody
Brody8mo ago
do you get the same connection time with a stock database?
Paco
Paco8mo ago
I will test
Paco
Paco8mo ago
I tried with stock database, It's not really good
No description
Brody
Brody8mo ago
this is a connection attempt, it is usually only made once, do some querying and see how long they take
Paco
Paco8mo ago
hello, I will connect my api on my database with prisma, In my build in my docker I will execute my migrations
RUN bun run migrate deploy
RUN bun run migrate deploy
I set in arg my database url : postgres://username:password@postgres.railway.internal:5432/api-auth But it doesn't work I got this error
1.933 Error: P1001: Can't reach database server at `postgres.railway.internal`:`5432`
1.933 Error: P1001: Can't reach database server at `postgres.railway.internal`:`5432`
Brody
Brody8mo ago
the private network is not available during build
Paco
Paco8mo ago
ok so now I do this and it's didn't worked too
No description
Paco
Paco8mo ago
how can I do migration as launch
Brody
Brody8mo ago
you definitely can't access the private network from your local computer, if you want to run a migration from your local computer or during the build on railway you would need to use the public tcp proxy domain, if you want to use the private domain to run a migration then you would need to do it during runtime before your app starts
Paco
Paco8mo ago
how can I do before the app start ?
Brody
Brody8mo ago
in your start command
Paco
Paco8mo ago
can I do a && in start command ?
Brody
Brody8mo ago
yes
Paco
Paco8mo ago
ok I try