Skip to content

[dashboard] Replace nginx with caddy #3851

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 0 additions & 23 deletions chart/templates/dashboard-configmap.yaml

This file was deleted.

4 changes: 2 additions & 2 deletions chart/templates/dashboard-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ spec:
readinessProbe:
failureThreshold: 3
httpGet:
path: /schemas/gitpod-schema.json
port: 80
path: /ready
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that would only mean "the http service is running", the previous check means "the dashboard is served". in-between there might be error cases.

@geropl, do you know why we started to use actual resources from the dashboard to be tested for in the readiness probe?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can imagine several scenarios why that was:

  • convenience: by testing well known dashboard resources, we don't have to think about other paths that we might want to use
  • previous breakage: we may have had some misconfiguration at some point and then moved to checking a dashboard resource

Either way, once caddy is running it would serve the dashboard. It makes sense to me to use a readiness endpoint of caddy here.

port: 8080
scheme: HTTP
periodSeconds: 1
successThreshold: 1
Expand Down
3 changes: 0 additions & 3 deletions chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,6 @@ components:

dashboard:
name: "dashboard"
dependsOn:
- "dashboard-configmap.yaml"
resources:
cpu: 100m
memory: 32Mi
Expand All @@ -186,7 +184,6 @@ components:
expose: true
containerPort: 80
servicePort: 3001
config:
serviceType: ClusterIP

imageBuilder:
Expand Down
44 changes: 44 additions & 0 deletions components/dashboard/conf/Caddyfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
auto_https off
admin off
}

(compression) {
encode zstd gzip
}

(caching) {
header Cache-Control "public, max-age=604800, must-revalidate"
Copy link
Member

@geropl geropl Apr 12, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aledbf Until now caching was the responsibility of the "front-facing" proxy (cmp. here).

This looks fine generally, but we should double check the results, and ideally either:
a) cross-link with comments, or better
b) merge into one place.

}

(default) {
header -Server
}

(discard_log) {
log {
output discard
}
}

:80 {
import caching
import compression
import default
import discard_log

redir /.well-known/security.txt https://www.gitpod.io/.well-known/security.txt permanent
redir /environment-variables /settings/ permanent

root * /www
file_server
try_files {path} {path}/ /index.html
}

# health-check
:8080 {
import discard_log

respond /live 200
respond /ready 200
}
13 changes: 0 additions & 13 deletions components/dashboard/conf/conf.d/server-80.conf

This file was deleted.

37 changes: 0 additions & 37 deletions components/dashboard/conf/nginx.conf

This file was deleted.

12 changes: 3 additions & 9 deletions components/dashboard/leeway.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,7 @@
# See License-AGPL.txt in the project root for license information.


FROM nginx:stable-alpine
FROM caddy/caddy:2.4.0-beta.2-alpine

# Remove default stuff
RUN rm -Rf /etc/nginx/conf.d \
&& rm -f /etc/nginx/nginx.conf

COPY components-dashboard--static/conf/nginx.conf /etc/nginx/nginx.conf
COPY components-dashboard--static/conf/conf.d /etc/nginx/conf.d

COPY components-dashboard--app/build /www/data/dashboard
COPY components-dashboard--static/conf/Caddyfile /etc/caddy/Caddyfile
COPY components-dashboard--app/build /www