-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from devxp-tech/hotfix/devspace/helm
Hotfix/devspace/helm
- Loading branch information
Showing
7 changed files
with
67 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,34 @@ | ||
FROM nginx/nginx-prometheus-exporter as exporter | ||
# Use the official Nginx base image | ||
FROM nginx:alpine | ||
|
||
ENV PORT 80 | ||
# Install curl to fetch nginx-prometheus-exporter | ||
RUN apk add --no-cache curl tar | ||
|
||
WORKDIR /app | ||
# Set the version of nginx-prometheus-exporter to install | ||
ENV NGINX_PROMETHEUS_EXPORTER_VERSION=1.1.2 | ||
|
||
COPY app/ /usr/share/nginx/html | ||
# copy config and exporter | ||
COPY --from=exporter /usr/bin/nginx-prometheus-exporter /usr/bin/nginx-prometheus-exporter | ||
# Download and install nginx-prometheus-exporter | ||
RUN curl -L https://github.com/nginxinc/nginx-prometheus-exporter/releases/download/v${NGINX_PROMETHEUS_EXPORTER_VERSION}/nginx-prometheus-exporter_${NGINX_PROMETHEUS_EXPORTER_VERSION}_linux_amd64.tar.gz \ | ||
| tar -zx -C /usr/local/bin | ||
|
||
# Copy the static application files to the Nginx document root | ||
COPY ./app /usr/share/nginx/html | ||
|
||
# Copy the health check file | ||
COPY health-check/liveness/index.html /usr/share/nginx/html/health-check/liveness/index.html | ||
COPY health-check/readness/index.html /usr/share/nginx/html/health-check/readness/index.html | ||
|
||
|
||
# Copy the custom Nginx configuration | ||
COPY conf/nginx.conf /etc/nginx/nginx.conf | ||
COPY conf/supervisor.conf /etc/supervisor/supervisor.conf | ||
COPY conf/default.conf /etc/nginx/conf.d/default.conf | ||
COPY conf/stub_status.conf /etc/nginx/conf.d/stub_status.conf | ||
|
||
RUN apk add --no-cache supervisor | ||
# Expose ports for Nginx and Prometheus metrics | ||
EXPOSE 80 9090 | ||
|
||
# Add a health check instruction | ||
HEALTHCHECK --interval=30s --timeout=5s --retries=3 CMD curl -f http://localhost/health-check/liveness || exit 1 | ||
|
||
EXPOSE 80 9113 | ||
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/supervisor.conf"] | ||
# Start Nginx and nginx-prometheus-exporter | ||
CMD ["sh", "-c", "nginx -g 'daemon off;' & nginx-prometheus-exporter -nginx.scrape-uri http://127.0.0.1:8080/stub_status -web.listen-address :9090"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
server { | ||
listen 80; | ||
location / { | ||
root /usr/share/nginx/html; | ||
index index.html; | ||
} | ||
location /health-check/liveness { | ||
alias /usr/share/nginx/html/health-check/liveness/; | ||
} | ||
location /health-check/readness { | ||
alias /usr/share/nginx/html/health-check/readness/; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,81 +1,27 @@ | ||
user nginx; | ||
worker_processes auto; | ||
|
||
error_log /var/log/nginx/error.log warn; | ||
pid /var/run/nginx.pid; | ||
user nginx; | ||
worker_processes auto; | ||
error_log /var/log/nginx/error.log; | ||
pid /run/nginx.pid; | ||
|
||
events { | ||
worker_connections 1024; | ||
worker_connections 1024; | ||
} | ||
|
||
include /etc/nginx/conf.d/*-root.conf; | ||
|
||
http { | ||
server_tokens off; | ||
include /etc/nginx/mime.types; | ||
default_type application/octet-stream; | ||
|
||
log_format main '$remote_addr - $remote_user [$time_local] "$request" ' | ||
'$status $body_bytes_sent "$http_referer" ' | ||
'"$http_user_agent" "$http_x_forwarded_for"'; | ||
|
||
access_log /var/log/nginx/access.log main; | ||
|
||
keepalive_timeout 65; | ||
sendfile on; | ||
tcp_nopush on; | ||
port_in_redirect off; | ||
|
||
server { | ||
listen 80; | ||
charset utf-8; | ||
server_name _; | ||
|
||
real_ip_header x-forwarded-for; | ||
set_real_ip_from 0.0.0.0/0; | ||
real_ip_recursive on; | ||
log_format main '$remote_addr - $remote_user [$time_local] "$request" ' | ||
'$status $body_bytes_sent "$http_referer" ' | ||
'"$http_user_agent" "$http_x_forwarded_for"'; | ||
|
||
root /app/dist; | ||
index index.html; | ||
access_log /var/log/nginx/access.log main; | ||
|
||
location ~ /\. { | ||
deny all; | ||
access_log off; | ||
log_not_found off; | ||
return 404; | ||
} | ||
sendfile on; | ||
tcp_nopush on; | ||
tcp_nodelay on; | ||
keepalive_timeout 65; | ||
types_hash_max_size 2048; | ||
|
||
location ~* \.(?:css|js)$ { | ||
access_log off; | ||
log_not_found off; | ||
add_header Cache-Control "no-cache, public, must-revalidate, proxy-revalidate"; | ||
} | ||
include /etc/nginx/mime.types; | ||
default_type application/octet-stream; | ||
|
||
location ~* \.(?:jpg|jpeg|gif|png|ico|xml|webp|eot|woff|woff2|ttf|svg|otf)$ { | ||
access_log off; | ||
log_not_found off; | ||
expires 60m; | ||
add_header Cache-Control "public"; | ||
} | ||
|
||
location / { | ||
try_files $uri $uri/ /; | ||
} | ||
|
||
include /etc/nginx/conf.d/*-server.conf; | ||
|
||
} | ||
|
||
# metrics | ||
server { | ||
listen 8000; | ||
server_name _; | ||
|
||
location /stub_status { | ||
stub_status on; | ||
access_log off; | ||
} | ||
} | ||
|
||
include /etc/nginx/conf.d/*-http.conf; | ||
} | ||
include /etc/nginx/conf.d/*.conf; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
server { | ||
listen 8080; | ||
location /stub_status { | ||
stub_status; | ||
allow 127.0.0.1; | ||
deny all; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
healthy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ready |