Skip to content
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
24 changes: 24 additions & 0 deletions manifests/helm/microforge/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/

17 changes: 17 additions & 0 deletions manifests/helm/microforge/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: v2
name: microforge
description: A Helm chart for MicroForge - Enterprise-Grade Microservices Platform
type: application
version: 1.0.0
appVersion: "1.0.0"
keywords:
- microservices
- polyglot
- kubernetes
- devops
maintainers:
- name: Manoj M
email: manojmanjunathhs@gmail.com
sources:
- https://github.com/Manoj-14/MicroForge

61 changes: 61 additions & 0 deletions manifests/helm/microforge/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# MicroForge Helm Chart

## Quick Start

### Prerequisites
- Kubernetes cluster
- kubectl configured
- Helm 3.0+

### Installation

1. **Ensure `src/.env` file exists** with required values:
- `LOGIN_SERVICE_DB_USERNAME`
- `LOGIN_SERVICE_DB_PASSWORD`
- `LOGIN_SERVICE_JWT_SECRET`
- `FLASK_SECRET_KEY`
- `NOTIFICATION_SERVICE_DB_USER`
- `NOTIFICATION_SERVICE_DB_PASSWORD`

2. **Install using helper script:**

**Linux/Mac:**
```bash
cd manifests/helm/microforge
chmod +x install-from-env.sh
./install-from-env.sh
```

**Windows PowerShell:**
```powershell
cd manifests/helm/microforge
.\install-from-env.ps1
```

**Or install directly:**
```bash
helm install microforge ./manifests/helm/microforge
```

### Access Services

All services are exposed via LoadBalancer:

- **Frontend**: http://localhost:3000
- **Login Service**: http://localhost:8081
- **Auth Service**: http://localhost:8082
- **Notification Service**: http://localhost:8083
- **Metadata Service**: http://localhost:8084

### Check Status

```bash
kubectl get pods -n microforge-dev-ns
kubectl get services -n microforge-dev-ns
```

### Uninstall

```bash
helm uninstall microforge -n microforge-dev-ns
```
117 changes: 117 additions & 0 deletions manifests/helm/microforge/install-from-env.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
# PowerShell script to install MicroForge Helm chart by reading from src/.env file
# This script reads secrets from the .env file in the src directory

param(
[string]$ReleaseName = "microforge",
[string]$Namespace = "microforge-dev-ns"
)

$ErrorActionPreference = "Stop"

Write-Host "MicroForge Helm Installation from .env file" -ForegroundColor Green
Write-Host "==================================================" -ForegroundColor Green

# Get the script directory and project root
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
$ProjectRoot = (Get-Item $ScriptDir).Parent.Parent.Parent.FullName
$EnvFile = Join-Path $ProjectRoot "src\.env"

# Check if .env file exists
if (-not (Test-Path $EnvFile)) {
Write-Host "Error: .env file not found at $EnvFile" -ForegroundColor Red
Write-Host "Please ensure the .env file exists in the src directory." -ForegroundColor Yellow
exit 1
}

Write-Host "Found .env file at: $EnvFile" -ForegroundColor Green

# Read .env file and set environment variables
Get-Content $EnvFile | ForEach-Object {
if ($_ -match '^\s*([^#][^=]+)=(.*)$') {
$key = $matches[1].Trim()
$value = $matches[2].Trim()
# Remove quotes if present
$value = $value -replace '^["'']|["'']$', ''
[Environment]::SetEnvironmentVariable($key, $value, "Process")
}
}

# Check if required variables are set
$RequiredVars = @(
"LOGIN_SERVICE_DB_USERNAME",
"LOGIN_SERVICE_DB_PASSWORD",
"LOGIN_SERVICE_JWT_SECRET",
"FLASK_SECRET_KEY",
"NOTIFICATION_SERVICE_DB_USER",
"NOTIFICATION_SERVICE_DB_PASSWORD"
)

$MissingVars = @()

foreach ($var in $RequiredVars) {
if (-not (Test-Path "Env:$var") -or [string]::IsNullOrEmpty((Get-Item "Env:$var").Value)) {
$MissingVars += $var
}
}

if ($MissingVars.Count -gt 0) {
Write-Host "Error: The following required variables are missing from .env file:" -ForegroundColor Red
foreach ($var in $MissingVars) {
Write-Host " - $var" -ForegroundColor Red
}
exit 1
}

$ChartPath = $ScriptDir

# Check if Helm is installed
try {
helm version | Out-Null
} catch {
Write-Host "Error: Helm is not installed. Please install Helm first." -ForegroundColor Red
exit 1
}

# Check if chart exists
if (-not (Test-Path $ChartPath)) {
Write-Host "Error: Chart directory not found at $ChartPath" -ForegroundColor Red
exit 1
}

Write-Host "All required variables found in .env file." -ForegroundColor Green
Write-Host "Installing Helm chart..." -ForegroundColor Yellow
Write-Host " Release name: $ReleaseName"
Write-Host " Namespace: $Namespace"
Write-Host ""

# Build Helm install command with all secrets from .env file
$helmArgs = @(
"install",
$ReleaseName,
$ChartPath,
"--namespace", $Namespace,
"--create-namespace",
"--set", "loginService.secrets.dbUsername=$env:LOGIN_SERVICE_DB_USERNAME",
"--set", "loginService.secrets.dbPassword=$env:LOGIN_SERVICE_DB_PASSWORD",
"--set", "loginService.secrets.jwtSecret=$env:LOGIN_SERVICE_JWT_SECRET",
"--set", "metadataService.secrets.flaskSecretKey=$env:FLASK_SECRET_KEY",
"--set", "notificationService.secrets.mysqlUser=$env:NOTIFICATION_SERVICE_DB_USER",
"--set", "notificationService.secrets.mysqlPassword=$env:NOTIFICATION_SERVICE_DB_PASSWORD",
"--set", "loginMysql.secrets.rootPassword=$env:LOGIN_SERVICE_DB_PASSWORD",
"--set", "notificationMysql.secrets.rootPassword=$env:NOTIFICATION_SERVICE_DB_PASSWORD"
)

& helm $helmArgs

Write-Host ""
Write-Host "Installation completed!" -ForegroundColor Green
Write-Host ""
Write-Host "Access services:"
Write-Host " Frontend: http://localhost:3000"
Write-Host " Login: http://localhost:8081"
Write-Host " Auth: http://localhost:8082"
Write-Host " Notification: http://localhost:8083"
Write-Host " Metadata: http://localhost:8084"
Write-Host ""
Write-Host "Check status: kubectl get pods -n $Namespace"

108 changes: 108 additions & 0 deletions manifests/helm/microforge/install-from-env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
#!/bin/bash
# Helper script to install MicroForge Helm chart by reading from src/.env file
# This script reads secrets from the .env file in the src directory

set -e

# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color

echo -e "${GREEN}MicroForge Helm Installation from .env file${NC}"
echo "=================================================="

# Get the script directory and project root
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
PROJECT_ROOT="$( cd "$SCRIPT_DIR/../../.." && pwd )"
ENV_FILE="$PROJECT_ROOT/src/.env"

# Check if .env file exists
if [ ! -f "$ENV_FILE" ]; then
echo -e "${RED}Error: .env file not found at $ENV_FILE${NC}"
echo -e "${YELLOW}Please ensure the .env file exists in the src directory.${NC}"
exit 1
fi

echo -e "${GREEN}Found .env file at: $ENV_FILE${NC}"

# Source the .env file
set -a
source "$ENV_FILE"
set +a

# Check if required variables are set
REQUIRED_VARS=(
"LOGIN_SERVICE_DB_USERNAME"
"LOGIN_SERVICE_DB_PASSWORD"
"LOGIN_SERVICE_JWT_SECRET"
"FLASK_SECRET_KEY"
"NOTIFICATION_SERVICE_DB_USER"
"NOTIFICATION_SERVICE_DB_PASSWORD"
)

MISSING_VARS=()

for var in "${REQUIRED_VARS[@]}"; do
if [ -z "${!var}" ]; then
MISSING_VARS+=("$var")
fi
done

if [ ${#MISSING_VARS[@]} -ne 0 ]; then
echo -e "${RED}Error: The following required variables are missing from .env file:${NC}"
for var in "${MISSING_VARS[@]}"; do
echo -e " ${RED}- $var${NC}"
done
exit 1
fi

# Get release name and namespace from arguments or use defaults
RELEASE_NAME=${1:-microforge}
NAMESPACE=${2:-microforge-dev-ns}
CHART_PATH="$SCRIPT_DIR"

# Check if Helm is installed
if ! command -v helm &> /dev/null; then
echo -e "${RED}Error: Helm is not installed. Please install Helm first.${NC}"
exit 1
fi

# Check if chart exists
if [ ! -d "$CHART_PATH" ]; then
echo -e "${RED}Error: Chart directory not found at $CHART_PATH${NC}"
exit 1
fi

echo -e "${GREEN}All required variables found in .env file.${NC}"
echo -e "${YELLOW}Installing Helm chart...${NC}"
echo " Release name: $RELEASE_NAME"
echo " Namespace: $NAMESPACE"
echo ""

# Build Helm install command with all secrets from .env file
helm install "$RELEASE_NAME" "$CHART_PATH" \
--namespace "$NAMESPACE" \
--create-namespace \
--set loginService.secrets.dbUsername="$LOGIN_SERVICE_DB_USERNAME" \
--set loginService.secrets.dbPassword="$LOGIN_SERVICE_DB_PASSWORD" \
--set loginService.secrets.jwtSecret="$LOGIN_SERVICE_JWT_SECRET" \
--set metadataService.secrets.flaskSecretKey="$FLASK_SECRET_KEY" \
--set notificationService.secrets.mysqlUser="$NOTIFICATION_SERVICE_DB_USER" \
--set notificationService.secrets.mysqlPassword="$NOTIFICATION_SERVICE_DB_PASSWORD" \
--set loginMysql.secrets.rootPassword="$LOGIN_SERVICE_DB_PASSWORD" \
--set notificationMysql.secrets.rootPassword="$NOTIFICATION_SERVICE_DB_PASSWORD"

echo ""
echo -e "${GREEN}Installation completed!${NC}"
echo ""
echo "Access services:"
echo " Frontend: http://localhost:3000"
echo " Login: http://localhost:8081"
echo " Auth: http://localhost:8082"
echo " Notification: http://localhost:8083"
echo " Metadata: http://localhost:8084"
echo ""
echo "Check status: kubectl get pods -n $NAMESPACE"

13 changes: 13 additions & 0 deletions manifests/helm/microforge/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Thank you for installing {{ .Chart.Name }}!

Access your services:
- Frontend: http://localhost:3000
- Login Service: http://localhost:8081
- Auth Service: http://localhost:8082
- Notification Service: http://localhost:8083
- Metadata Service: http://localhost:8084

Check status:
kubectl get pods -n {{ include "microforge.namespace" . }}
kubectl get services -n {{ include "microforge.namespace" . }}

Loading