Skip to content

Commit

Permalink
chore:setup rate limiting for both data amount and request count
Browse files Browse the repository at this point in the history
chore: tweak
  • Loading branch information
valosnah committed Aug 28, 2024
1 parent be74ea2 commit 4619132
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM eclipse-temurin:17-jre-alpine

ARG USER=default
ENV HOME /home/$USER
ENV HOME=/home/$USER

ENV TZ=Europe/Oslo
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
Expand All @@ -16,4 +16,4 @@ USER $USER
WORKDIR $HOME

COPY --chown=app:app /target/app.jar app.jar
CMD java -jar -XX:+UseZGC $JAVA_OPTS app.jar
CMD ["sh", "-c", "java -jar -XX:+UseZGC $JAVA_OPTS app.jar"]
15 changes: 15 additions & 0 deletions deploy/demo/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,21 @@ apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: catalog-view-api
annotations:
nginx.ingress.kubernetes.io/proxy-buffering: 'on'
nginx.ingress.kubernetes.io/limit-rate-after: '15729'
nginx.ingress.kubernetes.io/limit-rate: '128'
nginx.ingress.kubernetes.io/limit-rpm: '10'
nginx.ingress.kubernetes.io/limit-burst-multiplier: '2'
nginx.ingress.kubernetes.io/proxy-read-timeout: '60'
nginx.ingress.kubernetes.io/proxy-send-timeout: '60'
nginx.ingress.kubernetes.io/limit-whitelist: '10.0.0.0/8'
nginx.ingress.kubernetes.io/server-snippet: |
server_tokens off;
location ~ ^/(ping|ready|prometheus) {
deny all;
return 404;
}
spec:
ingressClassName: nginx
rules:
Expand Down
15 changes: 15 additions & 0 deletions deploy/prod/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,21 @@ apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: catalog-view-api
annotations:
nginx.ingress.kubernetes.io/proxy-buffering: 'on'
nginx.ingress.kubernetes.io/limit-rate-after: '15729'
nginx.ingress.kubernetes.io/limit-rate: '128'
nginx.ingress.kubernetes.io/limit-rpm: '10'
nginx.ingress.kubernetes.io/limit-burst-multiplier: '2'
nginx.ingress.kubernetes.io/proxy-read-timeout: '60'
nginx.ingress.kubernetes.io/proxy-send-timeout: '60'
nginx.ingress.kubernetes.io/limit-whitelist: '10.0.0.0/8'
nginx.ingress.kubernetes.io/server-snippet: |
server_tokens off;
location ~ ^/(ping|ready|prometheus) {
deny all;
return 404;
}
spec:
ingressClassName: nginx
rules:
Expand Down
15 changes: 15 additions & 0 deletions deploy/staging/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,21 @@ apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: catalog-view-api
annotations:
nginx.ingress.kubernetes.io/proxy-buffering: 'on'
nginx.ingress.kubernetes.io/limit-rate-after: '15729'
nginx.ingress.kubernetes.io/limit-rate: '128'
nginx.ingress.kubernetes.io/limit-rpm: '10'
nginx.ingress.kubernetes.io/limit-burst-multiplier: '2'
nginx.ingress.kubernetes.io/proxy-read-timeout: '60'
nginx.ingress.kubernetes.io/proxy-send-timeout: '60'
nginx.ingress.kubernetes.io/limit-whitelist: '10.0.0.0/8'
nginx.ingress.kubernetes.io/server-snippet: |
server_tokens off;
location ~ ^/(ping|ready|prometheus) {
deny all;
return 404;
}
spec:
ingressClassName: nginx
rules:
Expand Down

0 comments on commit 4619132

Please sign in to comment.