-
-
Notifications
You must be signed in to change notification settings - Fork 156
fix(helm) Working helm chart with many enhancements #1184
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
Open
ikogan
wants to merge
12
commits into
CodeWithCJ:main
Choose a base branch
from
ikogan:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
34c22d2
Add non-root frontend image path
ikogan 2a637b0
Restore bundled PostgreSQL chart
ikogan 0707963
Add retained PVC database backups
ikogan 312463b
fix(helm): improve database handling and add customization features.
ikogan fa4f0f2
Merge branch 'CodeWithCJ:main' into main
ikogan 50baa7b
fix(ci): use DOCKER_USERNAME secret for Docker Hub image namespace
ikogan a622fdb
fix(helm, ci): Ignore helm chart dependency charts and fix case issue…
ikogan 2cde06b
fix(helm, backup): use superuser creds for pg_dumpall, improve backup…
ikogan 5935168
fix(helm): guard wait-for-db init container on postgresql.enabled and…
ikogan 89aed2e
fix(helm): make backup retention portable for Alpine and document ima…
ikogan 611a921
fix: backup security, portability, and image resolution improvements
ikogan e03089d
fix(backup): replace awk strftime with date -d @epoch for retention d…
ikogan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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,7 +1,8 @@ | ||
| docker buildx build --platform linux/amd64,linux/arm64 -t codewithcj/sparkyfitness:v0.15.0 -f docker/Dockerfile.frontend . --push | ||
| docker buildx build --platform linux/amd64,linux/arm64 -t codewithcj/sparkyfitness_frontend_nonroot:v0.15.0 --build-arg FRONTEND_BASE_IMAGE=codewithcj/sparkyfitness:v0.15.0 -f docker/Dockerfile.frontend.nonroot . --push | ||
| docker buildx build --platform linux/amd64,linux/arm64 -t codewithcj/sparkyfitness_server:v0.15.0 -f docker/Dockerfile.backend SparkyFitnessServer --push | ||
|
|
||
|
|
||
|
|
||
|
|
||
| docker-compose -f docker-compose.db_dev.yml up -d | ||
| docker-compose -f docker-compose.db_dev.yml up -d |
This file contains hidden or 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,24 @@ | ||
| ARG FRONTEND_BASE_IMAGE=codewithcj/sparkyfitness:latest | ||
| FROM ${FRONTEND_BASE_IMAGE} | ||
|
|
||
| # Reconfigure nginx so the frontend can run as an unprivileged user in | ||
| # Kubernetes while serving only static assets and SPA routes. API and upload | ||
| # routing is handled by Ingress/HTTPRoute rather than frontend proxying. | ||
| COPY docker/nginx.nonroot.conf.template /etc/nginx/templates/default.conf.template | ||
| COPY docker/docker-entrypoint.nonroot.sh /docker-entrypoint.sh | ||
|
|
||
| RUN chmod +x /docker-entrypoint.sh \ | ||
| && mkdir -p /var/run/nginx /var/cache/nginx /etc/nginx/conf.d \ | ||
| && chown -R 101:101 /var/run/nginx \ | ||
| /var/cache/nginx \ | ||
| /var/log/nginx \ | ||
| /etc/nginx/conf.d \ | ||
| /usr/share/nginx/html | ||
|
|
||
| USER 101:101 | ||
|
|
||
| EXPOSE 8080 | ||
|
|
||
| HEALTHCHECK --interval=5s --timeout=10s --retries=5 CMD wget -qO /dev/null http://127.0.0.1:8080/ || exit 1 | ||
|
|
||
| CMD ["/docker-entrypoint.sh"] |
This file contains hidden or 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,17 @@ | ||
| #!/bin/sh | ||
| set -eu | ||
|
|
||
| echo "Starting SparkyFitness Frontend (non-root)" | ||
|
|
||
| mkdir -p /var/run/nginx \ | ||
| /var/cache/nginx/client-body \ | ||
| /var/cache/nginx/proxy \ | ||
| /var/cache/nginx/fastcgi \ | ||
| /var/cache/nginx/uwsgi \ | ||
| /var/cache/nginx/scgi \ | ||
| /etc/nginx/conf.d | ||
|
|
||
| cp /etc/nginx/templates/default.conf.template /etc/nginx/conf.d/default.conf | ||
|
|
||
| nginx -t | ||
| exec nginx -g "daemon off;" | ||
This file contains hidden or 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,41 @@ | ||
| server { | ||
| listen 8080; | ||
| server_name localhost; | ||
|
|
||
| add_header X-Frame-Options "SAMEORIGIN" always; | ||
| add_header X-Content-Type-Options "nosniff" always; | ||
| add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline' https:; style-src 'self' 'unsafe-inline' https:; img-src 'self' data: https:; font-src 'self' https:;" always; | ||
| add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always; | ||
|
|
||
| root /usr/share/nginx/html; | ||
| index index.html index.htm; | ||
|
|
||
| gzip on; | ||
| gzip_vary on; | ||
| gzip_min_length 1024; | ||
| gzip_proxied any; | ||
| gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/xml application/javascript application/json; | ||
| gzip_disable "MSIE [1-6]\."; | ||
|
|
||
| location /assets/ { | ||
| expires 1y; | ||
| add_header Cache-Control "public, no-transform, immutable"; | ||
| try_files $uri =404; | ||
| } | ||
|
|
||
| location ~* \.(?:png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ { | ||
| expires 7d; | ||
| add_header Cache-Control "public, no-transform, immutable"; | ||
| } | ||
|
|
||
| location / { | ||
| expires -1; | ||
| add_header Cache-Control "no-cache, no-store, must-revalidate"; | ||
| try_files $uri $uri/ /index.html; | ||
| } | ||
|
|
||
| client_max_body_size 10m; | ||
|
|
||
| access_log /dev/stdout; | ||
| error_log /dev/stderr warn; | ||
| } |
This file contains hidden or 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 @@ | ||
| chart/charts |
This file contains hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This script attempts to
mkdirandcpfiles at runtime. If the container is run withreadOnlyRootFilesystem: true(as set invalues.yaml), these operations will fail unless the target paths (like/etc/nginx/conf.dand/var/cache/nginx) are backed byemptyDirvolumes. The current Helm templates do not appear to include these volume mounts for the frontend component, which will prevent the non-root image from starting in restricted environments.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fronted container does indeed use emptyDir volumes for these:
Moreover, it is run with
readOnlyRootFilesystem: trueby default.