Skip to content

Commit b6f6c29

Browse files
authored
Merge pull request #84 from amazeeio/dev
Initial Helm packaging and updates to default limits
2 parents ce3ea4f + 5ab286b commit b6f6c29

31 files changed

+2340
-116
lines changed
Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
name: Package and Publish Helm Charts
2+
3+
on:
4+
push:
5+
branches: [ main, dev ]
6+
paths:
7+
- 'helm/**'
8+
- '.github/workflows/helm-package-publish.yml'
9+
pull_request:
10+
branches: [ main, dev ]
11+
paths:
12+
- 'helm/**'
13+
- '.github/workflows/helm-package-publish.yml'
14+
release:
15+
types: [ published ]
16+
17+
env:
18+
REGISTRY: ghcr.io
19+
IMAGE_NAME: ${{ github.repository }}
20+
21+
jobs:
22+
package-and-publish:
23+
runs-on: ubuntu-latest
24+
permissions:
25+
contents: read
26+
packages: write
27+
security-events: write
28+
29+
steps:
30+
- name: Checkout code
31+
uses: actions/checkout@v4
32+
with:
33+
fetch-depth: 0
34+
35+
- name: Set up Helm
36+
uses: azure/setup-helm@v3
37+
with:
38+
version: v3.18.0
39+
40+
- name: Configure Git
41+
run: |
42+
git config user.name "github-actions[bot]"
43+
git config user.email "github-actions[bot]@users.noreply.github.com"
44+
45+
- name: Log in to Container Registry
46+
uses: docker/login-action@v3
47+
with:
48+
registry: ${{ env.REGISTRY }}
49+
username: ${{ github.actor }}
50+
password: ${{ secrets.GITHUB_TOKEN }}
51+
52+
- name: Package and publish subcharts
53+
run: |
54+
cd helm/charts
55+
for chart in */; do
56+
chart_name=$(basename "$chart")
57+
echo "Processing chart: $chart_name"
58+
59+
# Get chart version
60+
version=$(grep '^version:' "$chart_name/Chart.yaml" | awk '{print $2}')
61+
echo "Chart version: $version"
62+
63+
# Package the chart
64+
helm package "$chart_name"
65+
66+
# Push to OCI registry with version tag
67+
helm push "$chart_name-$version.tgz" oci://${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
68+
69+
# Also push with latest tag by copying the chart and updating its version
70+
cp "$chart_name-$version.tgz" "$chart_name-latest.tgz"
71+
helm push "$chart_name-latest.tgz" oci://${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
72+
73+
echo "✅ Published $chart_name:$version to GHCR via OCI"
74+
done
75+
76+
- name: Package and publish main chart
77+
run: |
78+
cd helm
79+
80+
# Update dependencies
81+
helm dependency update
82+
83+
# Package the main chart
84+
helm package .
85+
86+
# Get chart version
87+
version=$(grep '^version:' Chart.yaml | awk '{print $2}')
88+
echo "Main chart version: $version"
89+
90+
# Push to OCI registry with version tag
91+
helm push "amazee-ai-$version.tgz" oci://${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
92+
93+
# Also push with latest tag by copying the chart
94+
cp "amazee-ai-$version.tgz" "amazee-ai-latest.tgz"
95+
helm push "amazee-ai-latest.tgz" oci://${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
96+
97+
echo "✅ Published amazee-ai:$version to GHCR via OCI"
98+
99+
- name: Create Release Tag
100+
if: github.event_name == 'release'
101+
run: |
102+
cd helm
103+
version=$(grep '^version:' Chart.yaml | awk '{print $2}')
104+
echo "Creating release tag: v$version"
105+
git tag -a "v$version" -m "Release Helm charts version $version"
106+
git push origin "v$version"
107+
108+
test-charts:
109+
runs-on: ubuntu-latest
110+
permissions:
111+
contents: read
112+
113+
steps:
114+
- name: Checkout code
115+
uses: actions/checkout@v4
116+
117+
- name: Set up Helm
118+
uses: azure/setup-helm@v3
119+
with:
120+
version: v3.18.0
121+
122+
- name: Install kubectl
123+
uses: azure/setup-kubectl@v3
124+
with:
125+
version: 'latest'
126+
127+
- name: Test chart templates
128+
run: |
129+
# Test the main chart with minimal values
130+
cd helm
131+
helm dependency update
132+
helm template amazee-ai . --set frontend.enabled=false --set backend.enabled=false --set postgresql.enabled=false > /dev/null
133+
echo "✅ Main chart template test passed"
134+
135+
# Test individual subcharts
136+
cd charts
137+
for chart in */; do
138+
chart_name=$(basename "$chart")
139+
echo "Testing chart: $chart_name"
140+
helm template test-$chart_name "$chart_name" > /dev/null
141+
echo "✅ $chart_name chart template test passed"
142+
done
143+
144+
- name: Lint charts
145+
run: |
146+
cd helm
147+
helm lint . --strict
148+
cd charts
149+
for chart in */; do
150+
chart_name=$(basename "$chart")
151+
echo "Linting chart: $chart_name"
152+
helm lint "$chart_name" --strict
153+
done

.github/workflows/publish.yml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: Publish Docker Images
2+
3+
on:
4+
push:
5+
branches: [ dev ]
6+
7+
env:
8+
REGISTRY: ghcr.io
9+
NAMESPACE: ${{ github.repository_owner }}
10+
REPO_NAME: ${{ github.event.repository.name }}
11+
12+
jobs:
13+
build-and-push-backend:
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: read
17+
packages: write
18+
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@v4
22+
23+
- name: Set up Docker Buildx
24+
uses: docker/setup-buildx-action@v3
25+
26+
- name: Log in to Container Registry
27+
uses: docker/login-action@v3
28+
with:
29+
registry: ${{ env.REGISTRY }}
30+
username: ${{ github.actor }}
31+
password: ${{ secrets.GITHUB_TOKEN }}
32+
33+
- name: Extract metadata for backend
34+
id: meta-backend
35+
uses: docker/metadata-action@v5
36+
with:
37+
images: ${{ env.REGISTRY }}/${{ env.NAMESPACE }}/${{ env.REPO_NAME }}-backend
38+
tags: |
39+
type=ref,event=branch
40+
type=ref,event=pr
41+
type=sha,prefix={{branch}}-
42+
43+
- name: Build and push backend Docker image
44+
uses: docker/build-push-action@v5
45+
with:
46+
context: .
47+
file: ./Dockerfile
48+
push: true
49+
tags: ${{ steps.meta-backend.outputs.tags }}
50+
labels: ${{ steps.meta-backend.outputs.labels }}
51+
cache-from: type=gha
52+
cache-to: type=gha,mode=max
53+
54+
build-and-push-frontend:
55+
runs-on: ubuntu-latest
56+
permissions:
57+
contents: read
58+
packages: write
59+
60+
steps:
61+
- name: Checkout repository
62+
uses: actions/checkout@v4
63+
64+
- name: Set up Docker Buildx
65+
uses: docker/setup-buildx-action@v3
66+
67+
- name: Log in to Container Registry
68+
uses: docker/login-action@v3
69+
with:
70+
registry: ${{ env.REGISTRY }}
71+
username: ${{ github.actor }}
72+
password: ${{ secrets.GITHUB_TOKEN }}
73+
74+
- name: Extract metadata for frontend
75+
id: meta-frontend
76+
uses: docker/metadata-action@v5
77+
with:
78+
images: ${{ env.REGISTRY }}/${{ env.NAMESPACE }}/${{ env.REPO_NAME }}-frontend
79+
tags: |
80+
type=ref,event=branch
81+
type=ref,event=pr
82+
type=sha,prefix={{branch}}-
83+
84+
- name: Build and push frontend Docker image
85+
uses: docker/build-push-action@v5
86+
with:
87+
context: ./frontend
88+
file: ./frontend/Dockerfile
89+
push: true
90+
tags: ${{ steps.meta-frontend.outputs.tags }}
91+
labels: ${{ steps.meta-frontend.outputs.labels }}
92+
cache-from: type=gha
93+
cache-to: type=gha,mode=max

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ ENV/
3535
.vscode/
3636
*.swp
3737
*.swo
38+
.cursor/
3839

3940
# OS generated files
4041
.DS_Store

app/core/resource_limits.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
logger = logging.getLogger(__name__)
1010

1111
# Default limits across all customers and products
12-
DEFAULT_USER_COUNT = 1
13-
DEFAULT_KEYS_PER_USER = 1
14-
DEFAULT_TOTAL_KEYS = 2
15-
DEFAULT_SERVICE_KEYS = 1
16-
DEFAULT_VECTOR_DB_COUNT = 1
12+
DEFAULT_USER_COUNT = 100
13+
DEFAULT_KEYS_PER_USER = 5
14+
DEFAULT_TOTAL_KEYS = 500
15+
DEFAULT_SERVICE_KEYS = 100
16+
DEFAULT_VECTOR_DB_COUNT = 100
1717
DEFAULT_KEY_DURATION = 30
1818
DEFAULT_MAX_SPEND = 27.0
1919
DEFAULT_RPM_PER_KEY = 500

helm/Chart.lock

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
dependencies:
2+
- name: postgresql
3+
repository: https://charts.bitnami.com/bitnami
4+
version: 16.7.12
5+
- name: backend
6+
repository: ""
7+
version: 0.0.6
8+
- name: frontend
9+
repository: ""
10+
version: 0.0.6
11+
digest: sha256:f663f9c9e69d8f67366f298ff66437a5819a5102f81f5bdc1b9122913b2a37a0
12+
generated: "2025-07-01T09:04:55.541133494+02:00"

helm/Chart.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: amazee-ai
2+
description: A Helm Chart for amazee.ai with independent frontend and backend services
3+
version: 0.0.6
4+
apiVersion: v2
5+
appVersion: "0.0.6"
6+
keywords:
7+
- amazee.ai
8+
- frontend
9+
- backend
10+
- postgresql
11+
12+
dependencies:
13+
- name: postgresql
14+
version: 16.7.12
15+
repository: https://charts.bitnami.com/bitnami
16+
condition: postgresql.enabled
17+
- name: backend
18+
version: 0.0.6
19+
condition: backend.enabled
20+
dependsOn:
21+
- postgresql
22+
- name: frontend
23+
version: 0.0.6
24+
condition: frontend.enabled

0 commit comments

Comments
 (0)