diff --git a/backend/Dockerfile b/backend/Dockerfile index 8f9299d72..fa6bc22b0 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -20,7 +20,7 @@ RUN npm run build FROM python:3.7 # Install dependencies -RUN apt -y update && apt -y install git build-essential gdal-bin libgdal-dev +RUN apt -y update && apt -y install git build-essential gdal-bin libgdal-dev postgresql-client ENV PATH="/usr/bin/python3:${PATH}" @@ -36,6 +36,7 @@ COPY ./backend/requirements.txt /app/requirements.txt COPY --from=frontend ./app/dist ./gwells/static COPY --from=frontend ./app/dist/index.html ./gwells/templates/ +# COPY /backend/startup.sh /docker-entrypoint-initdb.d/ # RUN chmod +x load_fixtures.sh works when i pull the dockerfile into backend but not when dockerfile is with other docker files RUN chmod +x /app @@ -46,9 +47,11 @@ RUN python3 -m pip install -r requirements.txt # TODO: move to entrypoint in deployment template? # chmod -R 777 /app && \ +# CMD [""] + CMD sh -c "python3 manage.py migrate --noinput && \ ./load_fixtures.sh all && \ python3 manage.py createinitialrevisions && \ python3 manage.py collectstatic --noinput && \ # python3 manage.py export --cleanup=1 --upload=1 && \ - python3 manage.py runserver 0.0.0.0:8000" + python3 manage.py runserver 0.0.0.0:8000" \ No newline at end of file diff --git a/backend/openshift.deploy.yml b/backend/openshift.deploy.yml index 522c1b1a9..04a0abc63 100644 --- a/backend/openshift.deploy.yml +++ b/backend/openshift.deploy.yml @@ -219,7 +219,7 @@ objects: - name: DATABASE_SERVICE_NAME value: ${REPO}-${ZONE}-database - name: DATABASE_PORT - value: 5432 + value: "5432" - name: DATABASE_NAME valueFrom: secretKeyRef: @@ -461,24 +461,22 @@ objects: memory: "${MEMORY_REQUEST}" readinessProbe: httpGet: - path: /gwells/health + path: /health port: 8000 - scheme: HTTP - initialDelaySeconds: 20 - timeoutSeconds: 3 - periodSeconds: 5 - successThreshold: 1 - failureThreshold: 5 + # initialDelaySeconds: 20 + # timeoutSeconds: 3 + # periodSeconds: 5 + # successThreshold: 1 + # failureThreshold: 5 livenessProbe: httpGet: - path: /gwells/health + path: /health port: 8000 - scheme: HTTP - initialDelaySeconds: 20 - timeoutSeconds: 3 - periodSeconds: 30 - successThreshold: 1 - failureThreshold: 5 + # initialDelaySeconds: 20 + # timeoutSeconds: 3 + # periodSeconds: 30 + # successThreshold: 1 + # failureThreshold: 5 terminationMessagePath: "/dev/termination-log" terminationMessagePolicy: File imagePullPolicy: Always diff --git a/backend/startup.sh b/backend/startup.sh new file mode 100644 index 000000000..345424529 --- /dev/null +++ b/backend/startup.sh @@ -0,0 +1,6 @@ +python3 manage.py migrate --noinput && +./load_fixtures.sh all && +python3 manage.py createinitialrevisions && +python3 manage.py collectstatic --noinput && +# python3 manage.py export --cleanup=1 --upload=1 && +python3 manage.py runserver 0.0.0.0:8000"