From 49a347b32f09aacfb381ba5b47018dbb352d20f8 Mon Sep 17 00:00:00 2001 From: "Langhammer, Jens" Date: Tue, 19 Nov 2019 18:00:29 +0100 Subject: [PATCH] static(major): switch to pixie for static files --- docker-compose.yml | 2 +- docker/nginx.conf | 66 ------------------- .../passbook/templates/static-deployment.yaml | 5 +- helm/passbook/templates/static-service.yaml | 2 +- static.Dockerfile | 4 +- 5 files changed, 5 insertions(+), 74 deletions(-) delete mode 100644 docker/nginx.conf diff --git a/docker-compose.yml b/docker-compose.yml index a510365c6..3d09c4ad3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -68,7 +68,7 @@ services: - internal labels: - traefik.frontend.rule=PathPrefix:/static, /robots.txt - - traefik.port=80 + - traefik.port=8080 - traefik.docker.network=internal traefik: image: traefik:1.7 diff --git a/docker/nginx.conf b/docker/nginx.conf deleted file mode 100644 index 1bf56b2e2..000000000 --- a/docker/nginx.conf +++ /dev/null @@ -1,66 +0,0 @@ -user nginx; -worker_processes 1; - -error_log stderr warn; -pid /var/run/nginx.pid; - -events { - worker_connections 1024; -} - -http { - include /etc/nginx/mime.types; - default_type application/octet-stream; - - log_format json_combined escape=json - '{' - '"time_local":"$time_local",' - '"remote_addr":"$remote_addr",' - '"remote_user":"$remote_user",' - '"request":"$request",' - '"status": "$status",' - '"body_bytes_sent":"$body_bytes_sent",' - '"request_time":"$request_time",' - '"http_referrer":"$http_referer",' - '"http_user_agent":"$http_user_agent"' - '}'; - - access_log /dev/stdout json_combined; - - sendfile on; - tcp_nopush on; - - keepalive_timeout 65; - - server { - - server_name _; - - gzip on; - gzip_types application/javascript image/* text/css; - gunzip on; - add_header X-passbook-Version 0.7.2-beta; - add_header Vary X-passbook-Version; - root /data/; - - location /_/healthz { - return 204; - } - location ~* \.(jpg|jpeg|png|gif|ico)$ { - expires 30d; - } - location ~* \.(css|js)$ { - expires 7d; - } - - } - - server { - - listen 8080; - - location = /stub_status { - stub_status; - } - } -} diff --git a/helm/passbook/templates/static-deployment.yaml b/helm/passbook/templates/static-deployment.yaml index 3f2ea6eab..a1c02d4e5 100644 --- a/helm/passbook/templates/static-deployment.yaml +++ b/helm/passbook/templates/static-deployment.yaml @@ -25,7 +25,7 @@ spec: imagePullPolicy: IfNotPresent ports: - name: http - containerPort: 80 + containerPort: 8080 protocol: TCP livenessProbe: initialDelaySeconds: 10 @@ -46,6 +46,3 @@ spec: limits: cpu: 20m memory: 20M - - name: {{ .Chart.Name }}-static-prometheus - image: nginx/nginx-prometheus-exporter:0.4.1 - imagePullPolicy: IfNotPresent diff --git a/helm/passbook/templates/static-service.yaml b/helm/passbook/templates/static-service.yaml index c8b717429..4050906ab 100644 --- a/helm/passbook/templates/static-service.yaml +++ b/helm/passbook/templates/static-service.yaml @@ -11,7 +11,7 @@ metadata: spec: type: ClusterIP ports: - - port: 80 + - port: 8080 targetPort: http protocol: TCP name: http diff --git a/static.Dockerfile b/static.Dockerfile index 7a16a8dfe..a371d41a2 100644 --- a/static.Dockerfile +++ b/static.Dockerfile @@ -10,8 +10,8 @@ ENV PASSBOOK_POSTGRESQL__USER=passbook ENV PASSBOOK_POSTGRESQL__PASSWORD="EK-5jnKfjrGRm<77" RUN ./manage.py collectstatic --no-input -FROM nginx:latest +FROM docker.beryju.org/pixie/server COPY --from=static-build /app/static /data/static/ COPY --from=static-build /app/static/robots.txt /data/robots.txt -COPY ./docker/nginx.conf /etc/nginx/nginx.conf +WORKDIR /data