save temporary archives
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 ?
195 Replies
Project ID:
N/A
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
Use railway volumes, saving directly into your service will cause it to be deleted at every redeploy/deploy
hmmmm
nice, i will see that
If u don't need it to be persistent, theres no problem with that
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
volumes are meant for persistent files, and they cost an additional 0,25USD/Gb/month
slow down here
brody knows better
I'm trying to save a pdf file from a client upload but can'tyou have yet to tell us why you "can't"
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
my local is like this
i trying to give a buffer or something
oh rail = railway
noo
this is python
aaa brody
is you
you helped me like 30 mins ago hahahah
with the opencv2
indeed
okay so lets slow down here
do you see a print 4
in the deployment logs
yeees
i will send some screens
a sec
and then i assume there is no error printed from the catch?
the 6 i did'nt see
but you dont see error logs?
hmmm
you are calling me ?
no?
wtf.. my discord is souding but i did'nt see the call
sorry
a sec
hm
i not debbug, only prints
i have not called you, or have ever called anyone in #help
sorry
show me the deployment logs please, use this https://bookmarklet.up.railway.app/log-downloader/
okaay
i will download
i need to drag this
yes
you dont have a bookmarks bar
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
this came with the txtr
logs
you didnt use the bookmarklet but okay
sorry for long time response
i use
see
is coming the same
message of direct consol
cool but then you where just supposed to send that file here
ok
it doesnt matter now
show me a screenshot of your service metrics
i assume this code does work locally?
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
try adding this as a nixpacks.toml file in your project
okay !
apt packages gathered from here https://camelot-py.readthedocs.io/en/master/user/install-deps.html#os-specific-instructions
nice, added
stay in the 5 print
send me the build logs please
okay
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
YES
will do that a sec
hmm... not correctly
explain
Giving back
None
show me the code you implemented
Okay
i give this in out of app and in
but my local return None too
yeah because locally you are using windows?
'-'
will test
with the windows
sorry.
D:\gs10.01.2\bin\gsdll64.dll
yes, local is ok
okay but that's irevlent, we already knew it worked locally
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
what version of python do you use locally
yes.. it's saving
locally i use...
3.11.4
why do you have a
phases.setup
filewhen I was trying to solve it by searching the internet, I had created... it was an error
i will delete
try this instead
okay
have the "-" ?
sending the log
i updated it
building
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 ?
show me your current nixpacks.toml file
show me a screenshot of your service variables please
that is not what I asked for
sorry.
I asked for your railway service variables
my english not too good
okay
i will print
a sec
do you happen to have a runtime.txt file?
didn't have
show me a screenshot of your backends project files
okay
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
okay
done
changed this too
lets see
why
do you not use 3.11 locally?
i use 3.11, i see venv
and venv
is in the 3.9.13
why would your venv be a different version
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
the gs don't find
I think it may be time to move to a Dockerfile
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
dockerfile*
I can write one for you, I'm just eating right now
i really don't know nothing from infra / docker
^
oh nice
i'm doing one here, viewing what gonna result hahaha
can i add u on disc ?
no thank you
nice hahahah
i will do the docker
thanks for the help men !!
dockerfile*
but once done, show me it please
okay
i be back
that is not a dockerfile
thats a docker-compose
i'm doing a compose
railway does not support docker-compose
hmmmmm
so i will do a dockerfile
yeah i kept saying dockerfile everytime you said docker
like this
i will do in the front / back and i do no, tomorrow
show to u
that is not an ideal dockerfile
but it is a dockerfile, ill give you that much
nice, tomorrow send to u
have a good night, cya
you too!
running on railway now, but i can't acess the api
send me the dockerfile, I'll fix it for you
i try to do with the debian:bookworm but some error ocurred
yeah i know
and i do that with the base py:3.9
ill fix it
thank you
send me your requirements.txt file too please
are you using all those?
yees
what variable did you give to your flask app? app or main?
like this
add
gunicorn=21.2.0
to that list, but dont push changes yetthe same
of yours
olay
okay
give this dockerfile a shot
and once you changed your dockerfile for that one, push your changes
okay
my bad
i edited the dockerfile message
WOOOOOOOOOOOOOOOOOW
this workssssss
awesome
thank you
so much !
no problem!
will use docker file ever now, hahahahah, have a good night !! 😄
you too!
the finally thing, the guicorn have how to configure the works ?
show me a screenshot of your metrics please
Why'd you send that twice
i do another request
for view the actual
nothing really changed
k, sorry
how long should an http request take locally?
here an GPT response like 1~~2sec
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?
no, i have a treatment in responses that take more than 10sec, retry
i will try do to a time.sleep
why would you want to make the function take longer??
could it be giving an error, because it makes many requests quickly?
should a request ever take longer than 30 seconds?
because every request he makes takes around 1 second, and he makes maybe more than 1000 per execution
no, no
then there is a bug in your code
from the user, requested the api
yes
this take like 4~~5 minutos
30 seconds is the default timeout from gunicorn
aaaaaaaah okay
for the user
i just asked you and you said no 😐
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.
running locally what is the total request time the client will see
like 5 minutes
is that normal?
yees
5 minutes for one single network request?
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
one single network request that the client does takes 5 minutes? are you sure? you have been unsure in the past
yes, take, when i call the api
the response for client, take like 5 minutes
alright then add
--timeout 360
to the end of the CMD command in the dockerfile, this sets the request max timeout to 6 minutesokay
now, this work fine
thank u agaaaain
and all solved 😄
for sure this time lol