-
Notifications
You must be signed in to change notification settings - Fork 1
feat: external monitoring mode + CI/CD pipeline #2
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
ViktorPalchynskyi
wants to merge
11
commits into
master
Choose a base branch
from
dev
base: master
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
11 commits
Select commit
Hold shift + click to select a range
eff5e48
feat: add external monitoring mode and Grafana dashboard
ViktorPalchynskyi 76e3da1
ci: add GitHub Actions pipeline for Docker Hub build and publish
ViktorPalchynskyi 4a97136
fix: remove log volume mounts in CI to avoid permission denied
ViktorPalchynskyi 7b137fe
fix: load .env in Makefile for external monitoring LOKI_URL validation
ViktorPalchynskyi 018a54f
fix: skip GHA cache write on fork PRs to prevent permission errors
ViktorPalchynskyi 89757b2
fix: mask credentials in LOKI_URL output
ViktorPalchynskyi 5a78e40
fix: stop standalone loki/grafana before starting external mode
ViktorPalchynskyi e90355b
ci: split CI/CD pipeline into separate verify and publish workflows
ViktorPalchynskyi 52cd842
docs: rewrite README with Docker Hub usage instructions
ViktorPalchynskyi 538222d
fix: add grafana profile to start-monitoring target
ViktorPalchynskyi 07ee6c1
fix: remove .env include from Makefile to prevent dollar-sign corruption
ViktorPalchynskyi 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
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,49 @@ | ||||||||||||
| name: Publish | ||||||||||||
|
|
||||||||||||
| on: | ||||||||||||
| push: | ||||||||||||
| branches: [master] | ||||||||||||
| tags: ['v*'] | ||||||||||||
|
|
||||||||||||
| env: | ||||||||||||
| IMAGE_NAME: viktorpalchynskyi/nginx-security | ||||||||||||
|
|
||||||||||||
| jobs: | ||||||||||||
| publish: | ||||||||||||
| runs-on: ubuntu-latest | ||||||||||||
|
Comment on lines
+12
to
+13
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add there enviroment, in order to get limited secrets
Suggested change
|
||||||||||||
| steps: | ||||||||||||
| - uses: actions/checkout@v4 | ||||||||||||
|
|
||||||||||||
| - name: Set up QEMU | ||||||||||||
| uses: docker/setup-qemu-action@v3 | ||||||||||||
|
|
||||||||||||
| - name: Set up Docker Buildx | ||||||||||||
| uses: docker/setup-buildx-action@v3 | ||||||||||||
|
|
||||||||||||
| - name: Login to Docker Hub | ||||||||||||
| uses: docker/login-action@v3 | ||||||||||||
| with: | ||||||||||||
| username: ${{ secrets.DOCKERHUB_USERNAME }} | ||||||||||||
| password: ${{ secrets.DOCKERHUB_TOKEN }} | ||||||||||||
|
|
||||||||||||
| - name: Docker metadata | ||||||||||||
| id: meta | ||||||||||||
| uses: docker/metadata-action@v5 | ||||||||||||
| with: | ||||||||||||
| images: ${{ env.IMAGE_NAME }} | ||||||||||||
| tags: | | ||||||||||||
| type=raw,value=latest,enable={{is_default_branch}} | ||||||||||||
| type=sha,prefix=sha- | ||||||||||||
| type=semver,pattern={{version}} | ||||||||||||
| type=semver,pattern={{major}}.{{minor}} | ||||||||||||
|
|
||||||||||||
| - name: Build and push | ||||||||||||
| uses: docker/build-push-action@v6 | ||||||||||||
| with: | ||||||||||||
| context: . | ||||||||||||
| platforms: linux/amd64,linux/arm64 | ||||||||||||
| push: true | ||||||||||||
| tags: ${{ steps.meta.outputs.tags }} | ||||||||||||
| labels: ${{ steps.meta.outputs.labels }} | ||||||||||||
| cache-from: type=gha | ||||||||||||
| cache-to: type=gha,mode=max | ||||||||||||
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,54 @@ | ||
| name: Verify | ||
|
|
||
| on: | ||
| push: | ||
| branches: [master] | ||
| pull_request: | ||
| branches: [master] | ||
|
|
||
| env: | ||
| IMAGE_NAME: viktorpalchynskyi/nginx-security | ||
|
|
||
| jobs: | ||
| verify: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
|
|
||
| - name: Build image for testing | ||
| uses: docker/build-push-action@v6 | ||
| with: | ||
| context: . | ||
| load: true | ||
| tags: ${{ env.IMAGE_NAME }}:test | ||
| cache-from: type=gha | ||
| cache-to: ${{ github.event.pull_request.head.repo.fork != true && 'type=gha,mode=max' || '' }} | ||
|
|
||
| - name: Start test environment | ||
| run: | | ||
| docker network create test-net | ||
| docker run -d --name httpbin --network test-net kennethreitz/httpbin:latest | ||
| docker run -d --name nginx-security \ | ||
| --network test-net \ | ||
| -e BACKEND=http://httpbin:80 \ | ||
| -p 8080:8080 \ | ||
| ${{ env.IMAGE_NAME }}:test | ||
| echo "Waiting for nginx to start..." | ||
| sleep 15 | ||
| curl -sf http://localhost:8080/healthz || (docker logs nginx-security && exit 1) | ||
|
|
||
| - name: Run security tests | ||
| run: ./scripts/test-security.sh localhost:8080 http | ||
|
|
||
| - name: Run false positive tests | ||
| run: ./scripts/test-false-positives.sh localhost:8080 http | ||
|
|
||
| - name: Stop test environment | ||
| if: always() | ||
| run: | | ||
| docker stop nginx-security httpbin 2>/dev/null || true | ||
| docker rm nginx-security httpbin 2>/dev/null || true | ||
| docker network rm test-net 2>/dev/null || true |
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.
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.
I set it through enviroment, so you need to remove