Initial commit: Telegram Management System
Some checks failed
Deploy / deploy (push) Has been cancelled

Full-stack web application for Telegram management
- Frontend: Vue 3 + Vben Admin
- Backend: NestJS
- Features: User management, group broadcast, statistics

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
你的用户名
2025-11-04 15:37:50 +08:00
commit 237c7802e5
3674 changed files with 525172 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
apiVersion: v2
name: marketing-agent
description: A Helm chart for Telegram Marketing Intelligence Agent System
type: application
version: 1.0.0
appVersion: "1.0.0"
keywords:
- telegram
- marketing
- ai
- automation
home: https://github.com/yourcompany/marketing-agent
sources:
- https://github.com/yourcompany/marketing-agent
maintainers:
- name: DevOps Team
email: devops@yourcompany.com
dependencies:
- name: mongodb
version: "13.6.0"
repository: "https://charts.bitnami.com/bitnami"
condition: mongodb.enabled
- name: redis
version: "17.3.0"
repository: "https://charts.bitnami.com/bitnami"
condition: redis.enabled
- name: rabbitmq
version: "11.9.0"
repository: "https://charts.bitnami.com/bitnami"
condition: rabbitmq.enabled
- name: elasticsearch
version: "19.5.0"
repository: "https://charts.bitnami.com/bitnami"
condition: elasticsearch.enabled
- name: prometheus
version: "19.0.0"
repository: "https://prometheus-community.github.io/helm-charts"
condition: prometheus.enabled
- name: grafana
version: "6.50.0"
repository: "https://grafana.github.io/helm-charts"
condition: grafana.enabled

View File

@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "marketing-agent.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "marketing-agent.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 }}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "marketing-agent.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Common labels
*/}}
{{- define "marketing-agent.labels" -}}
helm.sh/chart: {{ include "marketing-agent.chart" . }}
{{ include "marketing-agent.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
{{/*
Selector labels
*/}}
{{- define "marketing-agent.selectorLabels" -}}
app.kubernetes.io/name: {{ include "marketing-agent.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{/*
Create the name of the service account to use
*/}}
{{- define "marketing-agent.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "marketing-agent.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,143 @@
{{- $services := list "apiGateway" "orchestrator" "claudeAgent" "gramjsAdapter" "safetyGuard" "analytics" "frontend" -}}
{{- range $service := $services -}}
{{- $values := index $.Values $service -}}
{{- if $values.enabled }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "marketing-agent.fullname" $ }}-{{ $service | kebabcase }}
labels:
{{- include "marketing-agent.labels" $ | nindent 4 }}
app.kubernetes.io/component: {{ $service | kebabcase }}
spec:
{{- if not (index $values "autoscaling" "enabled") }}
replicas: {{ $values.replicaCount }}
{{- end }}
selector:
matchLabels:
{{- include "marketing-agent.selectorLabels" $ | nindent 6 }}
app.kubernetes.io/component: {{ $service | kebabcase }}
template:
metadata:
annotations:
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") $ | sha256sum }}
checksum/secret: {{ include (print $.Template.BasePath "/secret.yaml") $ | sha256sum }}
labels:
{{- include "marketing-agent.selectorLabels" $ | nindent 8 }}
app.kubernetes.io/component: {{ $service | kebabcase }}
spec:
{{- with $.Values.global.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "marketing-agent.serviceAccountName" $ }}
securityContext:
runAsNonRoot: true
runAsUser: 1001
fsGroup: 1001
containers:
- name: {{ $service | kebabcase }}
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
runAsNonRoot: true
runAsUser: 1001
image: "{{ $.Values.global.image.registry }}{{ $values.image.repository }}:{{ $values.image.tag | default $.Values.global.image.tag }}"
imagePullPolicy: {{ $.Values.global.image.pullPolicy }}
ports:
- name: http
containerPort: {{ $values.service.port }}
protocol: TCP
livenessProbe:
httpGet:
path: /health
port: http
initialDelaySeconds: 30
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 3
readinessProbe:
httpGet:
path: /health
port: http
initialDelaySeconds: 10
periodSeconds: 5
timeoutSeconds: 3
failureThreshold: 3
resources:
{{- toYaml $values.resources | nindent 12 }}
env:
- name: NODE_ENV
value: {{ $.Values.global.environment }}
- name: SERVICE_NAME
value: {{ $service | kebabcase }}
{{- if eq $service "apiGateway" }}
- name: JWT_SECRET
valueFrom:
secretKeyRef:
name: {{ include "marketing-agent.fullname" $ }}-secrets
key: jwt-secret
- name: REDIS_HOST
value: {{ include "marketing-agent.fullname" $ }}-redis-master
- name: REDIS_PASSWORD
valueFrom:
secretKeyRef:
name: {{ include "marketing-agent.fullname" $ }}-redis
key: redis-password
- name: MONGODB_URI
valueFrom:
secretKeyRef:
name: {{ include "marketing-agent.fullname" $ }}-mongodb
key: mongodb-uri
{{- end }}
{{- if or (eq $service "claudeAgent") }}
- name: ANTHROPIC_API_KEY
valueFrom:
secretKeyRef:
name: {{ include "marketing-agent.fullname" $ }}-secrets
key: anthropic-api-key
{{- end }}
{{- if or (eq $service "safetyGuard") }}
- name: OPENAI_API_KEY
valueFrom:
secretKeyRef:
name: {{ include "marketing-agent.fullname" $ }}-secrets
key: openai-api-key
{{- end }}
envFrom:
- configMapRef:
name: {{ include "marketing-agent.fullname" $ }}-config
volumeMounts:
- name: tmp
mountPath: /tmp
- name: logs
mountPath: /app/logs
{{- if and (eq $service "gramjsAdapter") $values.persistence.enabled }}
- name: sessions
mountPath: /app/sessions
{{- end }}
volumes:
- name: tmp
emptyDir: {}
- name: logs
emptyDir: {}
{{- if and (eq $service "gramjsAdapter") $values.persistence.enabled }}
- name: sessions
persistentVolumeClaim:
claimName: {{ include "marketing-agent.fullname" $ }}-gramjs-sessions
{{- end }}
{{- with $.Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with $.Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with $.Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,330 @@
# Default values for marketing-agent.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
global:
image:
registry: ""
tag: "latest"
pullPolicy: IfNotPresent
imagePullSecrets: []
environment: production
region: us-east-1
# Service configurations
apiGateway:
enabled: true
replicaCount: 2
image:
repository: marketing-agent/api-gateway
tag: ""
service:
type: ClusterIP
port: 3000
ingress:
enabled: true
className: nginx
annotations:
cert-manager.io/cluster-issuer: letsencrypt-prod
nginx.ingress.kubernetes.io/proxy-body-size: 50m
hosts:
- host: api.marketing-agent.example.com
paths:
- path: /
pathType: Prefix
tls:
- secretName: api-tls
hosts:
- api.marketing-agent.example.com
resources:
limits:
cpu: 1000m
memory: 1Gi
requests:
cpu: 500m
memory: 512Mi
autoscaling:
enabled: true
minReplicas: 2
maxReplicas: 10
targetCPUUtilizationPercentage: 80
targetMemoryUtilizationPercentage: 80
orchestrator:
enabled: true
replicaCount: 2
image:
repository: marketing-agent/orchestrator
tag: ""
service:
type: ClusterIP
port: 3001
resources:
limits:
cpu: 2000m
memory: 2Gi
requests:
cpu: 1000m
memory: 1Gi
claudeAgent:
enabled: true
replicaCount: 1
image:
repository: marketing-agent/claude-agent
tag: ""
service:
type: ClusterIP
port: 3002
resources:
limits:
cpu: 2000m
memory: 4Gi
requests:
cpu: 1000m
memory: 2Gi
gramjsAdapter:
enabled: true
replicaCount: 2
image:
repository: marketing-agent/gramjs-adapter
tag: ""
service:
type: ClusterIP
port: 3003
resources:
limits:
cpu: 2000m
memory: 2Gi
requests:
cpu: 1000m
memory: 1Gi
persistence:
enabled: true
size: 10Gi
storageClass: gp3
safetyGuard:
enabled: true
replicaCount: 1
image:
repository: marketing-agent/safety-guard
tag: ""
service:
type: ClusterIP
port: 3004
resources:
limits:
cpu: 1000m
memory: 1Gi
requests:
cpu: 500m
memory: 512Mi
analytics:
enabled: true
replicaCount: 2
image:
repository: marketing-agent/analytics
tag: ""
service:
type: ClusterIP
port: 3005
resources:
limits:
cpu: 2000m
memory: 2Gi
requests:
cpu: 1000m
memory: 1Gi
frontend:
enabled: true
replicaCount: 2
image:
repository: marketing-agent/frontend
tag: ""
service:
type: ClusterIP
port: 80
ingress:
enabled: true
className: nginx
annotations:
cert-manager.io/cluster-issuer: letsencrypt-prod
nginx.ingress.kubernetes.io/enable-cors: "true"
hosts:
- host: app.marketing-agent.example.com
paths:
- path: /
pathType: Prefix
tls:
- secretName: app-tls
hosts:
- app.marketing-agent.example.com
resources:
limits:
cpu: 500m
memory: 512Mi
requests:
cpu: 200m
memory: 256Mi
# Database configurations
mongodb:
enabled: true
auth:
enabled: true
rootUser: admin
rootPassword: "changeme"
username: marketing_user
password: "changeme"
database: marketing_agent
persistence:
enabled: true
size: 50Gi
storageClass: gp3
metrics:
enabled: true
redis:
enabled: true
auth:
enabled: true
password: "changeme"
master:
persistence:
enabled: true
size: 10Gi
storageClass: gp3
replica:
replicaCount: 2
persistence:
enabled: true
size: 10Gi
metrics:
enabled: true
rabbitmq:
enabled: true
auth:
username: admin
password: "changeme"
persistence:
enabled: true
size: 10Gi
storageClass: gp3
metrics:
enabled: true
elasticsearch:
enabled: true
security:
enabled: true
elasticPassword: "changeme"
master:
persistence:
enabled: true
size: 50Gi
storageClass: gp3
data:
persistence:
enabled: true
size: 100Gi
storageClass: gp3
# Monitoring
prometheus:
enabled: true
prometheus-node-exporter:
enabled: true
kube-state-metrics:
enabled: true
prometheus-pushgateway:
enabled: false
alertmanager:
enabled: true
config:
global:
slack_api_url: 'YOUR_SLACK_WEBHOOK_URL'
route:
group_by: ['alertname', 'cluster']
group_wait: 10s
group_interval: 10s
repeat_interval: 12h
receiver: 'slack'
receivers:
- name: 'slack'
slack_configs:
- channel: '#alerts'
title: 'Marketing Agent Alert'
grafana:
enabled: true
admin:
existingSecret: ""
userKey: admin-user
passwordKey: admin-password
datasources:
datasources.yaml:
apiVersion: 1
datasources:
- name: Prometheus
type: prometheus
url: http://prometheus-server
access: proxy
isDefault: true
dashboardProviders:
dashboardproviders.yaml:
apiVersion: 1
providers:
- name: 'default'
orgId: 1
folder: ''
type: file
disableDeletion: false
editable: true
options:
path: /var/lib/grafana/dashboards/default
dashboards:
default:
marketing-agent:
url: https://raw.githubusercontent.com/yourcompany/marketing-agent/main/dashboards/marketing-agent.json
# Security
networkPolicies:
enabled: true
podSecurityPolicies:
enabled: false
secrets:
# These should be stored in Kubernetes secrets
anthropicApiKey: ""
openaiApiKey: ""
jwtSecret: ""
encryptionKey: ""
telegramSystemUrl: ""
googleCloudProject: ""
# Backup configuration
backup:
enabled: true
schedule: "0 2 * * *" # Daily at 2 AM
retention: 30 # Days
s3:
bucket: ""
region: ""
endpoint: ""
# Service mesh
serviceMesh:
enabled: false
istio:
enabled: false
# Additional configurations
nodeSelector: {}
tolerations: []
affinity: {}