diff --git a/.dockerignore b/.dockerignore index dc1b8f95..fef89321 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,2 +1,17 @@ +.git/ +.github/ +.holo/ +computer-vision-form-project/ env/ -frontend/ \ No newline at end of file +frontend/ +helm-chart/ +metabase/ +node_modules/ +script/ +unified-reporting-system/ + +**/*.md +.dockerignore +.gitignore +Dockerfile +docker-compose.yml diff --git a/Dockerfile b/Dockerfile index ab8d48e2..39a4cf2f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,7 @@ FROM python:3.7-slim ARG APP_USER=appuser +ENV DJANGO_SETTINGS_MODULE=core.settings.docker COPY . /app WORKDIR /app @@ -27,6 +28,8 @@ RUN set -ex \ ' \ && apt-get update && apt-get install -y $buildDeps --no-install-recommends \ && pip install pipenv && pip install uwsgi && pipenv install --system \ - && apt-get purge -y --auto-remove $buildDeps + && apt-get purge -y --auto-remove $buildDeps + +RUN python manage.py collectstatic --no-input CMD ["uwsgi", "uwsgi.ini"] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index e9c443a8..c8ac4840 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -13,8 +13,6 @@ services: - "8000:8000" depends_on: - db - environment: - - DJANGO_SETTINGS_MODULE=core.settings.docker client: build: ./frontend ports: diff --git a/frontend/.dockerignore b/frontend/.dockerignore index 2b4984e5..320047fd 100644 --- a/frontend/.dockerignore +++ b/frontend/.dockerignore @@ -1,4 +1,7 @@ +.cache/ +dist/ node_modules/ test/ -.cache -dist/ \ No newline at end of file + +Dockerfile +nginx.conf diff --git a/frontend/Dockerfile b/frontend/Dockerfile index 8fcdecd5..cf086256 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -5,4 +5,3 @@ RUN yarn && yarn build FROM nginx:alpine COPY --from=0 /app/dist /usr/share/nginx/html -COPY ./nginx.conf /etc/nginx/conf.d/default.conf diff --git a/helm-chart/templates/deployment.yaml b/helm-chart/templates/deployment.yaml index 6d8d2cda..cfad6ded 100644 --- a/helm-chart/templates/deployment.yaml +++ b/helm-chart/templates/deployment.yaml @@ -34,7 +34,6 @@ spec: hostAliases: - ip: "127.0.0.1" hostnames: - - "app" - "db" containers: {{- with .Values.backend }} @@ -47,14 +46,14 @@ spec: env: - name: DJANGO_SETTINGS_MODULE value: core.settings.docker - # livenessProbe: - # httpGet: - # path: / - # port: 8000 - # readinessProbe: - # httpGet: - # path: / - # port: 8000 + livenessProbe: + httpGet: + path: /admin/ + port: 8000 + readinessProbe: + httpGet: + path: /admin/ + port: 8000 {{- end }} {{- with .Values.frontend }} - name: {{ $.Chart.Name }}-frontend diff --git a/helm-chart/templates/ingress.yaml b/helm-chart/templates/ingress.yaml index aea2e685..7caf38d3 100644 --- a/helm-chart/templates/ingress.yaml +++ b/helm-chart/templates/ingress.yaml @@ -1,6 +1,5 @@ {{- if .Values.ingress.enabled -}} {{- $fullName := include "prevention-point.fullname" . -}} -{{- $svcPort := .Values.service.port -}} {{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} apiVersion: networking.k8s.io/v1beta1 {{- else -}} @@ -36,7 +35,19 @@ spec: - path: {{ . }} backend: serviceName: {{ $fullName }} - servicePort: {{ $svcPort }} + servicePort: frontend-http + - path: {{ . | trimSuffix "/" }}/api/ + backend: + serviceName: {{ $fullName }} + servicePort: backend-http + - path: {{ . | trimSuffix "/" }}/admin/ + backend: + serviceName: {{ $fullName }} + servicePort: backend-http + - path: {{ . | trimSuffix "/" }}/static/admin/ + backend: + serviceName: {{ $fullName }} + servicePort: backend-http {{- end }} {{- end }} {{- end }} diff --git a/helm-chart/templates/service.yaml b/helm-chart/templates/service.yaml index fb2c6a3a..a7eae7b2 100644 --- a/helm-chart/templates/service.yaml +++ b/helm-chart/templates/service.yaml @@ -8,9 +8,13 @@ metadata: spec: type: {{ .Values.service.type }} ports: - - port: {{ .Values.service.port }} + - port: 80 targetPort: http protocol: TCP - name: http + name: frontend-http + - port: 8000 + targetPort: 8000 + protocol: TCP + name: backend-http selector: {{- include "prevention-point.selectorLabels" . | nindent 4 }} diff --git a/helm-chart/values.yaml b/helm-chart/values.yaml index 14fe4eee..3209c239 100644 --- a/helm-chart/values.yaml +++ b/helm-chart/values.yaml @@ -41,7 +41,6 @@ podSecurityContext: {} service: type: ClusterIP - port: 80 ingress: enabled: false diff --git a/script/server b/script/server index e4d6c022..fa2d16d2 100755 --- a/script/server +++ b/script/server @@ -13,10 +13,6 @@ echo echo "==> Starting containers with docker-composeā€¦" docker-compose up -d --build -echo -echo "==> Initialize static assets" -docker-compose exec app python manage.py collectstatic - echo echo "==> App is now ready to go!" echo " *Open http://localhost:8080"