Nahasco
Nahasco
Explore posts from servers
RRailway
Created by Nahasco on 8/4/2024 in #✋|help
How to disable Dockerfile in a service?
So I have multiple services including Django and Celery. Both use the same code but their start commands should be different. Since I am using a Dockerfile to build and start my Django service, it is automatically detected and applied to the celery service too. I want my celery service to have a different start command but railway is forcing the dockerfile on both. How to fix that?
27 replies
RRailway
Created by Nahasco on 7/29/2024 in #✋|help
container event container died when trying to deploy with dockerfile
I needed to use a dockerfile to install some important dependencies but now the deployment is failing on me with "container event container died" message in the deploy logs.
FROM python:3.12.2-alpine

WORKDIR /usr/src/app

ENV PYTHONUNBUFFERED=1

RUN pip install --upgrade pip

RUN apk add --update --no-cache --virtual .tmp-build-deps \
gcc libc-dev linux-headers postgresql-dev \
&& apk add libffi-dev \
&& apk add tk

RUN apk add weasyprint

RUN apk --update --upgrade --no-cache add fontconfig ttf-freefont font-noto terminus-font \
&& fc-cache -f \
&& fc-list | sort

COPY ./requirements.txt /usr/src/app/requirements.txt
RUN pip install -r requirements.txt

COPY . /usr/src/app/
FROM python:3.12.2-alpine

WORKDIR /usr/src/app

ENV PYTHONUNBUFFERED=1

RUN pip install --upgrade pip

RUN apk add --update --no-cache --virtual .tmp-build-deps \
gcc libc-dev linux-headers postgresql-dev \
&& apk add libffi-dev \
&& apk add tk

RUN apk add weasyprint

RUN apk --update --upgrade --no-cache add fontconfig ttf-freefont font-noto terminus-font \
&& fc-cache -f \
&& fc-list | sort

COPY ./requirements.txt /usr/src/app/requirements.txt
RUN pip install -r requirements.txt

COPY . /usr/src/app/
this is my dockerfile. attached are the logs.
48 replies
RRailway
Created by Nahasco on 7/14/2024 in #✋|help
Build failed, now queued, no logs, whats going on?
Build failed, trying redeploying but its queued forever. Whats going on??
6 replies
RRailway
Created by Nahasco on 6/27/2024 in #✋|help
Is it possible to clone a storage?
I want to clone a db storage from prod to staging enviroment. Can I do that?
7 replies
RRailway
Created by Nahasco on 6/21/2024 in #✋|help
How to run commands on live service?
I would like to run a shell command on my django service thats online. Things like "python manage.py migrate" or "python manage.py custom_command".
5 replies
RRailway
Created by Nahasco on 4/12/2024 in #✋|help
Django Allowed Hosts Error "Invalid HTTP_HOST header: '0.0.0.0:8000'"
I am getting this error sent to my admin email from the application I deployed on railway.app
Invalid HTTP_HOST header: '0.0.0.0:8000'. You may need to add '0.0.0.0' to ALLOWED_HOSTS
Invalid HTTP_HOST header: '0.0.0.0:8000'. You may need to add '0.0.0.0' to ALLOWED_HOSTS
and
Invalid HTTP_HOST header: '35.197.110.103:7010'. You may need to add '35.197.110.103' to ALLOWED_HOSTS
Invalid HTTP_HOST header: '35.197.110.103:7010'. You may need to add '35.197.110.103' to ALLOWED_HOSTS
The application works fine with no issues but I randomly get these errors sent to the admin email. Do I add these to addresses to my allowed hosts? Are these the addresses associated with my railway project?
8 replies
RRailway
Created by Nahasco on 3/25/2024 in #✋|help
Application failed to respond error on an active deployment
I ran railway run with a new start command and now the application is not accessible because of this error. Here is my railway.json
{
"$schema": "https://railway.app/railway.schema.json",
"build": {
"builder": "NIXPACKS"
},
"deploy": {
"startCommand": "sleep 3 && celery -A tibian_backend worker --loglevel=info && python manage.py migrate && gunicorn tibian_backend.wsgi --bind 0.0.0.0:$PORT",
"restartPolicyType": "NEVER",
"restartPolicyMaxRetries": 10
}
}
{
"$schema": "https://railway.app/railway.schema.json",
"build": {
"builder": "NIXPACKS"
},
"deploy": {
"startCommand": "sleep 3 && celery -A tibian_backend worker --loglevel=info && python manage.py migrate && gunicorn tibian_backend.wsgi --bind 0.0.0.0:$PORT",
"restartPolicyType": "NEVER",
"restartPolicyMaxRetries": 10
}
}
Before it was like this and it worked perfectly
{
"$schema": "https://railway.app/railway.schema.json",
"build": {
"builder": "NIXPACKS"
},
"deploy": {
"startCommand": "sleep 3 && python manage.py migrate && python manage.py collectstatic --noinput && gunicorn --timeout 500 tibian_backend.wsgi",
"restartPolicyType": "NEVER",
"restartPolicyMaxRetries": 10
}
}
{
"$schema": "https://railway.app/railway.schema.json",
"build": {
"builder": "NIXPACKS"
},
"deploy": {
"startCommand": "sleep 3 && python manage.py migrate && python manage.py collectstatic --noinput && gunicorn --timeout 500 tibian_backend.wsgi",
"restartPolicyType": "NEVER",
"restartPolicyMaxRetries": 10
}
}
I appreciate any help
18 replies
RRailway
Created by Nahasco on 3/7/2024 in #✋|help
Postgres Database private url, is it faster and how to use it?
I have a Django rest framework setup with postgress db and it seems the connection is slow. I noticed there is a database private url and i wonder if this is a faster connection. If it is how can I configure it in my project? I read the doc article about private networking but I am new here and couldnt really understand how to do it. Any help is greatly appreciated. Thanks.
41 replies
RRailway
Created by Nahasco on 12/24/2022 in #✋|help
Anyway to sleep project while so it doesnt count up hours of usage like heroku?
Anyway to sleep project so it doesnt count up hours of usage like heroku?
4 replies
RRailway
Created by Nahasco on 12/23/2022 in #✋|help
how do i pause my project?
Is there a way to shut down a project temporarily?
4 replies
RRailway
Created by Nahasco on 12/17/2022 in #✋|help
Cron jobs with Django
What is the way to setup cron jobs with django on railway? I tried the usual way of dockerizing my app but docker compose isnt supported on railway. What other options do I have? (Newbie here, came from using heroku scheduler)
11 replies
RRailway
Created by Nahasco on 12/16/2022 in #✋|help
Docker image works locally but crashes in deployment
What would be the cause for this? I have a dockerfile and docker-compose.yml files in my github repo and i can build and run a docker image seamlessly locally but it crashes with so many errors when trying to deploy to railway.
7 replies