Is there a way to redeploy application automatically
Hi,
I was wondering if there is a way to schedule automatic redeploys.
E.g. Redeploys the web application every 2 days.
69 Replies
Project ID:
75d80f5b-a3d6-4015-a435-1cf91309a053
75d80f5b-a3d6-4015-a435-1cf91309a053
setup a github action to do this?
https://medium.com/tradeling/how-to-schedule-jobs-using-github-actions-9f32667706ea
https://blog.railway.app/p/github-actions
I'll havea look thanks
Does railway.app have cronjobs?
not built in, but you can set an endpoint that crashes your app and use another service that just triggers that endpoint on a cron schedule
Set your app to always restart on crash
but github actions are a more elegant solution
your question has been answered, but I'm just wondering, why do you want to restart your app every 2 days?
Becasue for some reason the website goes very very slow and barely loads
Without a restart
Do you know any tutorials they may do this
I've searched but not sure how I would do this
how about we try to get to the route cause of this issue instead of applying a bandaid solution
what kind of website is it?
Just a general project website
Django
well hold on, let's try to fix the cause of the slowdown if possible
That's a scheduling a job, rather than restart. I read it
Yes
let's put the restarting off to the side for now, okay?
can you share a link to your repo?
It's private currently
I can send alternative that's same files
do you have a Procfile?
But some credential files missing
Yes
send it?
This is the repo https://github.com/Abid-M/Energy-Management-System
I dont use this repo specifically for railway
GitHub
FYP - https://re-energise.xyz/. Contribute to Abid-M/Energy-Management-System development by creating an account on GitHub.
as the private one, for this one there is like i commented the sensitive info out
but basically is the same
show me the procfile for the app that's slowing down please
web: gunicorn EnergyProject.wsgi
okay and what specifically is slowing down? be as specific as humanly possible
legit the whole website is slow to load and all
i havent used the website maybe in like a month
and like it took id say 30+ seconds more to load the website
is it currently slow?
and somoe not even
once i redeployed it, it seemed fine abit
not atm as i redployed it recently
restart
are you calling any external storage or api services during incoming requests to the site?
or accessing a database perhaps?
yes
yes to what lol
i got postgresql on railway
have you taken a look at the apps metrics during a time of slowness?
I meant the django service
no stair step memory or cpu usage, looks fine to me
that repo you linked, that's your repo running in production, minus the sensitive information? correct?
yes
correct
I'm seeing some things that stand out to me, don't know if they would cause slow downs though
1. your app is set to debug mode, set it to false
2. you have a live reload middleware, remove that middleware
alrighty
ill try them
since you are disabling debug mode, you will likely need to run collect static manually now
you can view the start command for the railway provided django template here:
https://github.com/railwayapp-templates/django/blob/main/railway.json
?
what
what is that
1. we said we are putting that aside for now in favour of trying to fix the root cause
2. that's not even remotely close to how you would actually do it
in general when i was developing locally, it was very slow, took 4 seconds to load pages in
once deployed on railway better, but still not fluid
and just tested couple days back after leaving it deployed for couple weeks or slow and tried loading and basically never loaded
have you made those two changes i suggested
i have done now yh
its actually
show me your new procfile please
decent now
sure
have you set debug = false?
have you removed the live reload middleware?
i have done now yh
both things?
Yeah I have done
both
and what are the response times for the first network request
in metrics?
no in the browser tools
in the network tab
"can't reach this page"
if its on normal
private browser shows as 135.99ms
screenshot please
it loads plenty fast for me
yh seems fine now, with a different browser
debug set to false actually made like a lot of difference tbh
like alot alot
but you did remove the live reload middleware too right?
i removed that as well yh, it could be that too yh
appreciate the help, seems v good now
oh wait
the static
some images seem
not showing
remember when i said this lmao?
yeah how can i fix it and do it manually from the link u sent
do you see the start command?
from the link i sent
yh
well delete your Procfile, and use that railway.json file in your own project, just update the apps name that gunicorn starts
Yeah all good now
Thank you, appreciate the help!
no need the restart thing anymore
hopefully
if things slow down again, dont restart it, come back here and ping me please
For sure, thanks
no problem 🙂