Skip to content

Commit 4d6967e

Browse files
Merge pull request #506 from CodeForPhilly/fixes/enable-admin
fix(ci): cleanup deploy and enable admin
2 parents ece579f + 39784ad commit 4d6967e

File tree

10 files changed

+52
-25
lines changed

10 files changed

+52
-25
lines changed

.dockerignore

+16-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,17 @@
1+
.git/
2+
.github/
3+
.holo/
4+
computer-vision-form-project/
15
env/
2-
frontend/
6+
frontend/
7+
helm-chart/
8+
metabase/
9+
node_modules/
10+
script/
11+
unified-reporting-system/
12+
13+
**/*.md
14+
.dockerignore
15+
.gitignore
16+
Dockerfile
17+
docker-compose.yml

Dockerfile

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
FROM python:3.7-slim
22

33
ARG APP_USER=appuser
4+
ENV DJANGO_SETTINGS_MODULE=core.settings.docker
45

56
COPY . /app
67
WORKDIR /app
@@ -27,6 +28,8 @@ RUN set -ex \
2728
' \
2829
&& apt-get update && apt-get install -y $buildDeps --no-install-recommends \
2930
&& pip install pipenv && pip install uwsgi && pipenv install --system \
30-
&& apt-get purge -y --auto-remove $buildDeps
31+
&& apt-get purge -y --auto-remove $buildDeps
32+
33+
RUN python manage.py collectstatic --no-input
3134

3235
CMD ["uwsgi", "uwsgi.ini"]

docker-compose.yml

-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ services:
1313
- "8000:8000"
1414
depends_on:
1515
- db
16-
environment:
17-
- DJANGO_SETTINGS_MODULE=core.settings.docker
1816
client:
1917
build: ./frontend
2018
ports:

frontend/.dockerignore

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1+
.cache/
2+
dist/
13
node_modules/
24
test/
3-
.cache
4-
dist/
5+
6+
Dockerfile
7+
nginx.conf

frontend/Dockerfile

-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,3 @@ RUN yarn && yarn build
55

66
FROM nginx:alpine
77
COPY --from=0 /app/dist /usr/share/nginx/html
8-
COPY ./nginx.conf /etc/nginx/conf.d/default.conf

helm-chart/templates/deployment.yaml

+8-9
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ spec:
3434
hostAliases:
3535
- ip: "127.0.0.1"
3636
hostnames:
37-
- "app"
3837
- "db"
3938
containers:
4039
{{- with .Values.backend }}
@@ -47,14 +46,14 @@ spec:
4746
env:
4847
- name: DJANGO_SETTINGS_MODULE
4948
value: core.settings.docker
50-
# livenessProbe:
51-
# httpGet:
52-
# path: /
53-
# port: 8000
54-
# readinessProbe:
55-
# httpGet:
56-
# path: /
57-
# port: 8000
49+
livenessProbe:
50+
httpGet:
51+
path: /admin/
52+
port: 8000
53+
readinessProbe:
54+
httpGet:
55+
path: /admin/
56+
port: 8000
5857
{{- end }}
5958
{{- with .Values.frontend }}
6059
- name: {{ $.Chart.Name }}-frontend

helm-chart/templates/ingress.yaml

+13-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{{- if .Values.ingress.enabled -}}
22
{{- $fullName := include "prevention-point.fullname" . -}}
3-
{{- $svcPort := .Values.service.port -}}
43
{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
54
apiVersion: networking.k8s.io/v1beta1
65
{{- else -}}
@@ -36,7 +35,19 @@ spec:
3635
- path: {{ . }}
3736
backend:
3837
serviceName: {{ $fullName }}
39-
servicePort: {{ $svcPort }}
38+
servicePort: frontend-http
39+
- path: {{ . | trimSuffix "/" }}/api/
40+
backend:
41+
serviceName: {{ $fullName }}
42+
servicePort: backend-http
43+
- path: {{ . | trimSuffix "/" }}/admin/
44+
backend:
45+
serviceName: {{ $fullName }}
46+
servicePort: backend-http
47+
- path: {{ . | trimSuffix "/" }}/static/admin/
48+
backend:
49+
serviceName: {{ $fullName }}
50+
servicePort: backend-http
4051
{{- end }}
4152
{{- end }}
4253
{{- end }}

helm-chart/templates/service.yaml

+6-2
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,13 @@ metadata:
88
spec:
99
type: {{ .Values.service.type }}
1010
ports:
11-
- port: {{ .Values.service.port }}
11+
- port: 80
1212
targetPort: http
1313
protocol: TCP
14-
name: http
14+
name: frontend-http
15+
- port: 8000
16+
targetPort: 8000
17+
protocol: TCP
18+
name: backend-http
1519
selector:
1620
{{- include "prevention-point.selectorLabels" . | nindent 4 }}

helm-chart/values.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ podSecurityContext: {}
4141

4242
service:
4343
type: ClusterIP
44-
port: 80
4544

4645
ingress:
4746
enabled: false

script/server

-4
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@ echo
1313
echo "==> Starting containers with docker-compose…"
1414
docker-compose up -d --build
1515

16-
echo
17-
echo "==> Initialize static assets"
18-
docker-compose exec app python manage.py collectstatic
19-
2016
echo
2117
echo "==> App is now ready to go!"
2218
echo " *Open http://localhost:8080"

0 commit comments

Comments
 (0)