Skip to content
8 changes: 5 additions & 3 deletions .github/workflows/ci-test-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ jobs:
MONGO_URL: 'mongodb://host.docker.internal:27017/rocketchat?replicaSet=rs0&directConnection=true'
run: |
# when we are testing CE, we only need to start the rocketchat container
docker compose -f docker-compose-ci.yml up -d rocketchat
docker compose -f docker-compose-ci.yml up -d rocketchat varnish

- name: Start containers for EE
if: inputs.release == 'ee'
Expand Down Expand Up @@ -221,7 +221,9 @@ jobs:
done;

- name: Remove unused Docker images
run: docker system prune -af
run: |
docker compose -f docker-compose-ci.yml logs varnish
docker system prune -af

- name: E2E Test API
if: inputs.type == 'api'
Expand Down Expand Up @@ -295,7 +297,7 @@ jobs:

- name: Show server logs if E2E test failed
if: failure() && inputs.release != 'ee'
run: docker compose -f docker-compose-ci.yml logs rocketchat
run: docker compose -f docker-compose-ci.yml logs

- name: Extract e2e:ee:coverage
if: inputs.type == 'ui' && inputs.release == 'ee'
Expand Down
17 changes: 16 additions & 1 deletion docker-compose-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ services:
traefik.enable: true
traefik.http.services.rocketchat.loadbalancer.server.port: 3000
traefik.http.routers.rocketchat.service: rocketchat
traefik.http.routers.rocketchat.rule: PathPrefix(`/`)
traefik.http.routers.rocketchat.rule: PathPrefix(`/sockjs`) || PathPrefix(`/health`)
traefik.http.middlewares.test-retry.retry.attempts: 4

authorization-service:
Expand Down Expand Up @@ -166,6 +166,21 @@ services:
nats:
image: nats:2.6-alpine

varnish:
image: varnish:stable
volumes:
- ./varnish/default.vcl:/etc/varnish/default.vcl
environment:
- VARNISH_SIZE=2G
depends_on:
- rocketchat
labels:
traefik.enable: true
traefik.http.services.varnish.loadbalancer.server.port: 80
traefik.http.routers.varnish.service: varnish
traefik.http.routers.varnish.rule: PathPrefix(`/`) && !PathPrefix(`/sockjs`) && !PathPrefix(`/websocket`) && !PathPrefix(`/health`)
traefik.http.middlewares.varnish-cache.headers.customrequestheaders.X-Forwarded-Proto: https

traefik:
image: traefik:v3.1
command:
Expand Down
37 changes: 37 additions & 0 deletions varnish/default.vcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
vcl 4.0;

backend default {
.host = "rocketchat";
.port = "3000";
}

sub vcl_recv {

if(req.url ~ "/websocket$") {
return (pipe);
}


# Don't cache WebSocket connections
if (req.http.Upgrade ~ "(?i)websocket") {
return (pipe);
}


# Don't cache API requests
if (req.url ~ "^/api/") {
return (pass);
}

# Cache static assets
if (req.url ~ "\.(css|js|jpg|jpeg|png|gif|ico|woff|woff2|ttf|eot)$") {
return (hash);
}
}

sub vcl_backend_response {
# Cache successful responses for 1 hour
if (beresp.status == 200) {
set beresp.ttl = 1h;
}
}
Loading