Skip to content

Commit

Permalink
Merge pull request #506 from CodeForPhilly/fixes/enable-admin
Browse files Browse the repository at this point in the history
fix(ci): cleanup deploy and enable admin
  • Loading branch information
themightychris authored Feb 17, 2021
2 parents ece579f + 39784ad commit 4d6967e
Show file tree
Hide file tree
Showing 10 changed files with 52 additions and 25 deletions.
17 changes: 16 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,17 @@
.git/
.github/
.holo/
computer-vision-form-project/
env/
frontend/
frontend/
helm-chart/
metabase/
node_modules/
script/
unified-reporting-system/

**/*.md
.dockerignore
.gitignore
Dockerfile
docker-compose.yml
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
FROM python:3.7-slim

ARG APP_USER=appuser
ENV DJANGO_SETTINGS_MODULE=core.settings.docker

COPY . /app
WORKDIR /app
Expand All @@ -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"]
2 changes: 0 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ services:
- "8000:8000"
depends_on:
- db
environment:
- DJANGO_SETTINGS_MODULE=core.settings.docker
client:
build: ./frontend
ports:
Expand Down
7 changes: 5 additions & 2 deletions frontend/.dockerignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
.cache/
dist/
node_modules/
test/
.cache
dist/

Dockerfile
nginx.conf
1 change: 0 additions & 1 deletion frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
17 changes: 8 additions & 9 deletions helm-chart/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ spec:
hostAliases:
- ip: "127.0.0.1"
hostnames:
- "app"
- "db"
containers:
{{- with .Values.backend }}
Expand All @@ -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
Expand Down
15 changes: 13 additions & 2 deletions helm-chart/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -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 -}}
Expand Down Expand Up @@ -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 }}
8 changes: 6 additions & 2 deletions helm-chart/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
1 change: 0 additions & 1 deletion helm-chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ podSecurityContext: {}

service:
type: ClusterIP
port: 80

ingress:
enabled: false
Expand Down
4 changes: 0 additions & 4 deletions script/server
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 4d6967e

Please sign in to comment.