Complex deploy start commands don't work for me
Can't use complex instructions in Settings -> Deploy -> Start Command. I'm running a Django application using a Dockerfile for app build.
When I use something like
gunicorn app.wsgi --timeout 300
as a start command, it works perfectly fine.
But if I try this: python manage.py migrate && gunicorn english_exercises_app.wsgi --timeout 300
Then only the first part of the command (before &&) is executed. I tried using railway.json file for indicating the start command, but the issue still persists. This is true for any complex command I tried.
GitHub repo: https://github.com/tmvfb/english-exercises-app
Example deployment ID with the mentioned complex start command: 5ed77a3e-7573-477b-8b68-9ce06b239124
Deploy logs stop at this (i.e. completing python manage.py migrate
command):
I've found several examples of railway deploy using complex start commands and didn't find any issues related to this. Is there something I am doing wrong?GitHub
GitHub - tmvfb/english-exercises-app: Python package that generates...
Python package that generates English practice exercises from an uploaded text. - GitHub - tmvfb/english-exercises-app: Python package that generates English practice exercises from an uploaded text.
8 Replies
Project ID:
5ed77a3e-7573-477b-8b68-9ce06b239124
is that your repo?
yea
you are using a dockerfile, set the start command in the dockerfile, not the railway service
Thank you! This is a bit tricky for me, because in order to apply migrations, I need to set a database url during build. I would appreciate if you help me with how to do this in Railway.
I know how to do it locally by using
docker build --build-arg DATABASE_URL=...
, but no idea how to achieve this in railway.that is done by railway for you, all you need to do in your dockerfile is reference the variable with the
ARG
keywordThat works, thank you! Another workaround is to specify the whole instruction in the CMD command (thought docker didn't support this for CMD).
CMD python3 manage.py migrate && gunicorn english_exercises_app.wsgi --timeout 300
However, if Railway doesn't actually support complex commands it would be great to rewrite the example app (https://github.com/railwayapp-templates/django/blob/main/railway.json) . Tried this with Nixpacks, not Dockerfile, still had the same issue of only the first command executing.
GitHub
django/railway.json at main · railwayapp-templates/django
1-Click Django on Railway. Contribute to railwayapp-templates/django development by creating an account on GitHub.
&& is not complex, and the start command in both railway.json and the service settings absolutely does support this, i have no clue what you where doing wrong
&& is also supported by the CMD keyword in a Dockerfile as well, again no clue what you where doing wrong
and the start phase's cmd keyword in a nixpacks.toml file also works with &&