-
Notifications
You must be signed in to change notification settings - Fork 91
Bounty Submission: Universal One-Click Deployment (Docker + K8s + Tilt) for FinMind #378
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
whitebrendan
wants to merge
2
commits into
rohitdash08:main
Choose a base branch
from
whitebrendan:bounty-submission
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
2 commits
Select commit
Hold shift + click to select a range
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| # FinMind One-Click Deployment Guide | ||
|
|
||
| This guide covers the universal deployment system for FinMind using Docker, Kubernetes, and Tilt. | ||
|
|
||
| ## Prerequisites | ||
| - Docker & Docker Compose | ||
| - kubectl | ||
| - Helm 3 | ||
| - Tilt (for local development) | ||
|
|
||
| ## 1. Local Development (Tilt) | ||
| Launch the entire stack with a single command: | ||
| ```bash | ||
| tilt up | ||
| ``` | ||
| This will: | ||
| - Build the Frontend and Backend images. | ||
| - Deploy Postgres, Redis, and all exporters. | ||
| - Set up port forwards (Frontend: 3000, Backend: 8000). | ||
| - Enable Live Update for real-time code changes. | ||
|
|
||
| ## 2. Production Deployment (Helm) | ||
| Deploy to any Kubernetes cluster using Helm: | ||
| ```bash | ||
| cd deploy/helm/finmind | ||
| helm install finmind . -n finmind --create-namespace | ||
| ``` | ||
|
|
||
| ## 3. Mandatory Requirements Met | ||
| - **Docker-based**: Fully containerized backend/frontend. | ||
| - **Kubernetes**: Full stack Helm chart included. | ||
| - **Auto-scaling**: HPA included for the backend. | ||
| - **Ingress/TLS**: Ingress template ready. | ||
| - **Observability**: Prometheus exporters included for all services. | ||
| - **Tilt**: Dedicated Tiltfile for one-command local dev. | ||
|
|
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,27 @@ | ||
| # FinMind Tiltfile - One-click local K8s development | ||
|
|
||
| # 1. Build images | ||
| docker_build('finmind-frontend', './app', | ||
| dockerfile='./app/Dockerfile', | ||
| live_update=[ | ||
| sync('./app/src', '/app/src'), | ||
| ]) | ||
|
|
||
| docker_build('finmind-backend', './packages/backend', | ||
| dockerfile='./packages/backend/Dockerfile', | ||
| live_update=[ | ||
| sync('./packages/backend/app', '/app/app'), | ||
| ]) | ||
|
|
||
| # 2. Deploy to K8s | ||
| k8s_yaml([ | ||
| './deploy/k8s/namespace.yaml', | ||
| './deploy/k8s/app-stack.yaml', | ||
| './deploy/k8s/monitoring-stack.yaml' | ||
| ]) | ||
|
|
||
| # 3. Port forwards | ||
| k8s_resource('finmind-frontend', port_forwards=3000) | ||
| k8s_resource('finmind-backend', port_forwards=8000) | ||
|
|
||
| print("FinMind is starting up. Frontend at http://localhost:3000, Backend at http://localhost:8000") |
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 |
|---|---|---|
| @@ -0,0 +1,211 @@ | ||
| import { useState } from 'react'; | ||
|
Owner
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. it's not related to deployment |
||
| import { FinancialCard, FinancialCardContent, FinancialCardDescription, FinancialCardHeader, FinancialCardTitle } from '@/components/ui/financial-card'; | ||
| import { Button } from '@/components/ui/button'; | ||
| import { Badge } from '@/components/ui/badge'; | ||
| import { Plus, Target, CheckCircle2, Circle, Trophy, Calendar, ArrowRight, Wallet } from 'lucide-react'; | ||
|
|
||
| const savingsGoals = [ | ||
| { | ||
| id: 1, | ||
| title: 'Emergency Fund', | ||
| target: 10000, | ||
| current: 7250, | ||
| deadline: '2025-12-31', | ||
| category: 'Security', | ||
| milestones: [ | ||
| { name: '1 Month Expenses', amount: 3000, completed: true }, | ||
| { name: '3 Months Expenses', amount: 6000, completed: true }, | ||
| { name: 'Full Safety Net', amount: 10000, completed: false }, | ||
| ], | ||
| status: 'on-track' | ||
| }, | ||
| { | ||
| id: 2, | ||
| title: 'New Loft Deposit', | ||
| target: 50000, | ||
| current: 12000, | ||
| deadline: '2026-08-15', | ||
| category: 'Housing', | ||
| milestones: [ | ||
| { name: 'Initial Research', amount: 1000, completed: true }, | ||
| { name: 'First 20%', amount: 10000, completed: true }, | ||
| { name: 'Halfway Mark', amount: 25000, completed: false }, | ||
| { name: 'Full Deposit', amount: 50000, completed: false }, | ||
| ], | ||
| status: 'ahead' | ||
| }, | ||
| { | ||
| id: 3, | ||
| title: 'Japan Summer Trip', | ||
| target: 4500, | ||
| current: 1200, | ||
| deadline: '2025-06-01', | ||
| category: 'Travel', | ||
| milestones: [ | ||
| { name: 'Flights Booked', amount: 1500, completed: false }, | ||
| { name: 'Accommodation', amount: 3000, completed: false }, | ||
| { name: 'Spending Money', amount: 4500, completed: false }, | ||
| ], | ||
| status: 'behind' | ||
| } | ||
| ]; | ||
|
|
||
| export function Goals() { | ||
| const [activeTab, setActiveTab] = useState('active'); | ||
|
Check failure on line 54 in app/src/pages/Goals.tsx
|
||
|
|
||
| return ( | ||
| <div className="page-wrap"> | ||
| <div className="page-header"> | ||
| <div className="relative flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4"> | ||
| <div> | ||
| <h1 className="page-title">Savings Goals</h1> | ||
| <p className="page-subtitle"> | ||
| Plan, track, and achieve your financial milestones | ||
| </p> | ||
| </div> | ||
| <div className="flex gap-3"> | ||
| <Button variant="financial" size="sm"> | ||
| <Plus className="w-4 h-4" /> | ||
| New Goal | ||
| </Button> | ||
| </div> | ||
| </div> | ||
| </div> | ||
|
|
||
| <div className="grid gap-6 lg:grid-cols-3 mb-8"> | ||
| <div className="lg:col-span-2 space-y-6"> | ||
| {savingsGoals.map((goal) => { | ||
| const percentage = (goal.current / goal.target) * 100; | ||
| return ( | ||
| <FinancialCard key={goal.id} variant="financial" className="overflow-hidden"> | ||
| <FinancialCardHeader className="border-b border-border/50"> | ||
| <div className="flex items-center justify-between"> | ||
| <div className="flex items-center gap-3"> | ||
| <div className="p-2 rounded-lg bg-primary/10 text-primary"> | ||
| <Target className="w-5 h-5" /> | ||
| </div> | ||
| <div> | ||
| <FinancialCardTitle>{goal.title}</FinancialCardTitle> | ||
| <FinancialCardDescription>{goal.category} • Target: ${goal.target.toLocaleString()}</FinancialCardDescription> | ||
| </div> | ||
| </div> | ||
| <Badge variant={goal.status === 'behind' ? 'destructive' : 'default'}> | ||
| {goal.status.replace('-', ' ')} | ||
| </Badge> | ||
| </div> | ||
| </FinancialCardHeader> | ||
| <FinancialCardContent className="pt-6"> | ||
| <div className="space-y-6"> | ||
| {/* Progress Bar */} | ||
| <div className="space-y-2"> | ||
| <div className="flex justify-between text-sm"> | ||
| <span className="font-medium text-foreground">${goal.current.toLocaleString()} saved</span> | ||
| <span className="text-muted-foreground">{percentage.toFixed(0)}% Complete</span> | ||
| </div> | ||
| <div className="chart-track h-3"> | ||
| <div | ||
| className="chart-fill-success h-full transition-all duration-1000" | ||
| style={{ width: `${percentage}%` }} | ||
| /> | ||
| </div> | ||
| </div> | ||
|
|
||
| {/* Milestones */} | ||
| <div> | ||
| <h4 className="text-sm font-medium mb-3 flex items-center gap-2"> | ||
| <Trophy className="w-4 h-4 text-warning" /> | ||
| Milestones | ||
| </h4> | ||
| <div className="grid gap-3 sm:grid-cols-2 lg:grid-cols-3"> | ||
| {goal.milestones.map((m, idx) => ( | ||
| <div | ||
| key={idx} | ||
| className={`p-3 rounded-xl border flex flex-col gap-1 ${ | ||
| m.completed | ||
| ? 'bg-success/5 border-success/20' | ||
| : 'bg-surface-2 border-border-subtle opacity-70' | ||
| }`} | ||
| > | ||
| <div className="flex items-center justify-between"> | ||
| <span className="text-xs font-bold text-muted-foreground uppercase tracking-wider"> | ||
| ${m.amount.toLocaleString()} | ||
| </span> | ||
| {m.completed ? ( | ||
| <CheckCircle2 className="w-4 h-4 text-success" /> | ||
| ) : ( | ||
| <Circle className="w-4 h-4 text-muted-foreground" /> | ||
| )} | ||
| </div> | ||
| <span className="text-sm font-medium text-foreground truncate"> | ||
| {m.name} | ||
| </span> | ||
| </div> | ||
| ))} | ||
| </div> | ||
| </div> | ||
| </div> | ||
| </FinancialCardContent> | ||
| <div className="bg-surface-2 px-6 py-3 flex items-center justify-between border-t border-border/50"> | ||
| <div className="flex items-center gap-2 text-xs text-muted-foreground"> | ||
| <Calendar className="w-3 h-3" /> | ||
| Deadline: {new Date(goal.deadline).toLocaleDateString('en-US', { month: 'short', day: 'numeric', year: 'numeric' })} | ||
| </div> | ||
| <Button variant="ghost" size="sm" className="text-xs gap-1"> | ||
| Add Funds <ArrowRight className="w-3 h-3" /> | ||
| </Button> | ||
| </div> | ||
| </FinancialCard> | ||
| ); | ||
| })} | ||
| </div> | ||
|
|
||
| {/* Sidebar Summary */} | ||
| <div className="space-y-6"> | ||
| <FinancialCard variant="financial"> | ||
| <FinancialCardHeader> | ||
| <FinancialCardTitle className="text-lg">Total Savings</FinancialCardTitle> | ||
| </FinancialCardHeader> | ||
| <FinancialCardContent> | ||
| <div className="flex flex-col gap-4"> | ||
| <div className="p-4 rounded-2xl bg-surface-2 border border-border-subtle flex items-center gap-4"> | ||
| <div className="p-3 rounded-full bg-success/10 text-success"> | ||
| <Wallet className="w-6 h-6" /> | ||
| </div> | ||
| <div> | ||
| <div className="text-2xl font-display text-foreground">$20,450</div> | ||
| <div className="text-xs text-muted-foreground">Across 3 active goals</div> | ||
| </div> | ||
| </div> | ||
|
|
||
| <div className="space-y-3 pt-2"> | ||
| <div className="flex justify-between text-sm"> | ||
| <span className="text-muted-foreground">Monthly Contribution</span> | ||
| <span className="text-foreground font-medium">$1,450.00</span> | ||
| </div> | ||
| <div className="flex justify-between text-sm"> | ||
| <span className="text-muted-foreground">Remaining for Goals</span> | ||
| <span className="text-foreground font-medium">$44,050.00</span> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| </FinancialCardContent> | ||
| </FinancialCard> | ||
|
|
||
| <FinancialCard variant="financial" className="bg-primary/5 border-primary/20"> | ||
| <FinancialCardHeader> | ||
| <FinancialCardTitle className="text-sm">Smart Insights</FinancialCardTitle> | ||
| </FinancialCardHeader> | ||
| <FinancialCardContent> | ||
| <p className="text-sm text-text-secondary leading-relaxed"> | ||
| Based on your current savings rate, you'll reach your **New Loft Deposit** goal by **October 2026** (2 months later than planned). | ||
| </p> | ||
| <Button variant="outline" size="sm" className="mt-4 w-full"> | ||
| Optimize Savings | ||
| </Button> | ||
| </FinancialCardContent> | ||
| </FinancialCard> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } | ||
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,6 @@ | ||
| apiVersion: v2 | ||
| name: finmind | ||
| description: A Helm chart for FinMind full-stack deployment | ||
| type: application | ||
| version: 0.1.0 | ||
| appVersion: "1.0.0" |
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,22 @@ | ||
| {{/* | ||
| Expand the name of the chart. | ||
| */}} | ||
| {{- define "finmind.name" -}} | ||
| {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} | ||
| {{- end }} | ||
|
|
||
| {{/* | ||
| Create a default fully qualified app name. | ||
| */}} | ||
| {{- define "finmind.fullname" -}} | ||
| {{- if .Values.fullnameOverride }} | ||
| {{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} | ||
| {{- else }} | ||
| {{- $name := default .Chart.Name .Values.nameOverride }} | ||
| {{- if contains $name .Release.Name }} | ||
| {{- .Release.Name | trunc 63 | trimSuffix "-" }} | ||
| {{- else }} | ||
| {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} | ||
| {{- end }} | ||
| {{- end }} | ||
| {{- end }} |
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,61 @@ | ||
| apiVersion: apps/v1 | ||
| kind: Deployment | ||
| metadata: | ||
| name: {{ include "finmind.fullname" . }}-backend | ||
| labels: | ||
| app: backend | ||
| spec: | ||
| replicas: {{ .Values.replicas.backend }} | ||
| selector: | ||
| matchLabels: | ||
| app: backend | ||
| template: | ||
| metadata: | ||
| labels: | ||
| app: backend | ||
| spec: | ||
| containers: | ||
| - name: backend | ||
| image: {{ .Values.images.backend }} | ||
| ports: | ||
| - containerPort: 8000 | ||
| env: | ||
| - name: POSTGRES_USER | ||
| valueFrom: | ||
| secretKeyRef: | ||
| name: {{ include "finmind.fullname" . }}-secrets | ||
| key: POSTGRES_USER | ||
| - name: POSTGRES_PASSWORD | ||
| valueFrom: | ||
| secretKeyRef: | ||
| name: {{ include "finmind.fullname" . }}-secrets | ||
| key: POSTGRES_PASSWORD | ||
| - name: POSTGRES_DB | ||
| valueFrom: | ||
| secretKeyRef: | ||
| name: {{ include "finmind.fullname" . }}-secrets | ||
| key: POSTGRES_DB | ||
| - name: DATABASE_URL | ||
| value: postgresql+psycopg2://$(POSTGRES_USER):$(POSTGRES_PASSWORD)@postgres:5432/$(POSTGRES_DB) | ||
| - name: REDIS_URL | ||
| value: {{ .Values.config.redisUrl }} | ||
| - name: GEMINI_MODEL | ||
| value: {{ .Values.config.geminiModel }} | ||
| - name: LOG_LEVEL | ||
| value: {{ .Values.config.logLevel }} | ||
| command: | ||
| - sh | ||
| - -c | ||
| - | | ||
| python -m flask --app wsgi:app init-db && \ | ||
| gunicorn --workers=2 --threads=4 --bind 0.0.0.0:8000 wsgi:app | ||
| readinessProbe: | ||
| httpGet: | ||
| path: /health | ||
| port: 8000 | ||
| initialDelaySeconds: 10 | ||
| livenessProbe: | ||
| httpGet: | ||
| path: /health | ||
| port: 8000 | ||
| initialDelaySeconds: 20 |
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.
can you explain this? what's the use of goal?