R
Railway

✋|help

save temporary archives

Ppedroo59378/25/2023
Can i save temporary pdfs to a back-end host ?
I'm trying to save a pdf file from a client upload but can't, have any form to do that ?
Ppedroo59378/25/2023
it's a front-end calling a back-end api, and fron't gives a pdf, back-end need to saves to camelot read, and after that give back a archive to front
MMedim8/25/2023
Use railway volumes, saving directly into your service will cause it to be deleted at every redeploy/deploy
Ppedroo59378/25/2023
hmmmm
nice, i will see that
MMedim8/25/2023
If u don't need it to be persistent, theres no problem with that
Ppedroo59378/25/2023
noo it's like a temp archive
ever persons to call will give the same name, temp_pdf... and exclude after
i will try volumes
MMedim8/25/2023
volumes are meant for persistent files, and they cost an additional 0,25USD/Gb/month
BBrody8/25/2023
slow down here
MMedim8/25/2023
brody knows better
BBrody8/25/2023
I'm trying to save a pdf file from a client upload but can't
you have yet to tell us why you "can't"
Ppedroo59378/25/2023
in my locally server i just save in the src directory like "./temp-pdf.pdf' and debugging the server in rail, the app just don't save this
can't have access to this pdf
BBrody8/25/2023
this is a ruby on rails app?
Ppedroo59378/25/2023
Ppedroo59378/25/2023
my local is like this
i trying to give a buffer or something
BBrody8/25/2023
oh rail = railway
Ppedroo59378/25/2023
noo
BBrody8/25/2023
this is python
Ppedroo59378/25/2023
aaa brody
is you
you helped me like 30 mins ago hahahah
with the opencv2
BBrody8/25/2023
indeed
okay so lets slow down here
do you see a print 4
in the deployment logs
Ppedroo59378/25/2023
yeees
i will send some screens
a sec
BBrody8/25/2023
and then i assume there is no error printed from the catch?
Ppedroo59378/25/2023
Ppedroo59378/25/2023
the 6 i did'nt see
Ppedroo59378/25/2023
BBrody8/25/2023
but you dont see error logs?
Ppedroo59378/25/2023
hmmm
you are calling me ?
BBrody8/25/2023
no?
Ppedroo59378/25/2023
wtf.. my discord is souding but i did'nt see the call
sorry
a sec
hm
i not debbug, only prints
BBrody8/25/2023
i have not called you, or have ever called anyone in #help
Ppedroo59378/25/2023
sorry
BBrody8/25/2023
show me the deployment logs please, use this https://bookmarklet.up.railway.app/log-downloader/
Ppedroo59378/25/2023
okaay
i will download
i need to drag this
BBrody8/25/2023
yes
BBrody8/25/2023
BBrody8/25/2023
you dont have a bookmarks bar
Ppedroo59378/25/2023
oh i see that now, i will se a video, really don't know what is this
i come back in some minutos for study this
oh nice
i will send the logs
[2023-08-25 17:27:41 +0000] [1] [INFO] Starting gunicorn 20.0.4
[2023-08-25 17:27:41 +0000] [1] [INFO] Listening at: http://0.0.0.0:5737 (1)
[2023-08-25 17:27:41 +0000] [1] [INFO] Using worker: sync
[2023-08-25 17:27:41 +0000] [10] [INFO] Booting worker with pid: 10
1
2
3
4
5
Ppedroo59378/25/2023
Ppedroo59378/25/2023
this came with the txtr
logs
BBrody8/25/2023
you didnt use the bookmarklet but okay
Ppedroo59378/25/2023
sorry for long time response
i use
see
Ppedroo59378/25/2023
Ppedroo59378/25/2023
Ppedroo59378/25/2023
is coming the same
message of direct consol
BBrody8/25/2023
cool but then you where just supposed to send that file here
Ppedroo59378/25/2023
ok
BBrody8/25/2023
it doesnt matter now
Ppedroo59378/25/2023
BBrody8/25/2023
show me a screenshot of your service metrics
Ppedroo59378/25/2023
Ppedroo59378/25/2023
Ppedroo59378/25/2023
BBrody8/25/2023
i assume this code does work locally?
Ppedroo59378/25/2023
yes, work
it is an application that takes a pdf from an educational institution (transfers it from one to another) and treats it, the flow is basically this, it sends the pdf through an api, the back-end saves this pdf, treats it, and sends it to return an excel
BBrody8/25/2023
try adding this as a nixpacks.toml file in your project
[phases.setup]
  aptPkgs = ['...', 'ghostscript', 'python3-tk']
Ppedroo59378/25/2023
okay !
Ppedroo59378/25/2023
nice, added
stay in the 5 print
BBrody8/25/2023
send me the build logs please
Ppedroo59378/25/2023
okay
Ppedroo59378/25/2023
BBrody8/25/2023
can you implement the Ghostscript and Tkinter checks this docs page shows you? (for ubuntu)
https://camelot-py.readthedocs.io/en/master/user/install-deps.html#checks-to-see-if-dependencies-are-installed-correctly
Ppedroo59378/25/2023
YES
will do that a sec
hmm... not correctly
BBrody8/25/2023
explain
Ppedroo59378/25/2023
Ppedroo59378/25/2023
Giving back
None
BBrody8/25/2023
show me the code you implemented
Ppedroo59378/25/2023
Okay
i give this in out of app and in
Ppedroo59378/25/2023
Ppedroo59378/25/2023
but my local return None too
BBrody8/25/2023
yeah because locally you are using windows?
Ppedroo59378/25/2023
'-'
will test
with the windows
sorry.
D:\gs10.01.2\bin\gsdll64.dll
yes, local is ok
BBrody8/25/2023
okay but that's irevlent, we already knew it worked locally
Ppedroo59378/25/2023
will try to redeploy
and see if it's work
will print the current directory files too
to see if it's saving the archive
BBrody8/25/2023
what version of python do you use locally
Ppedroo59378/25/2023
yes.. it's saving
Ppedroo59378/25/2023
locally i use...
3.11.4
BBrody8/25/2023
why do you have a phases.setup file
Ppedroo59378/25/2023
when I was trying to solve it by searching the internet, I had created... it was an error
i will delete
BBrody8/25/2023
try this instead
[variables]
  NIXPACKS_PYTHON_VERSION = '3.11'

[phases.setup]
  nixPkgs = ['...', 'ghostscript', 'python311Packages.tkinter']
  aptPkgs = ['...', 'ghostscript', 'python3-tk']
Ppedroo59378/25/2023
okay
have the "-" ?
sending the log
Ppedroo59378/25/2023
BBrody8/25/2023
i updated it
Ppedroo59378/25/2023
building
Ppedroo59378/25/2023
Ppedroo59378/25/2023
will change version
of pdftopng
to 0.1.0
None 😦
nixPkgs = ['...', 'ghostscript', 'python311Packages.tkinter']
aptPkgs = ['...', 'ghostscript', 'python3-tk']
for use the version older
like 39.13
3.9..13
in the python311packages
can change it ?
Ppedroo59378/25/2023
BBrody8/25/2023
show me your current nixpacks.toml file
Ppedroo59378/25/2023
BBrody8/25/2023
show me a screenshot of your service variables please
Ppedroo59378/25/2023
BBrody8/25/2023
that is not what I asked for
Ppedroo59378/25/2023
sorry.
BBrody8/25/2023
I asked for your railway service variables
Ppedroo59378/25/2023
my english not too good
okay
i will print
a sec
Ppedroo59378/25/2023
BBrody8/25/2023
do you happen to have a runtime.txt file?
Ppedroo59378/25/2023
didn't have
BBrody8/25/2023
show me a screenshot of your backends project files
Ppedroo59378/25/2023
okay
Ppedroo59378/25/2023
BBrody8/25/2023
can you make sure you have that temp.pdf file in your gitignore and that you go and remove that pdf file from your github repo
Ppedroo59378/25/2023
okay
done
Ppedroo59378/25/2023
Ppedroo59378/25/2023
changed this too
lets see
BBrody8/25/2023
why
do you not use 3.11 locally?
Ppedroo59378/25/2023
Ppedroo59378/25/2023
i use 3.11, i see venv
and venv
is in the 3.9.13
BBrody8/25/2023
why would your venv be a different version
Ppedroo59378/25/2023
i really don't know... i just start the project with the pycharm, and will se the venv now
it is in the 3.9
😢
okay
now servers up
Ppedroo59378/25/2023
Ppedroo59378/25/2023
the gs don't find
BBrody8/25/2023
I think it may be time to move to a Dockerfile
Ppedroo59378/25/2023
Oh nice
My tech lead saw the same thing :c
i will study it
Buuuut, for now, thank u so much, u are very smart men
I will do a docker for this
BBrody8/25/2023
dockerfile*
I can write one for you, I'm just eating right now
Ppedroo59378/25/2023
i really don't know nothing from infra / docker
BBrody8/25/2023
^
Ppedroo59378/25/2023
oh nice
i'm doing one here, viewing what gonna result hahaha
can i add u on disc ?
BBrody8/25/2023
no thank you
Ppedroo59378/25/2023
nice hahahah
i will do the docker
thanks for the help men !!
BBrody8/25/2023
dockerfile*
but once done, show me it please
Ppedroo59378/25/2023
okay
i be back
version: '3.4'
services:
  anima:
    image: node:14   # Use a versão adequada do Node.js
    container_name: anima
    ports:
      - "3000:3000"   # Mapeie a porta do container para a porta do host, se necessário
    volumes:
      - ./anima:/app   # Mapeie o diretório do código-fonte do frontend para o container
    working_dir: /app
    command: sh -c "npm install && npm start"   # Comando para iniciar o frontend

  mvp-achievement-rates:
    image: python:3.9   # Use a versão adequada do Python
    container_name: mvp-achievement-rates
    ports:
      - "8000:8000"   # Mapeie a porta do container para a porta do host, se necessário
    volumes:
      - ./mvp-achievement-rates:/app   # Mapeie o diretório do código-fonte do backend para o container
    working_dir: /app
    command: sh -c "apt-get update && apt-get install -y ghostscript && pip install -r requirements.txt && python main.py"   # Comando para iniciar o backend

  database:
    image: postgres:13   # Use a versão adequada do PostgreSQL
    container_name: database
    ports:
      - "5432:5432"   # Mapeie a porta do container para a porta do host, se necessário
    environment:
      POSTGRES_DB: Databases
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: 1789
    volumes:
      - postgres_data:/var/lib/postgresql/data   # Volume para persistência dos dados do banco

volumes:
  postgres_data:   # Defina o nome do volume para persistência dos dados do PostgreSQL
BBrody8/25/2023
that is not a dockerfile
thats a docker-compose
Ppedroo59378/25/2023
i'm doing a compose
BBrody8/25/2023
railway does not support docker-compose
Ppedroo59378/25/2023
hmmmmm
so i will do a dockerfile
BBrody8/25/2023
yeah i kept saying dockerfile everytime you said docker
Ppedroo59378/25/2023
like this
Ppedroo59378/25/2023
i will do in the front / back and i do no, tomorrow
show to u
BBrody8/25/2023
that is not an ideal dockerfile
but it is a dockerfile, ill give you that much
Ppedroo59378/25/2023
nice, tomorrow send to u
have a good night, cya
BBrody8/25/2023
you too!
Ppedroo59378/29/2023
Ppedroo59378/29/2023
running on railway now, but i can't acess the api
Ppedroo59378/29/2023
BBrody8/29/2023
send me the dockerfile, I'll fix it for you
Ppedroo59378/29/2023
Ppedroo59378/29/2023
FROM python:3.9

RUN apt-get update && \
    apt install libgl1-mesa-glx -y && \
    apt-get install 'ffmpeg'\
    'libsm6'\
    'libxext6'  -y && \
    apt-get install -y ghostscript && \
    apt-get clean

WORKDIR /app

COPY . /app

RUN pip install -r requirements.txt

CMD ["python3", "main.py"]

i try to do with the debian:bookworm but some error ocurred
BBrody8/29/2023
yeah i know
Ppedroo59378/29/2023
and i do that with the base py:3.9
BBrody8/29/2023
ill fix it
Ppedroo59378/29/2023
thank you
BBrody8/29/2023
send me your requirements.txt file too please
Ppedroo59378/29/2023
aiohttp==3.8.5
aiosignal==1.3.1
async-timeout==4.0.2
attrs==23.1.0
blinker==1.6.2
camelot-py==0.11.0
certifi==2023.7.22
cffi==1.15.1
chardet==5.1.0
charset-normalizer==3.2.0
click==8.1.6
colorama==0.4.6
cryptography==41.0.2
distro==1.8.0
et-xmlfile==1.1.0
flask==2.3.3
Flask-Cors==4.0.0
frozenlist==1.4.0
ghostscript==0.7
greenlet==2.0.2
idna==3.4
importlib-metadata==6.8.0
itsdangerous==2.1.2
Jinja2==3.1.2
lxml==4.9.3
MarkupSafe==2.1.3
multidict==6.0.4
numpy==1.24.4
openai==0.27.8
opencv-python==4.8.0.74
openpyxl==3.1.2
pandas==2.0.3
pdfminer.six==20221105
pdftopng==0.2.3
Pillow==10.0.0
psycopg2==2.9.7
pycparser==2.21
pypdf==3.14.0
pypdf2==3.0.1
python-dateutil==2.8.2
python-docx==0.8.11
pytz==2023.3
requests==2.31.0
six==1.16.0
SQLAlchemy==2.0.20
tabula-py==2.7.0
tabulate==0.9.0
tqdm==4.65.0
typing-extensions==4.7.1
tzdata==2023.3
Unidecode==1.3.6
urllib3==2.0.4
werkzeug==2.3.7
yarl==1.9.2
zipp==3.16.2
BBrody8/29/2023
are you using all those?
Ppedroo59378/29/2023
yees
BBrody8/29/2023
what variable did you give to your flask app? app or main?
BBrody8/29/2023
like this
BBrody8/29/2023
add gunicorn=21.2.0 to that list, but dont push changes yet
Ppedroo59378/29/2023
Ppedroo59378/29/2023
the same
of yours
olay
okay
BBrody8/29/2023
give this dockerfile a shot
FROM python:3.9

ENV PYTHONUNBUFFERED="1"
ENV PIP_DISABLE_PIP_VERSION_CHECK="1"

RUN apt-get update && apt-get install -y --no-install-recommends \
    libgl1-mesa-glx \
    ffmpeg \
    libsm6 \
    libxext6 \
    ghostscript \
    && apt-get clean

WORKDIR /app

COPY . /app

RUN pip install -r requirements.txt

CMD gunicorn main:app

and once you changed your dockerfile for that one, push your changes
Ppedroo59378/29/2023
okay
Ppedroo59378/29/2023
BBrody8/29/2023
my bad
i edited the dockerfile message
Ppedroo59378/29/2023
WOOOOOOOOOOOOOOOOOW
this workssssss
BBrody8/29/2023
awesome
Ppedroo59378/29/2023
thank you
so much !
BBrody8/29/2023
no problem!
Ppedroo59378/29/2023
will use docker file ever now, hahahahah, have a good night !! 😄
BBrody8/29/2023
you too!
Ppedroo59378/29/2023
the finally thing, the guicorn have how to configure the works ?
BBrody8/29/2023
show me a screenshot of your metrics please
Ppedroo59378/29/2023
Ppedroo59378/29/2023
BBrody8/29/2023
Why'd you send that twice
Ppedroo59378/29/2023
i do another request
for view the actual
BBrody8/29/2023
nothing really changed
Ppedroo59378/29/2023
k, sorry
BBrody8/29/2023
how long should an http request take locally?
Ppedroo59378/29/2023
here an GPT response like 1~~2sec
BBrody8/29/2023
something in your code took longer than 30 seconds, that is the default timeout from gunicorn
should a request ever take longer than 30 seconds?
Ppedroo59378/29/2023
no, i have a treatment in responses that take more than 10sec, retry
Ppedroo59378/29/2023
Ppedroo59378/29/2023
i will try do to a time.sleep
BBrody8/29/2023
why would you want to make the function take longer??
Ppedroo59378/29/2023
could it be giving an error, because it makes many requests quickly?
BBrody8/29/2023
should a request ever take longer than 30 seconds?
Ppedroo59378/29/2023
because every request he makes takes around 1 second, and he makes maybe more than 1000 per execution
no, no
BBrody8/29/2023
then there is a bug in your code
Ppedroo59378/29/2023
from the user, requested the api
yes
this take like 4~~5 minutos
BBrody8/29/2023
30 seconds is the default timeout from gunicorn
Ppedroo59378/29/2023
aaaaaaaah okay
for the user
BBrody8/29/2023
i just asked you and you said no 😐
Ppedroo59378/29/2023
i think you say in the application
like, in the back-end
i do only request like 12 sec, but muchs requests
like 1000
1500
and return to the user the answer
but it's take 5 minutes, i really don't undertand the starter question, sorry.
BBrody8/29/2023
running locally what is the total request time the client will see
Ppedroo59378/29/2023
like 5 minutes
BBrody8/29/2023
is that normal?
Ppedroo59378/29/2023
yees
BBrody8/29/2023
5 minutes for one single network request?
Ppedroo59378/29/2023
yes, it's an AI project I'm working on, which treats school transcripts based on pdfs, and returns the answer of where it should go when changing course, or institution.
There are many requests, treated with chatGPT in search of similarities in the school grade
BBrody8/29/2023
one single network request that the client does takes 5 minutes? are you sure? you have been unsure in the past
Ppedroo59378/29/2023
yes, take, when i call the api
the response for client, take like 5 minutes
BBrody8/29/2023
alright then add --timeout 360 to the end of the CMD command in the dockerfile, this sets the request max timeout to 6 minutes
Ppedroo59378/29/2023
okay
now, this work fine
thank u agaaaain
and all solved 😄
BBrody8/29/2023
for sure this time lol

Looking for more? Join the community!

Recommended Posts
How to host websockets?This is my first time hosting socket server, how can i do that on railway? I docs there are only webI cannot use opencv2 and received ImportError: libgl.so.1 cannot open shared object file no such filCan anyone help me with that ??LibreofficeHi I need libreoffice installed to use in my code. I attempted using the below nixpacks.toml ``` [Random app crash, no logs or other indicatorWhen trying my healtcheck I get random crashes, no recent deploy was made, I don't see any logs on mModify build commandHow would I modify the build command so it does a pip install of `psycopg2` ? I was told to remove tPayment method removalHey, how do I remove my payment method? I opted in for a credit subscriptions but still see my crediDeploying crashedHello, i'm facing a problem when deploying my spring boot application to railway, my application worInternal server error when accessing TypebotI noticed that since yesterday the new installations with the Typebot template present the error IntRAILWAY_PUBLIC_DOMAIN replaces RAILWAY_STATIC_URLHi team, we've been hunting down a bug with our app today, occurring on many PR Environments and it'My Subscription issueHello dear support guys: I found that I have been downgraded to No Subscription.. If my memory is rIs it normal for hello world json to return in 600ms? - GO FIBERHelp setting up a monorepoI'm getting this error when deploying my project. I made sure no other deployments are running, but Deployment and logging issues (Maven)Hello, My program is running fine locally, but when I deploy it with Railway, I start seeing issuesIssues with Postgres DBI don't really understand why I am not seeing any tables in my DB. Seeding works, but the database sversion 'GLIBC 2.29' not foundweird error that seems to be because of my code, but it works on my computer <:bing_shrug:5837915814Use rust nightlyidk how docker works but i cant use the nightly rust dockerfile image for some reasonFix Missing libuuid LibraryHey, I am currently runnig into problems deploying my FastAPI backend after adding a new dependency I can no longer connect to my MySQL database, even after restarting the databaseI'm not sure what my project id is. My link is this: https://railway.app/project/31b9ee92-06cc-44c1-RPC showing forbidden access 403Hi. I've got some crypto related script which pings an RPC server - it works fine locally but on raiHow would I connect my project with the SQL database ?I have a model for users and I would like to populate my production DB with them. How can I do that?