Skip to content

feat(deployment): updation - #18

Merged
athulrajtflycatchtech merged 12 commits into
devfrom
deployment
Sep 2, 2026
Merged

feat(deployment): updation#18
athulrajtflycatchtech merged 12 commits into
devfrom
deployment

Conversation

@athulrajtflycatchtech

Copy link
Copy Markdown

Changes

  • deployment related codes & files updated
  • docker file updated

Reviewer

@athulrajtflycatchtech

lijukrks and others added 12 commits September 1, 2026 20:04
…-production.

Consolidate Docker Compose under deployment/compose and add Kustomize manifests
under deployment/k8s for the Flycatch cluster, with environment-wide noindex
controls so the new development environment is not SEO-indexed.

Co-authored-by: Cursor <cursoragent@cursor.com>
Without the import, /health returned 500 and readiness probes failed.

Co-authored-by: Cursor <cursoragent@cursor.com>
Astro/Vite preview was returning 403 for flycatch-website-dev.k3s.flycatchtech.in.

Co-authored-by: Cursor <cursoragent@cursor.com>
Vite preview reads the config at runtime; without it, Ingress hostnames were blocked.

Co-authored-by: Cursor <cursoragent@cursor.com>
…view.

Astro preview host checks blocked the k8s Ingress hostname; serve avoids that.

Co-authored-by: Cursor <cursoragent@cursor.com>
Implemented security headers in the Caddyfile, including HSTS, CSP, and other policies for both public and admin routes. Updated README to include instructions for verifying these headers via curl commands.
@athulrajtflycatchtech
athulrajtflycatchtech merged commit f1c19ac into dev Sep 2, 2026
2 of 4 checks passed
@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Add k3s deployment manifests and non-production SEO safeguards

✨ Enhancement ⚙️ Configuration changes 📝 Documentation 🐞 Bug fix 🕐 40+ Minutes

Grey Divider

AI Description

• Add k3s deployment with Traefik ingress, Caddy routing, and Harbor image automation.
• Consolidate Docker Compose assets and share gateway security configuration across environments.
• Prevent non-production indexing through metadata, response headers, and environment-aware builds.
Diagram

graph TD
  Argo["Argo CD"] --> Traefik["Traefik Ingress"] --> Gateway["Caddy Gateway"] --> Frontend["Public Frontend"]
  Gateway --> Admin["Admin Frontend"]
  Gateway --> Backend["FastAPI Backend"] --> Data[("Shared Data")]
  Argo --> Frontend
  Argo --> Admin
  Argo --> Backend
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Package manifests as a Helm chart
  • ➕ Supports richer environment parameterization and reusable release values.
  • ➕ Can simplify future deployment across several clusters or production environments.
  • ➖ Adds templating and release-management complexity for one current overlay.
  • ➖ Kustomize integrates directly with the existing Argo CD app-of-apps workflow.
2. Serve static applications directly from Caddy
  • ➕ Removes the two Node-based static-serving processes.
  • ➕ Reduces workload count and runtime package installation.
  • ➖ Couples frontend artifacts to the gateway image and release lifecycle.
  • ➖ Requires a custom multi-artifact gateway build instead of independently versioned images.

Recommendation: Keep Kustomize and independently deployed application images for the current single-cluster development environment. The approach aligns with the existing Argo CD ownership model and preserves component-level image versioning; Helm or a combined static gateway becomes preferable only when environment count or operational pressure justifies the added packaging work.

Files changed (40) +978 / -86

Enhancement (3) +37 / -1
BaseLayout.astroMark all non-production pages as non-indexable +3/-1

Mark all non-production pages as non-indexable

• Combines page-level indexability with PUBLIC_ENVIRONMENT so development builds always emit noindex and nofollow metadata.

apps/Frontend/src/layouts/BaseLayout.astro

robots.txt.tsGenerate environment-aware robots directives +24/-0

Generate environment-aware robots directives

• Adds a dynamic robots.txt route that allows production crawling while blocking all crawling outside production.

apps/Frontend/src/pages/robots.txt.ts

noindex-middleware.yamlPrevent indexing at the ingress layer +10/-0

Prevent indexing at the ingress layer

• Adds a Traefik middleware that places X-Robots-Tag noindex and nofollow on development responses.

deployment/k8s/overlays/dev/noindex-middleware.yaml

Bug fix (3) +11 / -1
astro.config.mjsPermit external Astro preview hosts +3/-0

Permit external Astro preview hosts

• Allows preview requests from ingress hostnames rather than restricting them to Vite defaults.

apps/Administration-FE/astro.config.mjs

main.pyApply noindex headers outside production +5/-1

Apply noindex headers outside production

• Imports application settings and extends X-Robots-Tag handling to every non-production response while retaining admin-path protection in production.

apps/Backend/src/flycatch_api/main.py

astro.config.mjsPermit external frontend preview hosts +3/-0

Permit external frontend preview hosts

• Configures Vite preview to accept requests addressed through the cluster ingress hostname.

apps/Frontend/astro.config.mjs

Documentation (10) +339 / -66
README.mdDocument Compose and k3s deployment layouts +17/-14

Document Compose and k3s deployment layouts

• Updates repository structure, setup commands, and deployment references for the new deployment/compose and deployment/k8s directories.

README.md

README.mdDescribe the split deployment structure +7/-35

Describe the split deployment structure

• Reframes the deployment directory as the entry point for Compose and Kubernetes documentation and identifies the shared Caddy configuration.

deployment/README.md

README.mdAdd dedicated Docker Compose setup guidance +49/-0

Add dedicated Docker Compose setup guidance

• Documents Compose files, startup and bootstrap commands, shared routing, and non-production SEO defaults.

deployment/compose/README.md

README.mdDocument the k3s GitOps deployment lifecycle +249/-0

Document the k3s GitOps deployment lifecycle

• Provides comprehensive setup, secrets, shared data-service, Harbor, Argo CD, verification, security, and rollback instructions for the development cluster.

deployment/k8s/README.md

onboarding.mdUpdate onboarding for relocated Compose assets +6/-6

Update onboarding for relocated Compose assets

• Rewrites local setup, migration, seed, bootstrap, and staff provisioning commands for deployment/compose.

docs/onboarding.md

quickstart.mdAlign foundation setup with the Compose relocation +4/-4

Align foundation setup with the Compose relocation

• Updates environment, startup, rebuild, and local deployment commands to use deployment/compose.

specs/001-website-foundation/quickstart.md

research.mdCorrect the recorded Compose deployment path +1/-1

Correct the recorded Compose deployment path

• Updates the hosting decision to reference the consolidated Compose configuration.

specs/001-website-foundation/research.md

tasks.mdAlign foundation task references with deployment layout +2/-2

Align foundation task references with deployment layout

• Updates completed deployment task and checkpoint paths for Compose and the shared Kubernetes Caddyfile.

specs/001-website-foundation/tasks.md

quickstart.mdUpdate authentication setup commands for Compose +3/-3

Update authentication setup commands for Compose

• Points environment, service startup, and bootstrap guidance to deployment/compose.

specs/002-auth-rbac/quickstart.md

tasks.mdCorrect the authentication environment template path +1/-1

Correct the authentication environment template path

• Updates the completed JWT configuration task to reference the relocated Compose environment example.

specs/002-auth-rbac/tasks.md

Other (24) +591 / -18
.dockerignoreIgnore environment files in the reorganized deployment tree +2/-1

Ignore environment files in the reorganized deployment tree

• Replaces the old deployment environment-file path with Compose-specific and recursive deployment exclusions.

.dockerignore

.gitignoreProtect nested deployment environment files +2/-1

Protect nested deployment environment files

• Updates ignore rules for the relocated Compose environment file and any environment files beneath deployment.

.gitignore

DockerfileBuild environment-aware admin assets and serve them statically +6/-5

Build environment-aware admin assets and serve them statically

• Adds public build arguments and replaces the Astro preview runtime with serve for predictable ingress-host behavior.

apps/Administration-FE/Dockerfile

package.jsonAllow arbitrary hosts in the admin preview command +1/-1

Allow arbitrary hosts in the admin preview command

• Adds the allowed-hosts option to the Astro preview script for externally addressed preview environments.

apps/Administration-FE/package.json

DockerfileBuild environment-aware frontend assets and serve them statically +6/-4

Build environment-aware frontend assets and serve them statically

• Introduces public build arguments and replaces Astro preview with serve in the runtime image.

apps/Frontend/Dockerfile

package.jsonAllow arbitrary hosts in the frontend preview command +1/-1

Allow arbitrary hosts in the frontend preview command

• Adds the allowed-hosts option to the Astro preview script.

apps/Frontend/package.json

.env.exampleAdd environment controls for SEO behavior +5/-0

Add environment controls for SEO behavior

• Defines frontend and backend environment values that default Compose deployments to non-indexable development mode.

deployment/compose/.env.example

docker-compose.ymlRelocate and align the Compose stack +12/-5

Relocate and align the Compose stack

• Fixes build contexts after relocation, passes environment-aware build arguments, and mounts the Caddy configuration shared with Kubernetes.

deployment/compose/docker-compose.yml

CaddyfileCentralize gateway routing and security headers +47/-0

Centralize gateway routing and security headers

• Defines shared Compose and Kubernetes path routing plus baseline security and route-specific content security policies.

deployment/k8s/base/Caddyfile

administration-fe-deployment.yamlDeploy the administration frontend on Kubernetes +52/-0

Deploy the administration frontend on Kubernetes

• Defines the admin workload with Harbor image access, HTTP probes, and resource requests and limits.

deployment/k8s/base/administration-fe-deployment.yaml

administration-fe-service.yamlExpose the administration frontend inside the cluster +17/-0

Expose the administration frontend inside the cluster

• Adds a ClusterIP service targeting the administration frontend HTTP port.

deployment/k8s/base/administration-fe-service.yaml

backend-deployment.yamlDeploy the backend with configuration and health probes +57/-0

Deploy the backend with configuration and health probes

• Defines the backend workload using ConfigMap and Secret values, Harbor image access, health checks, and resource boundaries.

deployment/k8s/base/backend-deployment.yaml

backend-service.yamlExpose the backend inside the cluster +17/-0

Expose the backend inside the cluster

• Adds a ClusterIP service routing internal traffic to the FastAPI HTTP port.

deployment/k8s/base/backend-service.yaml

configmap.yamlDefine development runtime configuration +16/-0

Define development runtime configuration

• Provides public origin, environment, shared MinIO, JWT lifetime, and gateway settings for cluster workloads.

deployment/k8s/base/configmap.yaml

frontend-deployment.yamlDeploy the public frontend on Kubernetes +52/-0

Deploy the public frontend on Kubernetes

• Defines the frontend workload with Harbor image access, HTTP health probes, and constrained resources.

deployment/k8s/base/frontend-deployment.yaml

frontend-service.yamlExpose the public frontend inside the cluster +17/-0

Expose the public frontend inside the cluster

• Adds a ClusterIP service targeting the frontend HTTP port.

deployment/k8s/base/frontend-service.yaml

gateway-deployment.yamlDeploy the shared Caddy gateway +60/-0

Deploy the shared Caddy gateway

• Defines the gateway workload, mounts the generated Caddy ConfigMap, and configures TCP probes and resources.

deployment/k8s/base/gateway-deployment.yaml

gateway-service.yamlExpose the Caddy gateway inside the cluster +17/-0

Expose the Caddy gateway inside the cluster

• Adds the ClusterIP endpoint consumed by the Traefik ingress.

deployment/k8s/base/gateway-service.yaml

kustomization.yamlAssemble reusable Kubernetes base resources +24/-0

Assemble reusable Kubernetes base resources

• Registers the namespace, workloads, services, runtime configuration, generated Caddy ConfigMap, and shared application labels.

deployment/k8s/base/kustomization.yaml

namespace.yamlDefine the development application namespace +6/-0

Define the development application namespace

• Creates and labels the flycatch-website-dev namespace.

deployment/k8s/base/namespace.yaml

ingress.yamlExpose development through TLS-enabled Traefik ingress +26/-0

Expose development through TLS-enabled Traefik ingress

• Routes the development hostname to Caddy, requests a certificate, and attaches the noindex middleware.

deployment/k8s/overlays/dev/ingress.yaml

kustomization.yamlConfigure the development Kustomize overlay +30/-0

Configure the development Kustomize overlay

• Combines base resources with ingress and noindex middleware, pins application images to a commit, and sets replica counts.

deployment/k8s/overlays/dev/kustomization.yaml

secret.example.yamlProvide a safe Kubernetes secret template +25/-0

Provide a safe Kubernetes secret template

• Documents required database, storage, session, CSRF, JWT, and export-token secret keys without including credentials.

deployment/k8s/overlays/dev/secret.example.yaml

deploy-dev.shAutomate Harbor image publication and GitOps tag bumps +93/-0

Automate Harbor image publication and GitOps tag bumps

• Validates prerequisites, builds architecture-specific images, pushes SHA and latest tags, updates Kustomize image references, and commits the deployment change for Argo CD.

deployment/k8s/scripts/deploy-dev.sh

@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (3) 📘 Rule violations (0) 📜 Skill insights (0)

Grey Divider


Action required

1. Relocated environment file ignored 🐞 Bug ≡ Correctness
Description
The updated onboarding command creates deployment/compose/.env but invokes Compose from the
repository root without --env-file, so Compose interpolation can leave required Postgres, MinIO,
and backend variables empty. This can prevent the documented stack from starting, while the root
README already demonstrates the required invocation.
Code

docs/onboarding.md[8]

+2. `docker compose -f deployment/compose/docker-compose.yml up -d --build`
Evidence
The onboarding guide creates the environment file under deployment/compose but its subsequent
root-relative commands omit --env-file. The Compose file interpolates required database, storage,
and secret values, while the updated root README explicitly supplies the relocated env file for
equivalent commands.

docs/onboarding.md[7-14]
deployment/compose/docker-compose.yml[5-24]
deployment/compose/docker-compose.yml[33-49]
README.md[67-80]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Root-level Compose commands do not explicitly load the relocated `deployment/compose/.env`, causing required variable interpolation to use missing or empty values.

## Issue Context
The root README uses the correct `--env-file deployment/compose/.env` option, but onboarding and specification commands omit it.

## Fix Focus Areas
- docs/onboarding.md[7-27]
- specs/001-website-foundation/quickstart.md[18-24]
- specs/001-website-foundation/quickstart.md[98-98]
- specs/002-auth-rbac/quickstart.md[17-20]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. JWT secret documented incorrectly 🐞 Bug ⛨ Security
Description
The updated quickstart tells operators to set lowercase jwt_secret, but Compose interpolates and
explicitly supplies uppercase ${JWT_SECRET} to the backend. Following the instruction leaves that
value unset and overrides the intended JWT secret with an empty value in the container.
Code

specs/002-auth-rbac/quickstart.md[17]

+1. Copy or update `deployment/compose/.env` with `jwt_secret` (long random) in addition to existing Backend secrets.
Evidence
The changed quickstart line instructs users to configure lowercase jwt_secret. The compose service
maps JWT_SECRET: ${JWT_SECRET}, so only the uppercase key is consumed, and the supplied
environment template likewise declares JWT_SECRET in uppercase.

specs/002-auth-rbac/quickstart.md[15-20]
deployment/compose/docker-compose.yml[36-49]
deployment/compose/.env.example[26-32]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Correct the Docker Compose setup instruction to name the environment variable that Compose actually passes to the Backend.

## Issue Context
The compose file explicitly maps `JWT_SECRET` using uppercase interpolation, and the environment template defines the same uppercase variable. Lowercase `jwt_secret` does not satisfy that interpolation.

## Fix Focus Areas
- specs/002-auth-rbac/quickstart.md[17-17]
- deployment/compose/docker-compose.yml[43-46]
- deployment/compose/.env.example[26-32]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

3. Registry overrides skip tag updates 🐞 Bug ≡ Correctness
Description
When REGISTRY, BACKEND_IMAGE, FRONTEND_IMAGE, or ADMIN_FE_IMAGE is overridden, `kustomize
edit set image` searches for the overridden name rather than the fixed image name present in the
base manifests. The script therefore pushes the custom images but leaves the overlay pointing to the
original registry images.
Code

deployment/k8s/scripts/deploy-dev.sh[R75-78]

+  kustomize edit set image \
+    "${BACKEND_IMAGE}=${BACKEND_IMAGE}:${TAG}" \
+    "${FRONTEND_IMAGE}=${FRONTEND_IMAGE}:${TAG}" \
+    "${ADMIN_FE_IMAGE}=${ADMIN_FE_IMAGE}:${TAG}"
Evidence
The script explicitly supports registry and per-image overrides, but uses each resulting override as
Kustomize's match key. Base manifests only contain the fixed
registry.k3s.flycatchtech.in/flycatch-website/... names, so custom names cannot match and be
rewritten.

deployment/k8s/scripts/deploy-dev.sh[9-15]
deployment/k8s/scripts/deploy-dev.sh[72-79]
deployment/k8s/base/backend-deployment.yaml[23-25]
deployment/k8s/base/frontend-deployment.yaml[23-25]
deployment/k8s/base/administration-fe-deployment.yaml[23-25]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Image override variables are incorrectly used as both Kustomize's existing image key and replacement image, so non-default registry or image values do not match the base manifests.

## Issue Context
The base deployments contain fixed canonical Harbor image names. Kustomize must match those canonical names and replace them with the configured override plus tag.

## Fix Focus Areas
- deployment/k8s/scripts/deploy-dev.sh[9-15]
- deployment/k8s/scripts/deploy-dev.sh[72-79]
- deployment/k8s/base/backend-deployment.yaml[23-25]
- deployment/k8s/base/frontend-deployment.yaml[23-25]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Context sources
Review mode: 🧠 Deep: This broad deployment change introduces Kubernetes manifests, Docker/build behavior, gateway security routing, environment handling, SEO behavior, and an auto-commit deployment script across many independent paths, creating a high density of subtle operational and security defects.

Grey Divider

Tip of the day
💡 Did you know, you can turn on the rule miner and Qodo learns your standards from review history

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

Comment thread docs/onboarding.md
3. Backend migrations: `docker compose -f deployment/docker-compose.yml exec backend alembic upgrade head`
4. Seed records: `docker compose -f deployment/docker-compose.yml exec backend flycatch-seed-records`
1. `cp deployment/compose/.env.example deployment/compose/.env` and set `JWT_SECRET` (and other `change-me` values) to long random secrets. Do not commit `deployment/compose/.env`.
2. `docker compose -f deployment/compose/docker-compose.yml up -d --build`

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

1. Relocated environment file ignored 🐞 Bug ≡ Correctness

The updated onboarding command creates deployment/compose/.env but invokes Compose from the
repository root without --env-file, so Compose interpolation can leave required Postgres, MinIO,
and backend variables empty. This can prevent the documented stack from starting, while the root
README already demonstrates the required invocation.
Agent Prompt
## Issue description
Root-level Compose commands do not explicitly load the relocated `deployment/compose/.env`, causing required variable interpolation to use missing or empty values.

## Issue Context
The root README uses the correct `--env-file deployment/compose/.env` option, but onboarding and specification commands omit it.

## Fix Focus Areas
- docs/onboarding.md[7-27]
- specs/001-website-foundation/quickstart.md[18-24]
- specs/001-website-foundation/quickstart.md[98-98]
- specs/002-auth-rbac/quickstart.md[17-20]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines +75 to +78
kustomize edit set image \
"${BACKEND_IMAGE}=${BACKEND_IMAGE}:${TAG}" \
"${FRONTEND_IMAGE}=${FRONTEND_IMAGE}:${TAG}" \
"${ADMIN_FE_IMAGE}=${ADMIN_FE_IMAGE}:${TAG}"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remediation recommended

2. Registry overrides skip tag updates 🐞 Bug ≡ Correctness

When REGISTRY, BACKEND_IMAGE, FRONTEND_IMAGE, or ADMIN_FE_IMAGE is overridden, `kustomize
edit set image` searches for the overridden name rather than the fixed image name present in the
base manifests. The script therefore pushes the custom images but leaves the overlay pointing to the
original registry images.
Agent Prompt
## Issue description
Image override variables are incorrectly used as both Kustomize's existing image key and replacement image, so non-default registry or image values do not match the base manifests.

## Issue Context
The base deployments contain fixed canonical Harbor image names. Kustomize must match those canonical names and replace them with the configured override plus tag.

## Fix Focus Areas
- deployment/k8s/scripts/deploy-dev.sh[9-15]
- deployment/k8s/scripts/deploy-dev.sh[72-79]
- deployment/k8s/base/backend-deployment.yaml[23-25]
- deployment/k8s/base/frontend-deployment.yaml[23-25]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


1. Copy or update `deployment/.env` with `jwt_secret` (long random) in addition to existing Backend secrets.
2. Start services: `docker compose -f deployment/docker-compose.yml up -d --build` (see [README.md](../../README.md#quick-start-docker-compose)).
1. Copy or update `deployment/compose/.env` with `jwt_secret` (long random) in addition to existing Backend secrets.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

3. Jwt secret documented incorrectly 🐞 Bug ⛨ Security

The updated quickstart tells operators to set lowercase jwt_secret, but Compose interpolates and
explicitly supplies uppercase ${JWT_SECRET} to the backend. Following the instruction leaves that
value unset and overrides the intended JWT secret with an empty value in the container.
Agent Prompt
## Issue description
Correct the Docker Compose setup instruction to name the environment variable that Compose actually passes to the Backend.

## Issue Context
The compose file explicitly maps `JWT_SECRET` using uppercase interpolation, and the environment template defines the same uppercase variable. Lowercase `jwt_secret` does not satisfy that interpolation.

## Fix Focus Areas
- specs/002-auth-rbac/quickstart.md[17-17]
- deployment/compose/docker-compose.yml[43-46]
- deployment/compose/.env.example[26-32]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants