Skip to content
This repository was archived by the owner on Jun 19, 2026. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ finmind/
- Frontend: Vercel.
- Secrets: use environment variables (.env locally, platform secrets in cloud).
- Kubernetes manifests for full stack deployment are available in `deploy/k8s/`.
- Tilt local Kubernetes development loop is available with `tilt up`; see `deploy/TILT.md`.

## Local Development
1) Prereqs: Docker, Docker Compose, Node 20+, Python 3.11+
Expand Down
39 changes: 39 additions & 0 deletions Tiltfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
allow_k8s_contexts(["kind-kind", "kind-finmind", "minikube", "docker-desktop", "colima"])

local("test -f deploy/k8s/secrets.yaml || cp deploy/k8s/secrets.example.yaml deploy/k8s/secrets.yaml")

docker_build(
"ghcr.io/rohitdash08/finmind-backend",
"packages/backend",
live_update=[
sync("packages/backend/app", "/app/app"),
sync("packages/backend/tests", "/app/tests"),
sync("packages/backend/wsgi.py", "/app/wsgi.py"),
],
)

k8s_yaml([
"deploy/k8s/namespace.yaml",
"deploy/k8s/secrets.yaml",
"deploy/k8s/app-stack.yaml",
"deploy/k8s/monitoring-stack.yaml",
])

k8s_resource(
"backend",
port_forwards=["8000:8000"],
resource_deps=["postgres", "redis"],
)

k8s_resource("nginx", port_forwards=["8080:80"], resource_deps=["backend"])
k8s_resource("grafana", port_forwards=["3000:3000"])
k8s_resource("prometheus", port_forwards=["9090:9090"])
k8s_resource("loki", port_forwards=["3100:3100"])

local_resource(
"frontend-dev",
cmd="cd app && npm install",
serve_cmd="cd app && npm run dev -- --host 0.0.0.0 --port 5173",
deps=["app/package.json", "app/package-lock.json", "app/src", "app/index.html"],
resource_deps=["backend"],
)
53 changes: 53 additions & 0 deletions deploy/TILT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Tilt Development Loop

This repository includes Docker Compose and Kubernetes manifests. The root `Tiltfile` adds the missing local Kubernetes development loop for the universal deployment path.

## Prerequisites

- Docker
- A local Kubernetes cluster using one of:
- `kind-kind`
- `kind-finmind`
- `minikube`
- `docker-desktop`
- `colima`
- `kubectl`
- `tilt`
- Node 20 for the local frontend dev server

## Start

```bash
tilt up
```

The Tiltfile will:

- create `deploy/k8s/secrets.yaml` from `deploy/k8s/secrets.example.yaml` when a local secrets file is missing
- build `ghcr.io/rohitdash08/finmind-backend` from `packages/backend`
- apply `deploy/k8s/namespace.yaml`, `deploy/k8s/secrets.yaml`, `deploy/k8s/app-stack.yaml`, and `deploy/k8s/monitoring-stack.yaml`
- live-sync backend source and tests into the backend container
- run the frontend Vite dev server as a Tilt local resource
- expose useful local ports

## Local URLs

- Frontend: http://localhost:5173
- Backend API: http://localhost:8000
- Nginx proxy: http://localhost:8080
- Grafana: http://localhost:3000
- Prometheus: http://localhost:9090
- Loki: http://localhost:3100

## Validate

```bash
kubectl get pods -n finmind
curl http://localhost:8000/health
```

For a clean teardown:

```bash
tilt down
```
4 changes: 2 additions & 2 deletions deploy/k8s/app-stack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,6 @@ spec:
- name: postgres-exporter
image: quay.io/prometheuscommunity/postgres-exporter:v0.16.0
env:
- name: DATA_SOURCE_NAME
value: postgresql://$(POSTGRES_USER):$(POSTGRES_PASSWORD)@postgres:5432/$(POSTGRES_DB)?sslmode=disable
- name: POSTGRES_USER
valueFrom:
secretKeyRef:
Expand All @@ -313,6 +311,8 @@ spec:
secretKeyRef:
name: finmind-secrets
key: POSTGRES_DB
- name: DATA_SOURCE_NAME
value: postgresql://$(POSTGRES_USER):$(POSTGRES_PASSWORD)@postgres:5432/$(POSTGRES_DB)?sslmode=disable
ports:
- containerPort: 9187
---
Expand Down
29 changes: 29 additions & 0 deletions deploy/k8s/monitoring-stack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,34 @@ data:
- action: labeldrop
regex: filename
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: promtail
namespace: finmind
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: finmind-promtail
rules:
- apiGroups: [""]
resources: [nodes, nodes/proxy, pods, services, endpoints]
verbs: [get, list, watch]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: finmind-promtail
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: finmind-promtail
subjects:
- kind: ServiceAccount
name: promtail
namespace: finmind
---
apiVersion: apps/v1
kind: DaemonSet
metadata:
Expand All @@ -258,6 +286,7 @@ spec:
labels:
app: promtail
spec:
serviceAccountName: promtail
containers:
- name: promtail
image: grafana/promtail:3.0.0
Expand Down
Binary file added deploy/tilt-demo.mp4
Binary file not shown.