Skip to content

Commit 847c52e

Browse files
authored
Merge pull request #97 from temporalio/rh-helm-chart
Add a helm chart.
2 parents bd7db35 + 0f0ccb3 commit 847c52e

37 files changed

+1051
-47
lines changed

.dockerignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
.git
22
.gitignore
3+
charts
34
deployments
4-
web/.svelte-kit
5-
web/node_modules

.github/workflows/docker-publish.yml

Lines changed: 47 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ on:
55
branches: [ "main" ]
66
pull_request:
77
branches: [ "main" ]
8+
release:
9+
types: [published]
810

911
jobs:
1012
build-and-push-image:
@@ -14,6 +16,9 @@ jobs:
1416
packages: write
1517

1618
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v4
21+
1722
- name: Setup Docker buildx
1823
uses: docker/setup-buildx-action@v3
1924

@@ -25,26 +30,65 @@ jobs:
2530
username: ${{ github.actor }}
2631
password: ${{ secrets.GITHUB_TOKEN }}
2732

33+
- name: Extract metadata for worker
34+
id: meta-worker
35+
uses: docker/metadata-action@v5
36+
with:
37+
images: ghcr.io/temporalio/reference-app-orders-go-worker
38+
tags: |
39+
type=ref,event=branch
40+
type=ref,event=pr
41+
type=semver,pattern={{version}}
42+
type=semver,pattern={{major}}.{{minor}}
43+
type=raw,value=latest,enable={{is_default_branch}}
44+
45+
- name: Extract metadata for api
46+
id: meta-api
47+
uses: docker/metadata-action@v5
48+
with:
49+
images: ghcr.io/temporalio/reference-app-orders-go-api
50+
tags: |
51+
type=ref,event=branch
52+
type=ref,event=pr
53+
type=semver,pattern={{version}}
54+
type=semver,pattern={{major}}.{{minor}}
55+
type=raw,value=latest,enable={{is_default_branch}}
56+
57+
- name: Extract metadata for codec-server
58+
id: meta-codec-server
59+
uses: docker/metadata-action@v5
60+
with:
61+
images: ghcr.io/temporalio/reference-app-orders-go-codec-server
62+
tags: |
63+
type=ref,event=branch
64+
type=ref,event=pr
65+
type=semver,pattern={{version}}
66+
type=semver,pattern={{major}}.{{minor}}
67+
type=raw,value=latest,enable={{is_default_branch}}
68+
2869
- name: Build and push oms-go-worker Docker image
2970
uses: docker/[email protected]
3071
with:
3172
platforms: linux/amd64,linux/arm64
3273
target: oms-worker
33-
tags: ghcr.io/temporalio/reference-app-orders-go-worker:latest
74+
tags: ${{ steps.meta-worker.outputs.tags }}
75+
labels: ${{ steps.meta-worker.outputs.labels }}
3476
push: ${{ github.event_name != 'pull_request' }}
3577

3678
- name: Build and push oms-go-api Docker image
3779
uses: docker/[email protected]
3880
with:
3981
platforms: linux/amd64,linux/arm64
4082
target: oms-api
41-
tags: ghcr.io/temporalio/reference-app-orders-go-api:latest
83+
tags: ${{ steps.meta-api.outputs.tags }}
84+
labels: ${{ steps.meta-api.outputs.labels }}
4285
push: ${{ github.event_name != 'pull_request' }}
4386

4487
- name: Build and push oms-go-codec-server Docker image
4588
uses: docker/[email protected]
4689
with:
4790
platforms: linux/amd64,linux/arm64
4891
target: oms-codec-server
49-
tags: ghcr.io/temporalio/reference-app-orders-go-codec-server:latest
92+
tags: ${{ steps.meta-codec-server.outputs.tags }}
93+
labels: ${{ steps.meta-codec-server.outputs.labels }}
5094
push: ${{ github.event_name != 'pull_request' }}

.github/workflows/helm-chart.yaml

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
name: Package and Publish Helm Chart
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version_bump:
7+
description: 'Type of version bump to perform'
8+
required: true
9+
default: 'patch'
10+
type: choice
11+
options:
12+
- patch
13+
- minor
14+
- major
15+
app_version:
16+
description: 'Application version to set (e.g., 1.2.0, v2.1.0)'
17+
required: true
18+
type: string
19+
20+
permissions:
21+
packages: write
22+
contents: write
23+
24+
jobs:
25+
release:
26+
runs-on: ubuntu-latest
27+
steps:
28+
- name: Checkout
29+
uses: actions/checkout@v4
30+
with:
31+
fetch-depth: 0
32+
33+
- name: Configure Git
34+
run: |
35+
git config user.name "$GITHUB_ACTOR"
36+
git config user.email "[email protected]"
37+
38+
- name: Install Helm
39+
uses: azure/setup-helm@v4
40+
with:
41+
version: v3.14.0
42+
43+
- name: Update Chart Version and App Version
44+
id: update_versions
45+
run: |
46+
# Get current chart version from Chart.yaml
47+
CURRENT_VERSION=$(grep 'version:' charts/reference-app-orders-go/Chart.yaml | awk '{print $2}')
48+
echo "Current chart version: $CURRENT_VERSION"
49+
50+
# Split version into parts
51+
IFS='.' read -r -a VERSION_PARTS <<< "$CURRENT_VERSION"
52+
MAJOR=${VERSION_PARTS[0]}
53+
MINOR=${VERSION_PARTS[1]}
54+
PATCH=${VERSION_PARTS[2]}
55+
56+
# Increment chart version based on input
57+
if [[ "${{ inputs.version_bump }}" == "major" ]]; then
58+
MAJOR=$((MAJOR + 1))
59+
MINOR=0
60+
PATCH=0
61+
elif [[ "${{ inputs.version_bump }}" == "minor" ]]; then
62+
MINOR=$((MINOR + 1))
63+
PATCH=0
64+
else
65+
PATCH=$((PATCH + 1))
66+
fi
67+
68+
NEW_CHART_VERSION="$MAJOR.$MINOR.$PATCH"
69+
echo "New chart version: $NEW_CHART_VERSION"
70+
71+
# Get the app version from input
72+
APP_VERSION="${{ inputs.app_version }}"
73+
echo "App version: $APP_VERSION"
74+
75+
# Update Chart.yaml with new chart version and app version
76+
sed -i "s/version: $CURRENT_VERSION/version: $NEW_CHART_VERSION/g" charts/reference-app-orders-go/Chart.yaml
77+
sed -i "s/appVersion: .*/appVersion: \"$APP_VERSION\"/g" charts/reference-app-orders-go/Chart.yaml
78+
79+
# Set output variables for use in later steps
80+
echo "chart_version=$NEW_CHART_VERSION" >> $GITHUB_OUTPUT
81+
echo "app_version=$APP_VERSION" >> $GITHUB_OUTPUT
82+
83+
# Show the changes
84+
echo "Updated Chart.yaml:"
85+
grep -E "(version:|appVersion:)" charts/reference-app-orders-go/Chart.yaml
86+
87+
# Commit the changes
88+
git add charts/reference-app-orders-go/Chart.yaml
89+
git commit -m "Bump chart version to $NEW_CHART_VERSION and app version to $APP_VERSION [skip ci]"
90+
git push
91+
92+
- name: Login to GHCR
93+
uses: docker/login-action@v3
94+
with:
95+
registry: ghcr.io
96+
username: ${{ github.actor }}
97+
password: ${{ secrets.GITHUB_TOKEN }}
98+
99+
- name: Package and Push Helm chart
100+
run: |
101+
# Use versions from previous step
102+
CHART_VERSION=${{ steps.update_versions.outputs.chart_version }}
103+
APP_VERSION=${{ steps.update_versions.outputs.app_version }}
104+
echo "Chart version: $CHART_VERSION"
105+
echo "App version: $APP_VERSION"
106+
107+
# Package the chart
108+
helm package charts/reference-app-orders-go
109+
110+
# Push to GHCR
111+
helm push reference-app-orders-go-${CHART_VERSION}.tgz oci://ghcr.io/temporalio/charts
112+
113+
echo "✅ Chart pushed successfully to oci://ghcr.io/temporalio/charts/reference-app-orders-go:${CHART_VERSION}"
114+
echo "📦 Application version set to: ${APP_VERSION}"
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
apiVersion: v2
2+
name: reference-app-orders-go
3+
description: A reference application for order management built with Temporal
4+
5+
type: application
6+
7+
version: 0.1.0
8+
appVersion: latest
Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
# Reference App Orders Go Helm Chart
2+
3+
A Helm chart for deploying the reference-app-orders-go application, which demonstrates a distributed order management system built with Temporal.
4+
5+
## Prerequisites
6+
7+
- Kubernetes 1.19+
8+
- Helm 3.0+
9+
- A running Temporal Service
10+
11+
## Installation
12+
13+
### Install from OCI Registry
14+
15+
```bash
16+
helm install -n oms --create-namespace oms oci://ghcr.io/temporalio/charts/reference-app-orders-go
17+
```
18+
19+
### Install from Local Chart
20+
21+
```bash
22+
helm install -n oms --create-namespace oms ./charts/reference-app-orders-go
23+
```
24+
25+
## Configuration
26+
27+
The following table lists the configurable parameters and their default values:
28+
29+
| Parameter | Description | Default |
30+
|-----------|-------------|---------|
31+
| `nameOverride` | Override the name of the chart | `""` |
32+
| `fullnameOverride` | Override the full name of the chart | `""` |
33+
| `image.pullPolicy` | Image pull policy | `IfNotPresent` |
34+
| `mongodb.enabled` | Enable MongoDB deployment | `true` |
35+
| `mongodb.image.repository` | MongoDB image repository | `mongo` |
36+
| `mongodb.image.tag` | MongoDB image tag | `6` |
37+
| `mongodb.resources.limits.cpu` | MongoDB CPU limit | `500m` |
38+
| `mongodb.resources.limits.memory` | MongoDB memory limit | `512Mi` |
39+
| `mongodb.resources.requests.cpu` | MongoDB CPU request | `250m` |
40+
| `mongodb.resources.requests.memory` | MongoDB memory request | `256Mi` |
41+
| `mongodb.persistence.enabled` | Enable MongoDB persistent storage | `true` |
42+
| `mongodb.persistence.size` | MongoDB storage size | `100Mi` |
43+
| `mongodb.persistence.storageClass` | MongoDB storage class | `""` |
44+
| `main.worker.replicaCount` | Number of main worker replicas | `1` |
45+
| `main.worker.image.repository` | Main worker image repository | `ghcr.io/temporalio/reference-app-orders-go` |
46+
| `main.worker.image.tag` | Main worker image tag | `Chart.appVersion` |
47+
| `main.api.replicaCount` | Number of main API replicas | `1` |
48+
| `main.api.image.repository` | Main API image repository | `ghcr.io/temporalio/reference-app-orders-go` |
49+
| `main.api.image.tag` | Main API image tag | `Chart.appVersion` |
50+
| `billing.worker.replicaCount` | Number of billing worker replicas | `1` |
51+
| `billing.worker.image.repository` | Billing worker image repository | `ghcr.io/temporalio/reference-app-orders-go` |
52+
| `billing.worker.image.tag` | Billing worker image tag | `Chart.appVersion` |
53+
| `billing.api.replicaCount` | Number of billing API replicas | `1` |
54+
| `billing.api.image.repository` | Billing API image repository | `ghcr.io/temporalio/reference-app-orders-go` |
55+
| `billing.api.image.tag` | Billing API image tag | `Chart.appVersion` |
56+
| `web.replicaCount` | Number of web application replicas | `1` |
57+
| `web.image.repository` | Web application image repository | `ghcr.io/temporalio/reference-app-orders-web` |
58+
| `web.image.tag` | Web application image tag | `latest` |
59+
| `temporal.address` | Temporal frontend address | `temporal-frontend:7233` |
60+
| `temporal.namespace` | Temporal namespace | `default` |
61+
| `services.billing.port` | Billing API port | `8081` |
62+
| `services.order.port` | Order API port | `8082` |
63+
| `services.shipment.port` | Shipment API port | `8083` |
64+
| `services.fraud.port` | Fraud API port | `8084` |
65+
| `metrics.enabled` | Enable metrics collection | `true` |
66+
| `metrics.port` | Metrics port | `9090` |
67+
| `serviceMonitor.enabled` | Enable ServiceMonitor for Prometheus | `false` |
68+
| `serviceMonitor.interval` | Scrape interval | `30s` |
69+
| `encryptionKeyID` | Optional encryption key ID for payload encryption | `""` |
70+
71+
## Services
72+
73+
This chart deploys the following services:
74+
75+
### Database
76+
- **MongoDB**: Provides a shared cache for the main API service
77+
78+
### Workers
79+
- **Main Worker**: Handles order and shipment workflows
80+
- **Billing Worker**: Handles billing workflows
81+
82+
### APIs
83+
- **Main API**: Exposes order, shipment, and fraud APIs
84+
- **Billing API**: Exposes billing API
85+
86+
### Web Application
87+
- **Web**: Frontend web application that provides a user interface for the order management system
88+
89+
## Example Values
90+
91+
```yaml
92+
# Scale API services horizontally
93+
main:
94+
api:
95+
replicaCount: 3
96+
97+
# Enable web application
98+
web:
99+
replicaCount: 2
100+
image:
101+
tag: "v2.0.0"
102+
103+
# Custom MongoDB configuration
104+
mongodb:
105+
resources:
106+
limits:
107+
cpu: "1000m"
108+
memory: "1Gi"
109+
persistence:
110+
size: 1Gi
111+
storageClass: "fast-ssd"
112+
113+
# Custom image
114+
main:
115+
worker:
116+
image:
117+
repository: my-registry/orders-app
118+
tag: v1.0.0
119+
120+
# Enable monitoring
121+
serviceMonitor:
122+
enabled: true
123+
interval: 15s
124+
125+
# Connect to external Temporal Service
126+
temporal:
127+
address: hostname.example.com:7233
128+
namespace: orders
129+
130+
# Enable payload encryption
131+
encryptionKeyID: "my-encryption-key"
132+
```
133+
134+
## Database
135+
136+
The chart includes a MongoDB deployment that serves as a cache for the main API.
137+
138+
## Monitoring
139+
140+
When `serviceMonitor.enabled` is set to `true`, the chart creates ServiceMonitor resources for Prometheus to scrape metrics from the application endpoints. ServiceMonitors are deployed in the same namespace as the application services.
141+
142+
## Accessing the Web Application
143+
144+
You can forward port 80 for the oms-web service to access the OMS web application from outside the Kubernetes cluster. For example, running the following command enables you to access the web application through http://localhost:8100/.
145+
146+
```bash
147+
kubectl -n oms port-forward service/oms-web 8100:80
148+
```
149+
150+
## Uninstallation
151+
152+
```bash
153+
helm uninstall -n oms oms
154+
```
155+
156+
**Note**: This will also remove the MongoDB StatefulSet and its associated PersistentVolumeClaim. Make sure to backup any important data before uninstalling.

0 commit comments

Comments
 (0)