Skip to content

Commit 24158f5

Browse files
authored
Merge pull request #25 from CeerDecy/feature/migration
feat: database migration
2 parents 17b30f5 + cf4230f commit 24158f5

File tree

20 files changed

+281
-62
lines changed

20 files changed

+281
-62
lines changed

.helm/mcp-center/Chart.lock

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
dependencies:
2+
- name: postgresql
3+
repository: https://charts.bitnami.com/bitnami
4+
version: 16.7.27
5+
digest: sha256:e8b999a3aaad6328a13d0c666207650897b69c61367c947d363b2acbe0ea1b42
6+
generated: "2025-09-05T16:07:59.376939+08:00"

.helm/mcp-center/Chart.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,9 @@ version: 0.1.0
2222
# follow Semantic Versioning. They should reflect the version the application is using.
2323
# It is recommended to use it with quotes.
2424
appVersion: "1.16.0"
25+
26+
dependencies:
27+
- name: postgresql
28+
version: "17.x.x"
29+
repository: "https://charts.bitnami.com/bitnami"
30+
condition: postgresql.enabled

.helm/mcp-center/DEPLOYMENT.md

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# MCP Center Helm Chart Deployment Guide
2+
3+
## Deployment Options
4+
5+
### Option 1: Using Built-in PostgreSQL (Recommended for Development/Testing)
6+
7+
```bash
8+
# Deploy with default configuration (includes PostgreSQL)
9+
helm install mcp-center . --create-namespace --namespace mcp-center
10+
```
11+
12+
### Option 2: Using External PostgreSQL (Recommended for Production)
13+
14+
1. Copy the example configuration file:
15+
```bash
16+
cp values-external-postgres.yaml my-values.yaml
17+
```
18+
19+
2. Edit the configuration file and set your PostgreSQL connection information:
20+
```yaml
21+
postgresql:
22+
enabled: false
23+
24+
externalPostgresql:
25+
host: "your-postgres-host.example.com"
26+
port: 5432
27+
username: "mcpcenter"
28+
password: "your-secure-password"
29+
database: "mcpcenter"
30+
```
31+
32+
3. Deploy with custom configuration:
33+
```bash
34+
helm install mcp-center . -f my-values.yaml --create-namespace --namespace mcp-center
35+
```
36+
37+
## Configuration
38+
39+
### PostgreSQL Configuration
40+
41+
- `postgresql.enabled`: Whether to enable built-in PostgreSQL
42+
- `true`: Use built-in PostgreSQL (requires storage class support)
43+
- `false`: Use external PostgreSQL
44+
45+
### External PostgreSQL Configuration
46+
47+
When `postgresql.enabled: false`, configure the following parameters:
48+
49+
- `externalPostgresql.host`: PostgreSQL server address
50+
- `externalPostgresql.port`: PostgreSQL port (default 5432)
51+
- `externalPostgresql.username`: Database username
52+
- `externalPostgresql.password`: Database password (stored securely in Kubernetes Secret)
53+
- `externalPostgresql.database`: Database name
54+
55+
### MCP Admin Token Configuration
56+
57+
- `mcpAdminToken`: 32-character random string for MCP admin authentication
58+
- Default: Auto-generated 32-character random string
59+
- Custom: You can set your own token in values.yaml
60+
61+
## Environment Variables
62+
63+
The application will automatically receive the following environment variables:
64+
65+
- `POSTGRES_HOST`: PostgreSQL host address
66+
- `POSTGRES_PORT`: PostgreSQL port
67+
- `POSTGRES_USERNAME`: Database username
68+
- `POSTGRES_PASSWORD`: Database password
69+
- `POSTGRES_DATABASE`: Database name
70+
- `MCP_ADMIN_TOKEN`: 32-character random string for admin authentication
71+
72+
## Troubleshooting
73+
74+
### Built-in PostgreSQL Cannot Start
75+
- Check if the cluster has available storage classes
76+
- Check if there is sufficient storage space
77+
- View Pod logs: `kubectl logs -n mcp-center <pod-name>`
78+
79+
### External PostgreSQL Connection Failed
80+
- Check network connectivity
81+
- Verify if PostgreSQL service is accessible
82+
- Check if username, password, and database name are correct
84.2 KB
Binary file not shown.

.helm/mcp-center/templates/NOTES.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
MCP Center has been successfully deployed!
22

3+
To get your MCP Admin Token, run:
4+
kubectl get secret --namespace {{ .Release.Namespace }} {{ include "mcp-center.fullname" . }}-secret -o jsonpath="{.data.mcp-admin-token}" | base64 --decode && echo
5+
6+
{{- if not .Values.postgresql.enabled }}
7+
To get your PostgreSQL password, run:
8+
kubectl get secret --namespace {{ .Release.Namespace }} {{ include "mcp-center.fullname" . }}-secret -o jsonpath="{.data.postgres-password}" | base64 --decode && echo
9+
{{- end }}
10+
11+
To check the application status, run:
12+
kubectl get pods --namespace {{ .Release.Namespace }} -l app.kubernetes.io/name=mcp-center
13+
14+
To view the application logs, run:
15+
kubectl logs --namespace {{ .Release.Namespace }} -l app.kubernetes.io/name=mcp-center
16+
317
{{- if .Values.ingress.enabled }}
418
Access URLs:
519
{{- range $host := .Values.ingress.hosts }}

.helm/mcp-center/templates/_helpers.tpl

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,19 @@ Create the name of the service account to use
6060
{{- default "default" .Values.serviceAccount.name }}
6161
{{- end }}
6262
{{- end }}
63+
64+
{{/*
65+
Create the name of the PostgreSQL service
66+
*/}}
67+
{{- define "mcp-center.postgresql.fullname" -}}
68+
{{- if .Values.postgresql.fullnameOverride }}
69+
{{- .Values.postgresql.fullnameOverride | trunc 63 | trimSuffix "-" }}
70+
{{- else }}
71+
{{- $name := default "postgresql" .Values.postgresql.nameOverride }}
72+
{{- if contains $name .Release.Name }}
73+
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
74+
{{- else }}
75+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
76+
{{- end }}
77+
{{- end }}
78+
{{- end }}

.helm/mcp-center/templates/configmap.yaml

Lines changed: 0 additions & 19 deletions
This file was deleted.

.helm/mcp-center/templates/deployment.yaml

Lines changed: 39 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,41 @@ spec:
4444
- name: http
4545
containerPort: {{ .Values.service.port }}
4646
protocol: TCP
47+
env:
48+
{{- if .Values.postgresql.enabled }}
49+
- name: POSTGRES_HOST
50+
value: {{ include "mcp-center.postgresql.fullname" . }}
51+
- name: POSTGRES_PORT
52+
value: "5432"
53+
- name: POSTGRES_USERNAME
54+
value: {{ .Values.postgresql.auth.username }}
55+
- name: POSTGRES_PASSWORD
56+
valueFrom:
57+
secretKeyRef:
58+
name: {{ include "mcp-center.postgresql.fullname" . }}
59+
key: postgresql-password
60+
- name: POSTGRES_DATABASE
61+
value: {{ .Values.postgresql.auth.database }}
62+
{{- else }}
63+
- name: POSTGRES_HOST
64+
value: {{ .Values.externalPostgresql.host }}
65+
- name: POSTGRES_PORT
66+
value: {{ .Values.externalPostgresql.port | quote }}
67+
- name: POSTGRES_USERNAME
68+
value: {{ .Values.externalPostgresql.username }}
69+
- name: POSTGRES_PASSWORD
70+
valueFrom:
71+
secretKeyRef:
72+
name: {{ include "mcp-center.fullname" . }}-secret
73+
key: postgres-password
74+
- name: POSTGRES_DATABASE
75+
value: {{ .Values.externalPostgresql.database }}
76+
{{- end }}
77+
- name: MCP_ADMIN_TOKEN
78+
valueFrom:
79+
secretKeyRef:
80+
name: {{ include "mcp-center.fullname" . }}-secret
81+
key: mcp-admin-token
4782
{{- with .Values.livenessProbe }}
4883
livenessProbe:
4984
{{- toYaml . | nindent 12 }}
@@ -56,20 +91,14 @@ spec:
5691
resources:
5792
{{- toYaml . | nindent 12 }}
5893
{{- end }}
94+
{{- with .Values.volumeMounts }}
5995
volumeMounts:
60-
- name: mcp-servers-config
61-
mountPath: /app/mcp_servers.toml
62-
subPath: mcp_servers.toml
63-
{{- with .Values.volumeMounts }}
6496
{{- toYaml . | nindent 12 }}
65-
{{- end }}
97+
{{- end }}
98+
{{- with .Values.volumes }}
6699
volumes:
67-
- name: mcp-servers-config
68-
configMap:
69-
name: {{ include "mcp-center.fullname" . }}-config
70-
{{- with .Values.volumes }}
71100
{{- toYaml . | nindent 8 }}
72-
{{- end }}
101+
{{- end }}
73102
{{- with .Values.nodeSelector }}
74103
nodeSelector:
75104
{{- toYaml . | nindent 8 }}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
apiVersion: v1
2+
kind: Secret
3+
metadata:
4+
name: {{ include "mcp-center.fullname" . }}-secret
5+
labels:
6+
{{- include "mcp-center.labels" . | nindent 4 }}
7+
type: Opaque
8+
data:
9+
mcp-admin-token: {{ .Values.mcpAdminToken | b64enc }}
10+
{{- if not .Values.postgresql.enabled }}
11+
postgres-password: {{ .Values.externalPostgresql.password | b64enc }}
12+
{{- end }}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Example values file for custom MCP Admin Token
2+
# Copy this file and modify the values according to your setup
3+
4+
# Custom MCP Admin Token (32 characters)
5+
# You can generate a random token using: openssl rand -hex 16
6+
mcpAdminToken: "your-32-character-random-token-here"
7+
8+
# Other configurations remain the same
9+
replicaCount: 1
10+
11+
image:
12+
repository: nautilusops/mcp-center
13+
pullPolicy: IfNotPresent
14+
tag: "release"
15+
16+
service:
17+
type: ClusterIP
18+
port: 5432
19+
20+
# PostgreSQL Configuration
21+
postgresql:
22+
enabled: false
23+
24+
externalPostgresql:
25+
host: "your-postgres-host.example.com"
26+
port: 5432
27+
username: "mcpcenter"
28+
password: "your-secure-password"
29+
database: "mcpcenter"

0 commit comments

Comments
 (0)