Having trouble starting gunicorn with Django deployed from dockerfile resulting in 503
Trying to deploy a django project that was developed locally with this Docker File
From the Django Railway template I've set the railway.json to be:
I've also set
ALLOWED_HOSTS
to be *
, though I would like to make that specific soon.
After running railway up
in a linked project the build appears to install all requirements fine, and proceeds to deploy. With a Postgres DB service I'm able to get the DB to run the migrations successfully, creating empty tables, however at that point the logs stop (no errors, just no more entries).
I've attached a screenshot of the repo structure and the end of the railway up
command. I feel like I'm missing something to do with either permissions, URLS or the deployment commands, but I've not got there yet. It's my first personal project in web dev so I;m sure the answer is obvious to many :p
Any help appreciated 🙂36 Replies
Project ID:
ee6fe531-fb8f-45f3-906e-f22374d487ac
ee6fe531-fb8f-45f3-906e-f22374d487ac
does the logs in the railway UI also stop at this point?
They do
looks like the migration runs, but it never gets to start gunicorn
do you have a start setting configured somewhere else like in the service settings?
If you mean through the value in permissable-voleyball > settings > deploy > start command the value has a nite that say it's sourced from the settings file. Was that the question? Also, Ive just come back to the page and am now seeing
Deployments Paused Builds need to drain. null
yeah lets come back to this after the incidents are resolved
https://discord.com/channels/713503345364697088/846875565357006878/1103346301829136414
Sure, thanks for taking a gander
hey wanna try again?
Sure, I'll run a 'railway up' and see what happens.
Interesting, totally different error. Trying to work out if I changed something that would cause it. Looks like the behaviour is now to prioritise the settings file and not the docker file?
click the code button and show me a screenshot
except it's also not accessing my settings file? locally it;s still got my start command
you must not have your railway.json file in the right place
ohhhhh i;ve run the cli in the wrong place, was working in a diff project. 1 sec
XD
thought it was odd I had to relink the project....
building (theres a fat dep tree here 😦 )
whats your requirements.txt look like?
OK, build complete, succesful. Depployment completed, logs stop at no migrations to apply
statsforcast has a fat set of it;s own dependencies
however, they all completed
did build finish?
yup yup same behaviour
Is it possible the difference between my railway.json and the fact I have a dockerfile in the repo itself is causing issues? The deploy is obviously automatically pointing at my docker, event though the railway.json points it to "NIXPACKS"
why not just remove the railway.json file
and then do
(hold on)
so yeah delete the railway.json file, and ust that as your dockerfile
I'll have a crack
Failed at
RUN python manage.py migrate
, e.g. the step before the logs dropped previously. Issue seems to be related to detecting the SECRET_KEY varable, which it must have found succesfully before and is set in teh env vars
try that
well
that built a lot faster, I guess railway caches the layer?
maybe
OHO! Closer, got more logs. URL still errors, but 301 this time.
okay and now its a code issue, that i unfortunately cant help with, off to google you go!
Sure, thanks for your help this evening, I'll head into the wild tomorrow.
no problem!
Seemingly just solved using the same info as in this SO: https://stackoverflow.com/questions/55726610/django-ssl-redirection-on-heroku-too-many-redirects
Specifically adding the line
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
to the settings.py
file.
My current (and new) understanding is that this is a required setting when your project starts implementing more secure practices on proxy servers?Stack Overflow
Django SSL redirection on Heroku: 'Too many redirects'
I have a web app deployed to Heroku with a custom domain name which DNS is managed through CloudFlare.
What I want to do is redirect HTTP requests to HTTPS.
After setting SECURE_SSL_REDIRECT to T...
@Brody I've spotted that railway has community templates, and there is one for Django, however I didn't start from there because a) I wasn't sure if this would ever be worth deploying, b) the template used is extremely basic, verging on unsafe unless configured? and c) I didn't actually know about railway in the first stage of the work.
Therefore my question is effectively: Is this deliberately railways approach, e.g. ALL complexity of the framework is up to the user, or is there an interest in 1) extending the existing template or 2) creating a second "auth focussed" django template?
(fine both ways btw, straight up honest question)
the purpose of the framework templates (like django's template) is just to show the user how to get the project active on railway, the rest it completely up to the user