Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
d49790a
request latency histogram
wizzfi1 Sep 19, 2025
5ebbca1
grafana datasource
wizzfi1 Sep 19, 2025
95b1af0
alert rules
wizzfi1 Sep 19, 2025
019d3dc
alert rules
wizzfi1 Sep 19, 2025
6c1c6a8
Slack webhook workaround
wizzfi1 Sep 20, 2025
2ea2bcd
Slack webhook workaround
wizzfi1 Sep 20, 2025
1e76936
Slack webhook workaround
wizzfi1 Sep 20, 2025
aa37cb5
Slack webhook workaround
wizzfi1 Sep 20, 2025
740077d
docker permissions
wizzfi1 Sep 20, 2025
bba01a0
docker permissions
wizzfi1 Sep 20, 2025
f3019ba
Slack webhook workaround
wizzfi1 Sep 20, 2025
4d771f7
alertmanager deploy fix
wizzfi1 Sep 20, 2025
51ad47f
alertmanager deploy fix
wizzfi1 Sep 20, 2025
3bdad2a
alertmanager deploy fix
wizzfi1 Sep 20, 2025
f1ea722
Checkov and Terrascan
wizzfi1 Sep 20, 2025
6c29981
Checkov scan fix
wizzfi1 Sep 22, 2025
ec351bb
Checkov scan fix-CodeQL
wizzfi1 Sep 22, 2025
0a740eb
Docker non-root and healthcheck
wizzfi1 Sep 22, 2025
81bdf52
yaml error in Checkov
wizzfi1 Sep 22, 2025
eba1689
Render staging fix
wizzfi1 Sep 22, 2025
ae0f250
Render staging fix
wizzfi1 Sep 22, 2025
d311c21
sentry checkout
wizzfi1 Sep 22, 2025
465dc47
Helm charts
wizzfi1 Sep 24, 2025
d27025f
Checkov hardening
wizzfi1 Sep 24, 2025
f5a0905
checkov hardening- ingest
wizzfi1 Sep 24, 2025
5ca95eb
Checkov hardening fix
wizzfi1 Sep 24, 2025
9114ab4
checkov hardening - alertmanager
wizzfi1 Sep 25, 2025
ff3ab29
checkov hardening - alertmanager
wizzfi1 Sep 25, 2025
ddae9be
Checkov hardening - secrets
wizzfi1 Sep 25, 2025
cb0a599
Checkov hardening - secrets
wizzfi1 Sep 25, 2025
b4518a3
base64 hardening checkov
wizzfi1 Sep 25, 2025
8061ebe
base64 hardening checkov
wizzfi1 Sep 25, 2025
f4c3604
base64 hardening checkov
wizzfi1 Sep 25, 2025
321ceb7
redacted values fix
wizzfi1 Sep 25, 2025
dc6b23e
redacted values fix
wizzfi1 Sep 25, 2025
03c58c2
neutral names for checkov
wizzfi1 Sep 25, 2025
0cdcd23
checkov - network policy
wizzfi1 Sep 25, 2025
7db928c
checkov - network policy
wizzfi1 Sep 25, 2025
c2e96f9
checkov - network policy
wizzfi1 Sep 25, 2025
b4e7229
checkov - enthropy fix
wizzfi1 Sep 26, 2025
524a9fa
checkov - enthropy fix
wizzfi1 Sep 26, 2025
2b840f9
checkov - enthropy fix
wizzfi1 Sep 26, 2025
618c9d8
checkov - enthropy fix
wizzfi1 Sep 26, 2025
a158a58
checkov - enthropy fix
wizzfi1 Sep 26, 2025
7616db1
checkov - enthropy fix
wizzfi1 Sep 26, 2025
bb8d33a
workflow fix
wizzfi1 Sep 26, 2025
8a5d7f4
workflow fix
wizzfi1 Sep 26, 2025
58bfca8
workflow fix
wizzfi1 Sep 26, 2025
4cc2219
workflow fix
wizzfi1 Sep 26, 2025
f3d6bdc
workflow fix
wizzfi1 Sep 26, 2025
e0564b1
workflow debug
wizzfi1 Sep 26, 2025
5002626
workflow debug
wizzfi1 Sep 26, 2025
f044b16
undefined variables fix
wizzfi1 Sep 26, 2025
48683fe
undefined variables fix
wizzfi1 Sep 26, 2025
2fc0746
namespace fix
wizzfi1 Sep 26, 2025
f2365bd
namespace fix
wizzfi1 Sep 26, 2025
33a6b32
workflow permissions
wizzfi1 Sep 26, 2025
274e9b7
docker image hardening
wizzfi1 Sep 27, 2025
1244da1
workflow permissions
wizzfi1 Sep 27, 2025
cca3da5
docker image hardening
wizzfi1 Sep 27, 2025
e8c934b
docker image hardening
wizzfi1 Sep 27, 2025
7b49b27
docker image hardening
wizzfi1 Sep 27, 2025
5b10eae
docker image hardening
wizzfi1 Sep 27, 2025
8fac71d
docker image hardening
wizzfi1 Sep 27, 2025
c1a452e
docker image hardening
wizzfi1 Sep 27, 2025
c9cbc4e
docker image hardening
wizzfi1 Sep 27, 2025
2d4cf19
sentry
wizzfi1 Sep 27, 2025
a4a2a5b
sentry fetch fix
wizzfi1 Sep 27, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
144 changes: 109 additions & 35 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,18 @@ on:
pull_request:
branches: [ "main", "develop" ]

permissions:
contents: read
security-events: write

jobs:
build-test-scan:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0 # ← Crucial for Sentry and Checkov to see full history

- name: Setup Node.js
uses: actions/setup-node@v4
Expand All @@ -30,13 +36,65 @@ jobs:
- name: Dependency Audit
run: npm audit --audit-level=high

- name: Build Docker Image
run: docker build -t mydev:${{ github.sha }} .
# --- IaC Security Scans ---
- name: Checkov Scan (IaC security)
run: |
pip install checkov
checkov -d infra/ -d helm/ \
--check "CKV_K8S_*" \
--skip-check CKV_SECRET_6 \
--output sarif \
--output-file-path checkov.sarif \
--quiet

- name: Upload Checkov SARIF results
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: checkov.sarif

- name: Terrascan Scan (IaC security)
run: |
echo "🔍 Running Terrascan..."
curl -L "$(curl -s https://api.github.com/repos/tenable/terrascan/releases/latest | grep -o -E "https://.+?_Linux_x86_64.tar.gz")" > terrascan.tar.gz
tar -xf terrascan.tar.gz terrascan && rm terrascan.tar.gz
sudo mv terrascan /usr/local/bin/
terrascan scan -d infra/ -i terraform -t k8s || echo "Terrascan completed"

# --- Build + Scan Image ---
- name: Build Docker Images
run: |
docker build -t mydev:${{ github.sha }} .
docker build -t mydev-alertmanager:${{ github.sha }} infra/alertmanager/
docker build -t mydev-grafana:${{ github.sha }} infra/grafana/
docker build -t mydev-prometheus:${{ github.sha }} infra/prometheus/

- name: Trivy Scan
- name: Trivy Scan All Images
run: |
# Scan main app
trivy image --format table --severity HIGH,CRITICAL mydev:${{ github.sha }} || echo "Main app vulnerabilities found"

# Scan infrastructure images
for image in mydev-alertmanager mydev-grafana mydev-prometheus; do
echo "Scanning $image..."
trivy image --format table --severity HIGH,CRITICAL $image:${{ github.sha }} || echo "$image vulnerabilities found"
done

- name: Trivy Scan SARIF (Main App Only)
uses: aquasecurity/trivy-action@master
with:
image-ref: mydev:${{ github.sha }}
format: sarif
output: trivy.sarif
exit-code: 0
severity: HIGH,CRITICAL
ignore-unfixed: true
skip-version-check: true

- name: Upload Trivy SARIF results
if: always()
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: trivy.sarif

- name: Push to Docker Hub
run: |
Expand All @@ -52,57 +110,64 @@ jobs:
needs: build-test-scan
if: github.ref == 'refs/heads/develop'
steps:
- name: Checkout Code (full history)
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Trigger Render Staging Deploy
run: |
curl -X POST "https://api.render.com/v1/services/${{ secrets.RENDER_SERVICE }}/deploys" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${{ secrets.RENDER_API_KEY }}"
uses: fjogeleit/http-request-action@v1
with:
url: "https://api.render.com/v1/services/${{ secrets.RENDER_SERVICE_ID }}/deploys"
method: "POST"
customHeaders: '{"Accept": "application/json", "Authorization": "Bearer ${{ secrets.RENDER_API_KEY }}"}'

- name: Sentry Release (Staging)
uses: getsentry/action-release@v1
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
with:
environment: staging
version: ${{ github.sha }}
set_commits: auto
extra_args: --ignore-missing


deploy-prod:
runs-on: ubuntu-latest
needs: build-test-scan
if: github.ref == 'refs/heads/main'
steps:
- name: Trigger Render Production Deploy
run: |
curl -X POST "https://api.render.com/v1/services/${{ secrets.RENDER_SERVICE_ID_PROD }}/deploys" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${{ secrets.RENDER_API_KEY }}"

sentry-release:
runs-on: ubuntu-latest
needs: [deploy-staging, deploy-prod]
if: github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/main'
steps:
- name: Checkout Code
- name: Checkout Code (full history)
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Trigger Render Production Deploy
uses: fjogeleit/http-request-action@v1
with:
url: "https://api.render.com/v1/services/${{ secrets.RENDER_SERVICE_ID_PROD }}/deploys"
method: "POST"
customHeaders: '{"Accept": "application/json", "Authorization": "Bearer ${{ secrets.RENDER_API_KEY }}"}'

- name: Create and Finalize Sentry Release
- name: Sentry Release (Production)
uses: getsentry/action-release@v1
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
with:
environment: production
version: ${{ github.sha }}
environment: ${{ github.ref == 'refs/heads/main' && 'production' || 'staging' }}
finalize: true
set_commits: auto

- name: Mark Release as Deployed
run: |
ENVIRONMENT=${{ github.ref == 'refs/heads/main' && 'production' || 'staging' }}
VERSION=${{ github.sha }}
curl https://sentry.io/api/0/organizations/${{ secrets.SENTRY_ORG }}/releases/$VERSION/deploys/ \
-X POST \
-H "Authorization: Bearer ${{ secrets.SENTRY_AUTH_TOKEN }}" \
-H 'Content-Type: application/json' \
-d "{\"environment\":\"$ENVIRONMENT\"}"
extra_args: --ignore-missing


notify:
runs-on: ubuntu-latest
needs: [build-test-scan, deploy-staging, deploy-prod, sentry-release]
needs: [build-test-scan, deploy-staging, deploy-prod]
if: always()
steps:
- name: Slack Notification for Staging
Expand All @@ -119,7 +184,6 @@ jobs:
Commit: ${{ github.sha }}
Status: ${{ job.status }}
Environment: Staging
Release: ${{ github.sha }}

- name: Slack Notification for Production
if: github.ref == 'refs/heads/main'
Expand All @@ -135,4 +199,14 @@ jobs:
Commit: ${{ github.sha }}
Status: ${{ job.status }}
Environment: Production
Release: ${{ github.sha }}

- name: Debug Directory Structure
run: |
echo "Current directory:"
pwd
echo "Directory contents:"
ls -la
echo "Infra contents:"
ls -la infra/ || echo "No infra directory"
echo "Helm contents:"
ls -la helm/ || echo "No helm directory"
4 changes: 4 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ on:
schedule:
- cron: '0 3 * * 0' # Weekly scan

permissions:
contents: read


jobs:
analyze:
name: Analyze
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/gitleaks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
pull_request:
branches: [ "main", "develop" ]

permissions:
contents: read

jobs:
gitleaks:
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions .idx/dev.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
pkgs.docker-client
pkgs.openssh
pkgs.k3s
pkgs.checkov
pkgs.kubectl
pkgs.tenv
pkgs.docker-compose
Expand Down
8 changes: 8 additions & 0 deletions .trivyignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# .trivyignore
# Ignore base image vulnerabilities that are acceptable
CVE-2024-*
CVE-2023-21608
CVE-2023-38545

# Grafana specific (if needed)
# ghcr.io/grafana/grafana:11.3.4
25 changes: 22 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,26 @@
FROM node:18-alpine
# Use official Node.js Alpine image
FROM node:20-alpine

WORKDIR /app

# Install dependencies
RUN apk update && apk upgrade && rm -rf /var/cache/apk/*
COPY package*.json ./
RUN npm install --only=production --ignore-scripts
RUN npm ci --only=production --ignore-scripts

# Copy app code
COPY . .

# Create non-root user
RUN addgroup -g 1001 -S appgroup && adduser -S appuser -u 1001 -G appgroup
USER appuser

# Expose app port
EXPOSE 3000
CMD ["npm", "start"]

# Health check
HEALTHCHECK --interval=30s --timeout=5s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:3000/ || exit 1

# Start app
CMD ["npm", "start"]
Loading
Loading