2 years ago
Hello, This Postgres app do not build. Could you look into why? Thank you
ⓘ Deployment information is only viewable by project members and Railway employees.
35 Replies
2 years ago
Hello ? Please help !
2 years ago
Up please
2 years ago
I've set up another postgresql database (called Postgres-c4Vy) but I need to retrieve the data from the first database (called Postgres).
2 years ago
Yes, so many times…
2 years ago
Up please ! I also tried to rollback !
2 years ago
Postgres databases do not have a build step, please provide any errors you are getting.
2 years ago
I have no error, just Failed in deployments. No build logs, no deploy logs…
2 years ago
Yes. I really need the data inside…
2 years ago
I have set up an automatic backup for the new database. But the old one I hadn't done yet. There are the hours worked by my employees this month in it. Even if I can't recover the database. I'll just need the data to restore it in the new one.
2 years ago
I got the postgres-ssl dockerfile from railway and do railway up from my computer and I get these logs:
https://pastebin.com/7uatu6mz
Unfortunately, the logs are now stuck on “Publish time: 29.27 seconds”.
2 years ago
I'm including the files I used in this reply.
Dockerfile :
FROM postgres:latest
# Install OpenSSL and sudo
RUN apt-get update && apt-get install -y openssl sudo
# Allow the postgres user to execute certain commands as root without a password
RUN echo "postgres ALL=(root) NOPASSWD: /usr/bin/mkdir, /bin/chown" > /etc/sudoers.d/postgres
# Add init scripts
COPY init-ssl.sh /usr/local/bin/init-ssl.sh
COPY wrapper.sh /usr/local/bin/wrapper.sh
# Set permissions
RUN chmod +x /usr/local/bin/init-ssl.sh
RUN chmod +x /usr/local/bin/wrapper.sh
ENTRYPOINT ["wrapper.sh"]
CMD ["postgres", "--port=5432"]init-ssl.sh :
```
!/bin/bash
SSL_DIR="/var/lib/postgresql/data/certs"
Use sudo to create the directory as root
sudo mkdir -p "$SSL_DIR"
Use sudo to change ownership as root
sudo chown postgres:postgres "$SSL_DIR"
Generate Root CA
openssl req -new -x509 -days "${SSLCERTDAYS:-820}" -nodes -text -out "$SSLDIR/root.crt" -keyout "$SSLDIR/root.key" -subj "/CN=root-ca"
Generate Server Certificates
openssl req -new -nodes -text -out "$SSLDIR/server.csr" -keyout "$SSLDIR/server.key" -subj "/CN=localhost"
openssl x509 -req -in "$SSLDIR/server.csr" -text -out "$SSLDIR/server.crt" -CA "$SSLDIR/root.crt" -CAkey "$SSLDIR/root.key" -CAcreateserial -days "${SSLCERTDAYS:-820}"
chown postgres:postgres "$SSLDIR/server.key" chmod 600 "$SSLDIR/server.key"
PostgreSQL configuration
cat >> "$PGDATA/postgresql.conf" <
2 years ago
#!/bin/bash
SSL_DIR="/var/lib/postgresql/data/certs"
INIT_SSL_SCRIPT="/usr/local/bin/init-ssl.sh"
# Check if certificates need to be regenerated
if [ "$REGENERATE_CERTS" = "true" ] || [ ! -f "$SSL_DIR/server.key" ] || [ ! -f "$SSL_DIR/server.crt" ] || [ ! -f "$SSL_DIR/root.crt" ]; then
echo "Running init-ssl.sh to generate new certificates..."
bash "$INIT_SSL_SCRIPT"
else
echo "Certificates already exist and REGENERATE_CERTS is not set to true. Skipping certificate generation."
fi
# unset PGHOST to force psql to use Unix socket path
# this is specific to Railway and allows
# us to use PGHOST after the init
unset PGHOST
## unset PGPORT also specific to Railway
## since postgres checks for validity of
## the value in PGPORT we unset it in case
## it ends up being empty
unset PGPORT
# Call the entrypoint script with the
# approriate PGHOST & PGPORT
/usr/local/bin/docker-entrypoint.sh "$@"2 years ago
The issue could be a 100 different things you could have done to crash the database, I would have no straight forward way of telling you how to go about fixing it without having access to your project.
2 years ago
What if I invite you as a member of the app?
2 years ago
I think my volume 8db106fd-5bc5-43d6-8007-7553e0d8163f is corrupted and not mounted. That's why the Postgresql server won't start. Could someone at RailwayApp check this? It's certainly due to the bug from 4 days ago.
2 years ago
I'm sorry but Railway unfortunately wouldn't be able to help unless it was a platform issue, whatever you may have done to the database service and or volume would not be related to the previous outage.
If you would like to add me to your project I would be happy to take a look and do what I can to get your database back online, my email is brodyover@gmail.com
2 years ago
Hello brody, I've invited you as a member in the relevant application. Are you sure the bug doesn't originate from the platform? I hadn't touched anything in the application for a while when it bugged.
2 years ago
I'm sure, no one else has reported any such issues.
No promises on me fixing the database, but before I give it a try, please acknowledge that neither me nor Railway are responsible for any data loss.
2 years ago
The data is already lost anyway, so go ahead…
2 years ago
It may be safe to assume that, but we don't know for sure yet, will take a look at your project when I have the time!
2 years ago
Ok thank you
2 years ago
From looking at the project activity, the root cause of the postgres database failing was that you tried to upload code into the postgres service, then proceeded to miss-configure various other things on the database service.
2 years ago
Yes. Yesterday I tried to do railway up from a Rails app folder because I hadn't understood that railway up would do this. I thought it would make a kind of start. But the Postgres database had already crashed before that, and I hadn't done anything about it.
2 years ago
Please do not railway up into database services, this cements the fact that this was not a platform issue.
2 years ago
Ok, but even if I done railway up. Why the content of pgdata volume was erased ? It is not possible to recover it ?
2 years ago
The contents of the volume should have been in tact at that point, but after railway up you tried a bunch of things such as changing the PGDATA variable to incorrect values and swapping source images, so that definitely could have impacted the data negatively.
2 years ago
"could have" ? Is there a way to check ?
2 years ago
That's what I'm in the process of finding out, I will get back to you with a definitive answer.
2 years ago
Thank you !
2 years ago
holy shit, thank you very much !!!
2 years ago
No problem, in the future, please do not link to the database and run `railway up`
brody
No problem, in the future, please do not link to the database and run `railway up`
6 months ago
Hi Brody, I think i have made the same mistake. Would you be able to assist?