R
Railway10mo ago
deathx02

I am getting postgres 16 Issue

#8 30.90 error: collision between /nix/store/cpmgrq24rjqf415q3m4a5mlg9fw5x9r0-postgresql-16.0/lib/libpgport.a' and /nix/store/frsl3935sgp53hdgmmknhbl33d4fb7nn-postgresql-14.9/lib/libpgport.a' #8 ERROR: process "/bin/bash -ol pipefail -c nix-env -if .nixpacks/nixpkgs-5148520bfab61f99fd25fb9ff7bfbb50dad3c9db.nix && nix-collect-garbage -d" did not complete successfully: exit code: 100 ----- 30.90 error: collision between /nix/store/cpmgrq24rjqf415q3m4a5mlg9fw5x9r0-postgresql-16.0/lib/libpgport.a' and /nix/store/frsl3935sgp53hdgmmknhbl33d4fb7nn-postgresql-14.9/lib/libpgport.a' 30.97 error: builder for '/nix/store/h1y4fdw7n62z5gq939nyqn2nz4lxhk34-5148520bfab61f99fd25fb9ff7bfbb50dad3c9db-env.drv' failed with exit code 25 ----- Dockerfile:8 ------------------- 6 | 7 | COPY .nixpacks/nixpkgs-5148520bfab61f99fd25fb9ff7bfbb50dad3c9db.nix .nixpacks/nixpkgs-5148520bfab61f99fd25fb9ff7bfbb50dad3c9db.nix 8 | >>> RUN nix-env -if .nixpacks/nixpkgs-5148520bfab61f99fd25fb9ff7bfbb50dad3c9db.nix && nix-collect-garbage -d 9 | 10 | ------------------- ERROR: failed to solve: process "/bin/bash -ol pipefail -c nix-env -if .nixpacks/nixpkgs-5148520bfab61f99fd25fb9ff7bfbb50dad3c9db.nix && nix-collect-garbage -d" did not complete successfully: exit code: 100 Error: Docker build failed I want to remove 14.9 and only keep 16 NIXPLACK.TOML [phases.setup] nixPkgs = ['...', 'postgresql_16']
53 Replies
Percy
Percy10mo ago
Project ID: 0102b03a-4031-4647-8b11-de7393658d31
deathx02
deathx0210mo ago
0102b03a-4031-4647-8b11-de7393658d31
Brody
Brody10mo ago
what do you mean "I want to remove 14.9"?
deathx02
deathx0210mo ago
Its saying that collision in 14.9 and 16 ryt so If we try to remove 14.9 and just keep 16 Anyways I just want postgres 16 It was working last week and this week it suddenly like this
Brody
Brody10mo ago
to help me understand this better, do you think you could let me know why you need to install postgres in the first place?
deathx02
deathx0210mo ago
My project needs postgresql to be installed I am using psycopg2 binary
Brody
Brody10mo ago
might be better to switch to a Dockerfile based build for this kind of thing, heres an example of how you would install postgresql_16 with a Dockerfile https://github.com/railwayapp-templates/postgres-s3-backups/blob/main/Dockerfile#L24-L26
deathx02
deathx0210mo ago
ohhk
Brody
Brody10mo ago
let me know if you need any help with that!
deathx02
deathx0210mo ago
Btw cant we just change nixpack.toml and do this ?? Cause I didnt worked on dockerfile much
Brody
Brody10mo ago
from your error message, it seems not if you wanna share your repo with me id be happy to write the entire dockerfile for you!
deathx02
deathx0210mo ago
Sure but is it safe to share here ? Cause its private
Brody
Brody10mo ago
you want to just add me?
deathx02
deathx0210mo ago
yah so that you can check for details
Brody
Brody10mo ago
brody192
deathx02
deathx0210mo ago
ohhk sure just a min
Brody
Brody10mo ago
also, we are the only two people in this thread, you dont need to directly reply to my messages
deathx02
deathx0210mo ago
ohhk check I gave you
Brody
Brody10mo ago
7.8k line main.py file, thats impressive
deathx02
deathx0210mo ago
I am just a student tho Trying to increase skills
Brody
Brody10mo ago
you install the psycopg2-binary python module, are you sure you even need to install any postgresql package?
deathx02
deathx0210mo ago
The server I am using is on version 16 so I have to install postgresql_16 and If I try not to install postgresql My backup.py file will not work
Brody
Brody10mo ago
remove or rename the nixpacks.toml file please id like to at least see the error you would get please
deathx02
deathx0210mo ago
ohk Traceback (most recent call last): File "/opt/venv/lib/python3.11/site-packages/apscheduler/executors/base.py", line 125, in run_job retval = job.func(*job.args, **job.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/backup.py", line 97, in backup_database pg_dump(url.host, url.port, url.database, url.username, out=BACKUPFILE, password=url.password) File "/app/backup.py", line 62, in pg_dump raise e File "/app/backup.py", line 59, in pg_dump raise subprocess.CalledProcessError(result.returncode, command) subprocess.CalledProcessError: Command '['/root/.nix-profile/bin/pg_dump', '--host=viaduct.proxy.rlwy.net', '--port=37507', '--dbname=railway', '--username=postgres', '--no-password', '--no-acl', '--no-owner', '-f', 'backup.pg']' returned non-zero exit status 1.
Brody
Brody10mo ago
gotcha, thanks, i see whats going on now, first, we need some code changes please use environment variables for your urll variable dont hardcode the pg_dump_path, subprocess.run should be able to find pg_dump on its own
deathx02
deathx0210mo ago
Can you help in this please I dont have much knowledge abt it
Brody
Brody10mo ago
sure, screenshot of your railway project please
deathx02
deathx0210mo ago
Of which part
Brody
Brody10mo ago
the entire browser viewport
deathx02
deathx0210mo ago
No description
Brody
Brody10mo ago
wheres your database?
deathx02
deathx0210mo ago
hosted on my friends account want credentials ??
Brody
Brody10mo ago
i havent heard that one before
deathx02
deathx0210mo ago
I have telegram friends and I hosted code on my acc and database on his
Brody
Brody10mo ago
either way, add a DATABASE_URL variable to your service variables with the database url as its value
deathx02
deathx0210mo ago
ohhk Done added
Brody
Brody10mo ago
this line https://github.com/Kakashi219/tutorial/blob/main/backup.py#L22 should be urll = os.getenv("DATABASE_URL")
deathx02
deathx0210mo ago
Ohhk I changed it
Brody
Brody10mo ago
delete line 42 and set line 44 to "pg_dump",
deathx02
deathx0210mo ago
Ohk changes done
Brody
Brody10mo ago
okay ill write the dockerfile and get back to you shortly
deathx02
deathx0210mo ago
Ohhk Sir thank you
Brody
Brody10mo ago
i think this is a good starting point, put this into a Dockerfile in your repo
FROM python:3.11.1-alpine

ENV PYTHONUNBUFFERED=1
ENV PIP_DISABLE_PIP_VERSION_CHECK=1

RUN apk add --update --no-cache postgresql16-client --repository=https://dl-cdn.alpinelinux.org/alpine/edge/main

WORKDIR /app

COPY requirements.txt ./

RUN pip install -r requirements.txt

COPY . ./

CMD python main.py
FROM python:3.11.1-alpine

ENV PYTHONUNBUFFERED=1
ENV PIP_DISABLE_PIP_VERSION_CHECK=1

RUN apk add --update --no-cache postgresql16-client --repository=https://dl-cdn.alpinelinux.org/alpine/edge/main

WORKDIR /app

COPY requirements.txt ./

RUN pip install -r requirements.txt

COPY . ./

CMD python main.py
deathx02
deathx0210mo ago
Ohhk let me do this
Traceback (most recent call last):

File "/usr/local/lib/python3.11/site-packages/apscheduler/executors/base.py", line 125, in run_job

retval = job.func(*job.args, **job.kwargs)

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "/app/backup.py", line 104, in backup_database

context.bot.send_document(

File "/usr/local/lib/python3.11/site-packages/telegram/bot.py", line 134, in decorator

result = func(*args, **kwargs)

^^^^^^^^^^^^^^^^^^^^^

File "/usr/local/lib/python3.11/site-packages/telegram/bot.py", line 1007, in send_document

return self._message( # type: ignore[return-value]

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "/usr/local/lib/python3.11/site-packages/telegram/ext/extbot.py", line 203, in _message

result = super()._message(

^^^^^^^^^^^^^^^^^

File "/usr/local/lib/python3.11/site-packages/telegram/bot.py", line 344, in _message

result = self._post(endpoint, data, timeout=timeout, api_kwargs=api_kwargs)

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "/usr/local/lib/python3.11/site-packages/telegram/bot.py", line 299, in _post

return self.request.post(

^^^^^^^^^^^^^^^^^^

File "/usr/local/lib/python3.11/site-packages/telegram/utils/request.py", line 359, in post

result = self._request_wrapper('POST', url, fields=data, **urlopen_kwargs)

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "/usr/local/lib/python3.11/site-packages/telegram/utils/request.py", line 291, in _request_wrapper

raise NetworkError(f'{message} ({resp.status})')

telegram.error.NetworkError: Internal Server Error (500)


Is this related to our changes ??
Traceback (most recent call last):

File "/usr/local/lib/python3.11/site-packages/apscheduler/executors/base.py", line 125, in run_job

retval = job.func(*job.args, **job.kwargs)

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "/app/backup.py", line 104, in backup_database

context.bot.send_document(

File "/usr/local/lib/python3.11/site-packages/telegram/bot.py", line 134, in decorator

result = func(*args, **kwargs)

^^^^^^^^^^^^^^^^^^^^^

File "/usr/local/lib/python3.11/site-packages/telegram/bot.py", line 1007, in send_document

return self._message( # type: ignore[return-value]

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "/usr/local/lib/python3.11/site-packages/telegram/ext/extbot.py", line 203, in _message

result = super()._message(

^^^^^^^^^^^^^^^^^

File "/usr/local/lib/python3.11/site-packages/telegram/bot.py", line 344, in _message

result = self._post(endpoint, data, timeout=timeout, api_kwargs=api_kwargs)

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "/usr/local/lib/python3.11/site-packages/telegram/bot.py", line 299, in _post

return self.request.post(

^^^^^^^^^^^^^^^^^^

File "/usr/local/lib/python3.11/site-packages/telegram/utils/request.py", line 359, in post

result = self._request_wrapper('POST', url, fields=data, **urlopen_kwargs)

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "/usr/local/lib/python3.11/site-packages/telegram/utils/request.py", line 291, in _request_wrapper

raise NetworkError(f'{message} ({resp.status})')

telegram.error.NetworkError: Internal Server Error (500)


Is this related to our changes ??
Brody
Brody10mo ago
please enclose that in triple backticks
deathx02
deathx0210mo ago
Ok Im sorry check
Brody
Brody10mo ago
File "/app/backup.py", line 104, in backup_database we didnt do anything on line 104, so this would be a code issue but your code is able to run pg_dump or else it wouldnt even get to line 104
deathx02
deathx0210mo ago
Its saying Internal Server Error So I asked is this due to our changes or something Yah dump is working Ok It worked It was Telegram Servers Issues Ig
Brody
Brody10mo ago
awsome
deathx02
deathx0210mo ago
Thank You Sir for your precious time
Brody
Brody10mo ago
happy to help!
deathx02
deathx0210mo ago
Thank You again Have a nice day ahead
Brody
Brody10mo ago
no problem, you too!
Want results from more Discord servers?
Add your server