5 months ago
hey I can't unblock deploy of my app kardia-app
it's not working maybe issue comes from railway
could you help please
16 Replies
5 months ago
Mounting volume on: /var/lib/containers/railwayapp/bind-mounts/1f423854-b4a5-4945-8722-d488db4bade3/vol_60ze648bc9hsue8o
Deploy complete
Starting Container
python: can't open file '//manage.py': [Errno 2] No such file or directory
Mounting volume on: /var/lib/containers/railwayapp/bind-mounts/1f423854-b4a5-4945-8722-d488db4bade3/vol_60ze648bc9hsue8o
python: can't open file '//manage.py': [Errno 2] No such file or directory
Mounting volume on: /var/lib/containers/railwayapp/bind-mounts/1f423854-b4a5-4945-8722-d488db4bade3/vol_60ze648bc9hsue8o
python: can't open file '//manage.py': [Errno 2] No such file or directory
Mounting volume on: /var/lib/containers/railwayapp/bind-mounts/1f423854-b4a5-4945-8722-d488db4bade3/vol_60ze648bc9hsue8o
python: can't open file '//manage.py': [Errno 2] No such file or directory
Mounting volume on: /var/lib/containers/railwayapp/bind-mounts/1f423854-b4a5-4945-8722-d488db4bade3/vol_60ze648bc9hsue8o
python: can't open file '//manage.py': [Errno 2] No such file or directory
Mounting volume on: /var/lib/containers/railwayapp/bind-mounts/1f423854-b4a5-4945-8722-d488db4bade3/vol_60ze648bc9hsue8o
python: can't open file '//manage.py': [Errno 2] No such file or directory
Mounting volume on: /var/lib/containers/railwayapp/bind-mounts/1f423854-b4a5-4945-8722-d488db4bade3/vol_60ze648bc9hsue8o
python: can't open file '//manage.py': [Errno 2] No such file or directory
Mounting volume on: /var/lib/containers/railwayapp/bind-mounts/1f423854-b4a5-4945-8722-d488db4bade3/vol_60ze648bc9hsue8o
python: can't open file '//manage.py': [Errno 2] No such file or directory
5 months ago
Dockerfile:
FROM python:3.11.9-alpine3.20
RUN apk add --no-cache \
gcc \
git \
musl-dev \
python3-dev \
postgresql-dev \
libxml2-dev \
libxslt-dev \
xmlsec-dev \
jpeg-dev \
curl-dev \
build-base \
libffi-dev
WORKDIR /
COPY requirements.txt ./
RUN pip install -r requirements.txt gunicorn
ENV PORT=8080
EXPOSE ${PORT}
5 months ago
railway.json
{
"$schema": "https://railway.app/railway.schema.json",
"build": {
"builder": "DOCKERFILE",
"dockerfilePath": "Dockerfile.django-alpine"
}
}
5 months ago
help me please I'm lost
5 months ago
This thread has been marked as public for community involvement, as it does not contain any sensitive or personal information. Any further activity in this thread will be visible to everyone.
Status changed to Open brody • 6 months ago
5 months ago
Hello,
> maybe issue comes from railway
It doesn't.
You are currently using Dockerfile.django-alpine
but nowhere in that Dockerfile do you copy your project into the image, thus manage.py is not found.
Additionally, your CMD
directive runs runserver
, that's a development server not fit for deployment, please use gunicorn.
5 months ago
I still have 502 even if the deploy is looking much much healthy
Any clue to unblock this please ?
Attachments
5 months ago
Have you checked your deploy logs?
The migration script has not exited, meaning you have something wrong with the code that prevents it from exiting.
If the migration script never exits, gunicorn won't be able to start.
5 months ago
migration is not needed stored in volume
5 months ago
not using gunicorn but uwsgi
5 months ago
is it possible to help but accessing to my account
being stuck since eternity at this problem
5 months ago
You are indeed using gunicorn.
Well, you are attempting to.
I would like to make it clear that this is not a platform issue, but a misconfiguration on your side.
Here is your current start command -
python manage.py migrate && echo "from django.contrib.sites.models import Site; Site.objects.get_or_create(pk=1, defaults={'domain': 'test-production-7209.up.railway.app', 'name': 'DefectDojo'})" | python manage.py shell && gunicorn --bind 0.0.0.0:$PORT --workers 4 --timeout 120 dojo.wsgi:application
Gunicorn never gets ran because commands prior to gunicorn are not exiting.
5 months ago
I'm trying a new redeploy without
thanks
Let's hope this would work
5 months ago
# code: language=Dockerfile
# The code for the build image should be identical with the code in
# Dockerfile.nginx to use the caching mechanism of Docker.
# Ref: https://devguide.python.org/#branchstatus
FROM python:3.11.9-alpine3.20@sha256:df44c0c0761ddbd6388f4549cab42d24d64d257c2a960ad5b276bb7dab9639c7 AS base
FROM base AS build
WORKDIR /app
RUN \
apk update && \
apk add --no-cache \
gcc \
build-base \
bind-tools \
postgresql16-client \
xmlsec \
git \
util-linux \
curl-dev \
openssl \
libffi-dev \
python3-dev \
libpq-dev \
&& \
rm -rf /var/cache/apk/* && \
true
COPY requirements.txt ./
# CPUCOUNT=1 is needed, otherwise the wheel for uwsgi won't always be build succesfully
# https://github.com/unbit/uwsgi/issues/1318#issuecomment-542238096
RUN CPUCOUNT=1 pip3 wheel --wheel-dir=/tmp/wheels -r ./requirements.txt
FROM base AS django-alpine
WORKDIR /app
ARG uid=1001
ARG gid=1337
ARG appuser=defectdojo
ENV appuser=${appuser}
RUN \
apk update && \
apk add --no-cache \
openjpeg \
jpeg \
tiff \
bind-tools \
xmlsec \
git \
util-linux \
postgresql16-client \
curl-dev \
openssl \
# needed for integration-tests
bash \
&& \
rm -rf /var/cache/apk/* && \
true
COPY --from=build /tmp/wheels /tmp/wheels
COPY requirements.txt ./
RUN export PYCURL_SSL_LIBRARY=openssl && \
pip3 install \
--no-cache-dir \
--no-index \
--find-links=/tmp/wheels \
-r ./requirements.txt
COPY \
docker/entrypoint-celery-beat.sh \
docker/entrypoint-celery-worker.sh \
docker/entrypoint-initializer.sh \
docker/entrypoint-uwsgi.sh \
docker/entrypoint-uwsgi-dev.sh \
docker/entrypoint-unit-tests.sh \
docker/entrypoint-unit-tests-devDocker.sh \
docker/wait-for-it.sh \
docker/secret-file-loader.sh \
docker/reach_database.sh \
docker/certs/* \
/
COPY wsgi.pymanage.py docker/unit-tests.sh ./
COPY dojo/ ./dojo/
# Add extra fixtures to docker image which are loaded by the initializer
COPY docker/extra_fixtures/* /app/dojo/fixtures/
COPY tests/ ./tests/
RUN \
# Remove placeholder copied from docker/certs
rm -f /readme.txt && \
# Remove placeholder copied from docker/extra_fixtures
rm -f dojo/fixtures/readme.txt && \
mkdir -p dojo/migrations && \
chmod g=u dojo/migrations && \
true
USER root
RUN \
addgroup --gid ${gid} ${appuser} && \
adduser --system --no-create-home --disabled-password --gecos '' \
--uid ${uid} --ingroup ${appuser} ${appuser} && \
chown -R root:root /app && \
chmod -R u+rwX,go+rX,go-w /app && \
# Allow for bind mounting local_settings.py and other setting overrides
chown -R root:${appuser} /app/dojo/settings && \
chmod -R 775 /app/dojo/settings && \
mkdir /var/run/${appuser} && \
chown ${appuser} /var/run/${appuser} && \
chmod g=u /var/run/${appuser} && \
chmod 775 /*.sh && \
mkdir -p media/threat && chown -R ${uid} media && \
# To avoid warning: (staticfiles.W004) The directory '/app/components/node_modules' in the STATICFILES_DIRS setting does not exist.
mkdir -p components/node_modules && \
chown ${appuser} components/node_modules
USER ${uid}
ENV \
"All env here and not shared"
ENTRYPOINT ["/entrypoint-uwsgi.sh"]
FROM django-alpine AS django-unittests
COPY unittests/ ./unittests/
entrypoint-uwsgi.sh
#!/bin/sh
# Allow for bind-mount multiple settings.py overrides
FILES=$(ls /app/docker/extra_settings/* 2>/dev/null)
NUM_FILES=$(echo "$FILES" | wc -w)
if [ "$NUM_FILES" -gt 0 ]; then
COMMA_LIST=$(echo "$FILES" | tr -s '[:blank:]' ', ')
echo "============================================================"
echo " Overriding DefectDojo's local_settings.py with multiple"
echo " Files: $COMMA_LIST"
echo "============================================================"
cp /app/docker/extra_settings/* /app/dojo/settings/
rm -f /app/dojo/settings/README.md
fi
umask 0002
# do the check with Django stack
python3 manage.py check
DD_UWSGI_LOGFORMAT_DEFAULT='[pid: %(pid)|app: -|req: -/-] %(addr) (%(dd_user)) {%(vars) vars in %(pktsize) bytes} [%(ctime)] %(method) %(uri) => generated %(rsize) bytes in %(msecs) msecs (%(proto) %(status)) %(headers) headers in %(hsize) bytes (%(switches) switches on core %(core))'
EXTRA_ARGS=""
if [ -n "${DD_UWSGI_MAX_FD}" ]; then
EXTRA_ARGS="${EXTRA_ARGS} --max-fd ${DD_UWSGI_MAX_FD}"
exec uwsgi \
"--${DD_UWSGI_MODE}" "${DD_UWSGI_ENDPOINT}" \
--protocol uwsgi \
--enable-threads \
--processes "${DD_UWSGI_NUM_OF_PROCESSES:-2}" \
--threads "${DD_UWSGI_NUM_OF_THREADS:-2}" \
--wsgi dojo.wsgi:application \
--buffer-size="${DD_UWSGI_BUFFER_SIZE:-8192}" \
--http 0.0.0.0:8081 --http-to "${DD_UWSGI_ENDPOINT}" \
--logformat "${DD_UWSGI_LOGFORMAT:-$DD_UWSGI_LOGFORMAT_DEFAULT}" \
$EXTRA_ARGS
# HTTP endpoint is enabled for Kubernetes liveness checks. It should not be exposed as a service.
5 months ago
Going to close this thread out as it divulging more into application level / coding support, support that we can not provide, we are only able to provide platform support.
Status changed to Closed brody • 5 months ago