feat: Go backend, enhanced search, new widgets, Docker deploy

Major changes:
- Add Go backend (backend/) with microservices architecture
- Enhanced master-agents-svc: reranker, content-classifier, stealth-crawler,
  proxy-manager, media-search, fastClassifier, language detection
- New web-svc widgets: KnowledgeCard, ProductCard, ProfileCard, VideoCard,
  UnifiedCard, CardGallery, InlineImageGallery, SourcesPanel, RelatedQuestions
- Improved discover-svc with discover-db integration
- Docker deployment improvements (Caddyfile, vendor.sh, BUILD.md)
- Library-svc: project_id schema migration
- Remove deprecated finance-svc and travel-svc
- Localization improvements across services

Made-with: Cursor
This commit is contained in:
home
2026-02-27 04:15:32 +03:00
parent 328d968f3f
commit 06fe57c765
285 changed files with 53132 additions and 1871 deletions

View File

@@ -0,0 +1,31 @@
# Dockerfile for agent-svc only
FROM golang:1.22-alpine AS builder
RUN apk add --no-cache git ca-certificates
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o /bin/agent-svc ./cmd/agent-svc
# Runtime stage
FROM alpine:3.19
RUN apk add --no-cache ca-certificates tzdata
WORKDIR /app
COPY --from=builder /bin/agent-svc /app/agent-svc
ENV PORT=3018
EXPOSE 3018
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:3018/health || exit 1
CMD ["/app/agent-svc"]

View File

@@ -0,0 +1,50 @@
# Multi-service Dockerfile - builds all services
FROM golang:1.22-alpine AS builder
RUN apk add --no-cache git ca-certificates
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY . .
# Build all services
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o /bin/api-gateway ./cmd/api-gateway
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o /bin/agent-svc ./cmd/agent-svc
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o /bin/chat-svc ./cmd/chat-svc
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o /bin/search-svc ./cmd/search-svc
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o /bin/llm-svc ./cmd/llm-svc
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o /bin/scraper-svc ./cmd/scraper-svc
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o /bin/discover-svc ./cmd/discover-svc
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o /bin/collection-svc ./cmd/collection-svc
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o /bin/file-svc ./cmd/file-svc
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o /bin/thread-svc ./cmd/thread-svc
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o /bin/computer-svc ./cmd/computer-svc
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o /bin/finance-heatmap-svc ./cmd/finance-heatmap-svc
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o /bin/learning-svc ./cmd/learning-svc
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o /bin/labs-svc ./cmd/labs-svc
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o /bin/podcast-svc ./cmd/podcast-svc
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o /bin/browser-svc ./cmd/browser-svc
# Runtime stage
FROM alpine:3.19
RUN apk add --no-cache ca-certificates tzdata
WORKDIR /app
COPY --from=builder /bin/* /app/
# Default entrypoint - can be overridden
ENV SERVICE=api-gateway
ENV PORT=3015
EXPOSE 3015 3018 3005 3001 3020 3021 3002 3025 3026 3027 3030
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:${PORT}/health || exit 1
# Run the specified service
CMD /app/${SERVICE}

View File

@@ -0,0 +1,32 @@
# Build stage
FROM golang:1.22-alpine AS builder
RUN apk add --no-cache git ca-certificates
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o /api-gateway ./cmd/api-gateway
# Runtime stage
FROM alpine:3.19
RUN apk add --no-cache ca-certificates tzdata
WORKDIR /app
COPY --from=builder /api-gateway .
ENV PORT=3015
ENV GIN_MODE=release
EXPOSE 3015
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:3015/health || exit 1
CMD ["./api-gateway"]

View File

@@ -0,0 +1,31 @@
# Dockerfile for chat-svc only
FROM golang:1.22-alpine AS builder
RUN apk add --no-cache git ca-certificates
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o /bin/chat-svc ./cmd/chat-svc
# Runtime stage
FROM alpine:3.19
RUN apk add --no-cache ca-certificates tzdata
WORKDIR /app
COPY --from=builder /bin/chat-svc /app/chat-svc
ENV PORT=3005
EXPOSE 3005
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:3005/health || exit 1
CMD ["/app/chat-svc"]

View File

@@ -0,0 +1,32 @@
# Dockerfile for computer-svc only
FROM golang:1.22-alpine AS builder
RUN apk add --no-cache git ca-certificates
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY . .
# Build only computer-svc
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o /bin/computer-svc ./cmd/computer-svc
# Runtime stage
FROM alpine:3.19
RUN apk add --no-cache ca-certificates tzdata docker-cli
WORKDIR /app
COPY --from=builder /bin/computer-svc /app/computer-svc
ENV PORT=3030
EXPOSE 3030
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:3030/health || exit 1
CMD ["/app/computer-svc"]

View File

@@ -0,0 +1,31 @@
# Dockerfile for discover-svc only
FROM golang:1.22-alpine AS builder
RUN apk add --no-cache git ca-certificates
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o /bin/discover-svc ./cmd/discover-svc
# Runtime stage
FROM alpine:3.19
RUN apk add --no-cache ca-certificates tzdata
WORKDIR /app
COPY --from=builder /bin/discover-svc /app/discover-svc
ENV PORT=3002
EXPOSE 3002
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:3002/health || exit 1
CMD ["/app/discover-svc"]

View File

@@ -0,0 +1,31 @@
# Dockerfile for search-svc only
FROM golang:1.22-alpine AS builder
RUN apk add --no-cache git ca-certificates
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o /bin/search-svc ./cmd/search-svc
# Runtime stage
FROM alpine:3.19
RUN apk add --no-cache ca-certificates tzdata
WORKDIR /app
COPY --from=builder /bin/search-svc /app/search-svc
ENV PORT=3001
EXPOSE 3001
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:3001/health || exit 1
CMD ["/app/search-svc"]

View File

@@ -0,0 +1,382 @@
version: '3.8'
services:
api-gateway:
build:
context: ../..
dockerfile: deploy/docker/Dockerfile.all
environment:
- SERVICE=api-gateway
- PORT=3015
- CHAT_SVC_URL=http://chat-svc:3005
- MASTER_AGENTS_SVC_URL=http://agent-svc:3018
- SEARCH_SVC_URL=http://search-svc:3001
- LLM_SVC_URL=http://llm-svc:3020
- SCRAPER_SVC_URL=http://scraper-svc:3021
- THREAD_SVC_URL=http://thread-svc:3027
- COMPUTER_SVC_URL=http://computer-svc:3030
- DISCOVER_SVC_URL=http://discover-svc:3002
- FINANCE_HEATMAP_SVC_URL=http://finance-heatmap-svc:3033
- LEARNING_SVC_URL=http://learning-svc:3034
ports:
- "3015:3015"
depends_on:
- chat-svc
- agent-svc
- thread-svc
- computer-svc
networks:
- gooseek
chat-svc:
build:
context: ../..
dockerfile: deploy/docker/Dockerfile.chat-svc
environment:
- SERVICE=chat-svc
- PORT=3005
- MASTER_AGENTS_SVC_URL=http://agent-svc:3018
- DISCOVER_SVC_URL=http://discover-svc:3002
ports:
- "3005:3005"
depends_on:
- agent-svc
- discover-svc
networks:
- gooseek
agent-svc:
build:
context: ../..
dockerfile: deploy/docker/Dockerfile.agent-svc
environment:
- SERVICE=agent-svc
- PORT=3018
- SEARXNG_URL=http://searxng:8080
- DISCOVER_SVC_URL=http://discover-svc:3002
- CRAWL4AI_URL=http://crawl4ai:11235
- OPENAI_API_KEY=${OPENAI_API_KEY}
- ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY}
- GEMINI_API_KEY=${GEMINI_API_KEY}
- TIMEWEB_API_BASE_URL=${TIMEWEB_API_BASE_URL}
- TIMEWEB_AGENT_ACCESS_ID=${TIMEWEB_AGENT_ACCESS_ID}
- TIMEWEB_API_KEY=${TIMEWEB_API_KEY}
ports:
- "3018:3018"
depends_on:
- search-svc
- discover-svc
networks:
- gooseek
search-svc:
build:
context: ../..
dockerfile: deploy/docker/Dockerfile.search-svc
environment:
- SERVICE=search-svc
- PORT=3001
- SEARXNG_URL=http://searxng:8080
ports:
- "3001:3001"
depends_on:
- searxng
networks:
- gooseek
llm-svc:
build:
context: ../..
dockerfile: deploy/docker/Dockerfile.all
environment:
- SERVICE=llm-svc
- PORT=3020
- OPENAI_API_KEY=${OPENAI_API_KEY}
- ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY}
- GEMINI_API_KEY=${GEMINI_API_KEY}
ports:
- "3020:3020"
networks:
- gooseek
scraper-svc:
build:
context: ../..
dockerfile: deploy/docker/Dockerfile.all
environment:
- SERVICE=scraper-svc
- PORT=3021
- CRAWL4AI_URL=http://crawl4ai:11235
ports:
- "3021:3021"
networks:
- gooseek
discover-svc:
build:
context: ../..
dockerfile: deploy/docker/Dockerfile.discover-svc
environment:
- SERVICE=discover-svc
- PORT=3002
- SEARXNG_URL=http://searxng:8080
- REDIS_URL=redis://redis:6379
- DATABASE_URL=postgres://gooseek:gooseek@postgres:5432/gooseek?sslmode=disable
ports:
- "3002:3002"
depends_on:
- searxng
- postgres
- redis
networks:
- gooseek
collection-svc:
build:
context: ../..
dockerfile: deploy/docker/Dockerfile.all
environment:
- SERVICE=collection-svc
- PORT=3025
- DATABASE_URL=postgres://gooseek:gooseek@postgres:5432/gooseek?sslmode=disable
- JWT_SECRET=${JWT_SECRET}
- AUTH_SVC_URL=${AUTH_SVC_URL}
ports:
- "3025:3025"
depends_on:
- postgres
networks:
- gooseek
file-svc:
build:
context: ../..
dockerfile: deploy/docker/Dockerfile.all
environment:
- SERVICE=file-svc
- PORT=3026
- DATABASE_URL=postgres://gooseek:gooseek@postgres:5432/gooseek?sslmode=disable
- OPENAI_API_KEY=${OPENAI_API_KEY}
- ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY}
- JWT_SECRET=${JWT_SECRET}
- FILE_STORAGE_PATH=/data/files
ports:
- "3026:3026"
volumes:
- file-storage:/data/files
depends_on:
- postgres
networks:
- gooseek
thread-svc:
build:
context: ../..
dockerfile: deploy/docker/Dockerfile.all
environment:
- SERVICE=thread-svc
- PORT=3027
- DATABASE_URL=postgres://gooseek:gooseek@postgres:5432/gooseek?sslmode=disable
- OPENAI_API_KEY=${OPENAI_API_KEY}
- JWT_SECRET=${JWT_SECRET}
- AUTH_SVC_URL=${AUTH_SVC_URL}
ports:
- "3027:3027"
depends_on:
- postgres
networks:
- gooseek
computer-svc:
build:
context: ../..
dockerfile: deploy/docker/Dockerfile.all
environment:
- SERVICE=computer-svc
- PORT=3030
- COMPUTER_SVC_PORT=3030
- DATABASE_URL=postgres://gooseek:gooseek@postgres:5432/gooseek?sslmode=disable
- REDIS_URL=redis://redis:6379
- OPENAI_API_KEY=${OPENAI_API_KEY}
- ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY}
- GEMINI_API_KEY=${GEMINI_API_KEY}
- TELEGRAM_BOT_TOKEN=${TELEGRAM_BOT_TOKEN}
- SANDBOX_IMAGE=python:3.11-slim
- BROWSER_SVC_URL=http://browser-svc:3050
ports:
- "3030:3030"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- checkpoints:/data/checkpoints
depends_on:
- postgres
- redis
- browser-svc
networks:
- gooseek
browser-svc:
build:
context: ../..
dockerfile: deploy/docker/Dockerfile.all
environment:
- SERVICE=browser-svc
- PORT=3050
- BROWSER_SVC_PORT=3050
ports:
- "3050:3050"
volumes:
- screenshots:/tmp/gooseek-screenshots
- recordings:/tmp/gooseek-recordings
networks:
- gooseek
labs-svc:
build:
context: ../..
dockerfile: deploy/docker/Dockerfile.all
environment:
- SERVICE=labs-svc
- PORT=3031
- LABS_SVC_PORT=3031
- OPENAI_API_KEY=${OPENAI_API_KEY}
- ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY}
ports:
- "3031:3031"
networks:
- gooseek
podcast-svc:
build:
context: ../..
dockerfile: deploy/docker/Dockerfile.all
environment:
- SERVICE=podcast-svc
- PORT=3032
- PODCAST_SVC_PORT=3032
- OPENAI_API_KEY=${OPENAI_API_KEY}
- ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY}
- ELEVENLABS_API_KEY=${ELEVENLABS_API_KEY}
ports:
- "3032:3032"
volumes:
- podcasts:/data/podcasts
networks:
- gooseek
finance-heatmap-svc:
build:
context: ../..
dockerfile: deploy/docker/Dockerfile.all
environment:
- SERVICE=finance-heatmap-svc
- PORT=3033
- REDIS_URL=redis://redis:6379
ports:
- "3033:3033"
depends_on:
- redis
networks:
- gooseek
learning-svc:
build:
context: ../..
dockerfile: deploy/docker/Dockerfile.all
environment:
- SERVICE=learning-svc
- PORT=3034
- LEARNING_SVC_PORT=3034
- TIMEWEB_API_BASE_URL=${TIMEWEB_API_BASE_URL}
- TIMEWEB_AGENT_ACCESS_ID=${TIMEWEB_AGENT_ACCESS_ID}
- TIMEWEB_API_KEY=${TIMEWEB_API_KEY}
- DEFAULT_LLM_MODEL=${DEFAULT_LLM_MODEL:-gpt-4o-mini}
- OPENAI_API_KEY=${OPENAI_API_KEY}
- ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY}
- DATABASE_URL=postgres://gooseek:gooseek@postgres:5432/gooseek?sslmode=disable
ports:
- "3034:3034"
depends_on:
- postgres
networks:
- gooseek
webui:
build:
context: ../../webui
dockerfile: Dockerfile
environment:
- NODE_ENV=production
- API_URL=http://api-gateway:3015
- NEXT_PUBLIC_API_URL=
ports:
- "3000:3000"
depends_on:
- api-gateway
networks:
- gooseek
restart: unless-stopped
postgres:
image: postgres:16-alpine
environment:
- POSTGRES_USER=gooseek
- POSTGRES_PASSWORD=gooseek
- POSTGRES_DB=gooseek
volumes:
- postgres-data:/var/lib/postgresql/data
ports:
- "5432:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U gooseek"]
interval: 10s
timeout: 5s
retries: 5
networks:
- gooseek
redis:
image: redis:7-alpine
command: redis-server --appendonly yes --maxmemory 256mb --maxmemory-policy allkeys-lru
volumes:
- redis-data:/data
ports:
- "6379:6379"
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
networks:
- gooseek
searxng:
image: searxng/searxng:latest
volumes:
- ../../../deploy/docker/searxng:/etc/searxng:ro
environment:
- SEARXNG_BASE_URL=http://localhost:8080
ports:
- "8080:8080"
networks:
- gooseek
crawl4ai:
image: unclecode/crawl4ai:latest
ports:
- "11235:11235"
networks:
- gooseek
networks:
gooseek:
driver: bridge
volumes:
postgres-data:
redis-data:
file-storage:
checkpoints:
screenshots:
recordings:
podcasts:

View File

@@ -0,0 +1,68 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: agent-svc
namespace: gooseek
labels:
app: agent-svc
app.kubernetes.io/name: agent-svc
app.kubernetes.io/part-of: gooseek
spec:
replicas: 3
selector:
matchLabels:
app: agent-svc
template:
metadata:
labels:
app: agent-svc
spec:
containers:
- name: agent-svc
image: gooseek/backend:latest
env:
- name: SERVICE
value: "agent-svc"
- name: PORT
value: "3018"
envFrom:
- configMapRef:
name: gooseek-config
- secretRef:
name: gooseek-secrets
ports:
- containerPort: 3018
name: http
livenessProbe:
httpGet:
path: /health
port: 3018
initialDelaySeconds: 15
periodSeconds: 20
readinessProbe:
httpGet:
path: /ready
port: 3018
initialDelaySeconds: 10
periodSeconds: 15
resources:
requests:
cpu: 500m
memory: 512Mi
limits:
cpu: 2000m
memory: 1Gi
---
apiVersion: v1
kind: Service
metadata:
name: agent-svc
namespace: gooseek
spec:
type: ClusterIP
selector:
app: agent-svc
ports:
- port: 3018
targetPort: 3018
name: http

View File

@@ -0,0 +1,68 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: api-gateway
namespace: gooseek
labels:
app: api-gateway
app.kubernetes.io/name: api-gateway
app.kubernetes.io/part-of: gooseek
spec:
replicas: 2
selector:
matchLabels:
app: api-gateway
template:
metadata:
labels:
app: api-gateway
spec:
containers:
- name: api-gateway
image: gooseek/backend:latest
env:
- name: SERVICE
value: "api-gateway"
- name: PORT
value: "3015"
envFrom:
- configMapRef:
name: gooseek-config
- secretRef:
name: gooseek-secrets
ports:
- containerPort: 3015
name: http
livenessProbe:
httpGet:
path: /health
port: 3015
initialDelaySeconds: 10
periodSeconds: 15
readinessProbe:
httpGet:
path: /ready
port: 3015
initialDelaySeconds: 5
periodSeconds: 10
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 500m
memory: 256Mi
---
apiVersion: v1
kind: Service
metadata:
name: api-gateway
namespace: gooseek
spec:
type: ClusterIP
selector:
app: api-gateway
ports:
- port: 3015
targetPort: 3015
name: http

View File

@@ -0,0 +1,68 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: chat-svc
namespace: gooseek
labels:
app: chat-svc
app.kubernetes.io/name: chat-svc
app.kubernetes.io/part-of: gooseek
spec:
replicas: 2
selector:
matchLabels:
app: chat-svc
template:
metadata:
labels:
app: chat-svc
spec:
containers:
- name: chat-svc
image: gooseek/backend:latest
env:
- name: SERVICE
value: "chat-svc"
- name: PORT
value: "3005"
envFrom:
- configMapRef:
name: gooseek-config
- secretRef:
name: gooseek-secrets
ports:
- containerPort: 3005
name: http
livenessProbe:
httpGet:
path: /health
port: 3005
initialDelaySeconds: 10
periodSeconds: 15
readinessProbe:
httpGet:
path: /ready
port: 3005
initialDelaySeconds: 5
periodSeconds: 10
resources:
requests:
cpu: 200m
memory: 256Mi
limits:
cpu: 1000m
memory: 512Mi
---
apiVersion: v1
kind: Service
metadata:
name: chat-svc
namespace: gooseek
spec:
type: ClusterIP
selector:
app: chat-svc
ports:
- port: 3005
targetPort: 3005
name: http

View File

@@ -0,0 +1,68 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: collection-svc
namespace: gooseek
labels:
app: collection-svc
app.kubernetes.io/name: collection-svc
app.kubernetes.io/part-of: gooseek
spec:
replicas: 2
selector:
matchLabels:
app: collection-svc
template:
metadata:
labels:
app: collection-svc
spec:
containers:
- name: collection-svc
image: gooseek/backend:latest
env:
- name: SERVICE
value: "collection-svc"
- name: PORT
value: "3025"
envFrom:
- configMapRef:
name: gooseek-config
- secretRef:
name: gooseek-secrets
ports:
- containerPort: 3025
name: http
livenessProbe:
httpGet:
path: /health
port: 3025
initialDelaySeconds: 10
periodSeconds: 15
readinessProbe:
httpGet:
path: /ready
port: 3025
initialDelaySeconds: 5
periodSeconds: 10
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 500m
memory: 256Mi
---
apiVersion: v1
kind: Service
metadata:
name: collection-svc
namespace: gooseek
spec:
type: ClusterIP
selector:
app: collection-svc
ports:
- port: 3025
targetPort: 3025
name: http

View File

@@ -0,0 +1,137 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: computer-svc
namespace: gooseek
labels:
app: computer-svc
spec:
replicas: 1
selector:
matchLabels:
app: computer-svc
template:
metadata:
labels:
app: computer-svc
spec:
containers:
- name: computer-svc
image: gooseek/backend:latest
command: ["/app/computer-svc"]
ports:
- containerPort: 3030
env:
- name: COMPUTER_SVC_PORT
value: "3030"
- name: DATABASE_URL
valueFrom:
secretKeyRef:
name: gooseek-secrets
key: DATABASE_URL
- name: REDIS_URL
valueFrom:
configMapKeyRef:
name: gooseek-config
key: REDIS_URL
- name: OPENAI_API_KEY
valueFrom:
secretKeyRef:
name: gooseek-secrets
key: OPENAI_API_KEY
- name: ANTHROPIC_API_KEY
valueFrom:
secretKeyRef:
name: gooseek-secrets
key: ANTHROPIC_API_KEY
optional: true
- name: GEMINI_API_KEY
valueFrom:
secretKeyRef:
name: gooseek-secrets
key: GEMINI_API_KEY
optional: true
- name: TELEGRAM_BOT_TOKEN
valueFrom:
secretKeyRef:
name: gooseek-secrets
key: TELEGRAM_BOT_TOKEN
optional: true
- name: SMTP_HOST
valueFrom:
secretKeyRef:
name: gooseek-secrets
key: SMTP_HOST
optional: true
- name: SMTP_USERNAME
valueFrom:
secretKeyRef:
name: gooseek-secrets
key: SMTP_USERNAME
optional: true
- name: SMTP_PASSWORD
valueFrom:
secretKeyRef:
name: gooseek-secrets
key: SMTP_PASSWORD
optional: true
- name: S3_ENDPOINT
valueFrom:
secretKeyRef:
name: gooseek-secrets
key: S3_ENDPOINT
optional: true
- name: S3_ACCESS_KEY
valueFrom:
secretKeyRef:
name: gooseek-secrets
key: S3_ACCESS_KEY
optional: true
- name: S3_SECRET_KEY
valueFrom:
secretKeyRef:
name: gooseek-secrets
key: S3_SECRET_KEY
optional: true
- name: SANDBOX_IMAGE
value: "gooseek/sandbox:latest"
resources:
requests:
memory: "256Mi"
cpu: "100m"
limits:
memory: "1Gi"
cpu: "1000m"
livenessProbe:
httpGet:
path: /health
port: 3030
initialDelaySeconds: 10
periodSeconds: 30
readinessProbe:
httpGet:
path: /health
port: 3030
initialDelaySeconds: 5
periodSeconds: 10
volumeMounts:
- name: docker-socket
mountPath: /var/run/docker.sock
volumes:
- name: docker-socket
hostPath:
path: /var/run/docker.sock
type: Socket
---
apiVersion: v1
kind: Service
metadata:
name: computer-svc
namespace: gooseek
spec:
selector:
app: computer-svc
ports:
- port: 3030
targetPort: 3030
type: ClusterIP

View File

@@ -0,0 +1,32 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: gooseek-config
namespace: gooseek
data:
SEARXNG_URL: "http://searxng:8080"
CRAWL4AI_URL: "http://crawl4ai:11235"
REDIS_URL: "redis://redis:6379"
DATABASE_URL: "postgres://gooseek:gooseek@postgres:5432/gooseek?sslmode=disable"
DISCOVER_SVC_URL: "http://discover-svc:3002"
MASTER_AGENTS_SVC_URL: "http://agent-svc:3018"
SEARCH_SVC_URL: "http://search-svc:3001"
LLM_SVC_URL: "http://llm-svc:3020"
SCRAPER_SVC_URL: "http://scraper-svc:3021"
COLLECTION_SVC_URL: "http://collection-svc:3025"
FILE_SVC_URL: "http://file-svc:3026"
THREAD_SVC_URL: "http://thread-svc:3027"
---
apiVersion: v1
kind: Secret
metadata:
name: gooseek-secrets
namespace: gooseek
type: Opaque
stringData:
OPENAI_API_KEY: "${OPENAI_API_KEY}"
ANTHROPIC_API_KEY: "${ANTHROPIC_API_KEY}"
GEMINI_API_KEY: "${GEMINI_API_KEY}"
JWT_SECRET: "${JWT_SECRET}"
POSTGRES_USER: "gooseek"
POSTGRES_PASSWORD: "gooseek"

56
backend/deploy/k8s/deploy.sh Executable file
View File

@@ -0,0 +1,56 @@
#!/bin/bash
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
BACKEND_DIR="$(cd "$SCRIPT_DIR/../.." && pwd)"
echo "=== GooSeek Go Backend K8s Deployment ==="
echo "Backend dir: $BACKEND_DIR"
# Check kubectl
if ! command -v kubectl &> /dev/null; then
echo "Error: kubectl not found"
exit 1
fi
# Build Docker image
echo ""
echo "=== Building Docker image ==="
cd "$BACKEND_DIR"
docker build -f deploy/docker/Dockerfile.all -t gooseek/backend:latest .
# Load to k3s (if using k3s)
if command -v k3s &> /dev/null; then
echo ""
echo "=== Loading image to k3s ==="
docker save gooseek/backend:latest | sudo k3s ctr images import -
fi
# Apply kustomization
echo ""
echo "=== Applying K8s manifests ==="
cd "$SCRIPT_DIR"
kubectl apply -k .
# Wait for rollout
echo ""
echo "=== Waiting for deployments ==="
kubectl -n gooseek rollout status deployment/api-gateway --timeout=120s || true
kubectl -n gooseek rollout status deployment/chat-svc --timeout=120s || true
kubectl -n gooseek rollout status deployment/agent-svc --timeout=120s || true
kubectl -n gooseek rollout status deployment/discover-svc --timeout=120s || true
kubectl -n gooseek rollout status deployment/search-svc --timeout=120s || true
kubectl -n gooseek rollout status deployment/redis --timeout=60s || true
# Show status
echo ""
echo "=== Deployment Status ==="
kubectl -n gooseek get pods
echo ""
kubectl -n gooseek get svc
echo ""
kubectl -n gooseek get ingress
echo ""
echo "=== Done ==="
echo "API Gateway: http://localhost:3015 (NodePort) or via Ingress"

View File

@@ -0,0 +1,68 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: discover-svc
namespace: gooseek
labels:
app: discover-svc
app.kubernetes.io/name: discover-svc
app.kubernetes.io/part-of: gooseek
spec:
replicas: 2
selector:
matchLabels:
app: discover-svc
template:
metadata:
labels:
app: discover-svc
spec:
containers:
- name: discover-svc
image: gooseek/backend:latest
env:
- name: SERVICE
value: "discover-svc"
- name: PORT
value: "3002"
envFrom:
- configMapRef:
name: gooseek-config
- secretRef:
name: gooseek-secrets
ports:
- containerPort: 3002
name: http
livenessProbe:
httpGet:
path: /health
port: 3002
initialDelaySeconds: 10
periodSeconds: 15
readinessProbe:
httpGet:
path: /ready
port: 3002
initialDelaySeconds: 5
periodSeconds: 10
resources:
requests:
cpu: 200m
memory: 256Mi
limits:
cpu: 500m
memory: 512Mi
---
apiVersion: v1
kind: Service
metadata:
name: discover-svc
namespace: gooseek
spec:
type: ClusterIP
selector:
app: discover-svc
ports:
- port: 3002
targetPort: 3002
name: http

View File

@@ -0,0 +1,90 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: file-svc
namespace: gooseek
labels:
app: file-svc
app.kubernetes.io/name: file-svc
app.kubernetes.io/part-of: gooseek
spec:
replicas: 2
selector:
matchLabels:
app: file-svc
template:
metadata:
labels:
app: file-svc
spec:
containers:
- name: file-svc
image: gooseek/backend:latest
env:
- name: SERVICE
value: "file-svc"
- name: PORT
value: "3026"
- name: FILE_STORAGE_PATH
value: "/data/files"
envFrom:
- configMapRef:
name: gooseek-config
- secretRef:
name: gooseek-secrets
ports:
- containerPort: 3026
name: http
volumeMounts:
- name: file-storage
mountPath: /data/files
livenessProbe:
httpGet:
path: /health
port: 3026
initialDelaySeconds: 10
periodSeconds: 15
readinessProbe:
httpGet:
path: /ready
port: 3026
initialDelaySeconds: 5
periodSeconds: 10
resources:
requests:
cpu: 200m
memory: 256Mi
limits:
cpu: 1000m
memory: 512Mi
volumes:
- name: file-storage
persistentVolumeClaim:
claimName: file-storage-pvc
---
apiVersion: v1
kind: Service
metadata:
name: file-svc
namespace: gooseek
spec:
type: ClusterIP
selector:
app: file-svc
ports:
- port: 3026
targetPort: 3026
name: http
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: file-storage-pvc
namespace: gooseek
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 10Gi
storageClassName: local-path

View File

@@ -0,0 +1,51 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: gooseek-ingress
namespace: gooseek
annotations:
nginx.ingress.kubernetes.io/proxy-body-size: "50m"
nginx.ingress.kubernetes.io/proxy-read-timeout: "300"
nginx.ingress.kubernetes.io/proxy-send-timeout: "300"
nginx.ingress.kubernetes.io/proxy-buffering: "off"
nginx.ingress.kubernetes.io/ssl-redirect: "true"
cert-manager.io/cluster-issuer: "letsencrypt-prod"
spec:
ingressClassName: nginx
tls:
- hosts:
- api.gooseek.ru
secretName: gooseek-tls
rules:
- host: api.gooseek.ru
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: api-gateway
port:
number: 3015
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: gooseek-ingress-local
namespace: gooseek
annotations:
nginx.ingress.kubernetes.io/proxy-body-size: "50m"
nginx.ingress.kubernetes.io/proxy-read-timeout: "300"
spec:
ingressClassName: nginx
rules:
- host: localhost
http:
paths:
- path: /api
pathType: Prefix
backend:
service:
name: api-gateway
port:
number: 3015

View File

@@ -0,0 +1,30 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: gooseek
resources:
- namespace.yaml
- configmap.yaml
- postgres.yaml
- redis.yaml
- api-gateway.yaml
- chat-svc.yaml
- agent-svc.yaml
- search-svc.yaml
- discover-svc.yaml
- llm-svc.yaml
- scraper-svc.yaml
- collection-svc.yaml
- file-svc.yaml
- thread-svc.yaml
- computer-svc.yaml
- ingress.yaml
commonLabels:
app.kubernetes.io/part-of: gooseek
app.kubernetes.io/managed-by: kustomize
images:
- name: gooseek/backend
newTag: latest

View File

@@ -0,0 +1,68 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: llm-svc
namespace: gooseek
labels:
app: llm-svc
app.kubernetes.io/name: llm-svc
app.kubernetes.io/part-of: gooseek
spec:
replicas: 2
selector:
matchLabels:
app: llm-svc
template:
metadata:
labels:
app: llm-svc
spec:
containers:
- name: llm-svc
image: gooseek/backend:latest
env:
- name: SERVICE
value: "llm-svc"
- name: PORT
value: "3020"
envFrom:
- configMapRef:
name: gooseek-config
- secretRef:
name: gooseek-secrets
ports:
- containerPort: 3020
name: http
livenessProbe:
httpGet:
path: /health
port: 3020
initialDelaySeconds: 10
periodSeconds: 15
readinessProbe:
httpGet:
path: /ready
port: 3020
initialDelaySeconds: 5
periodSeconds: 10
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 500m
memory: 256Mi
---
apiVersion: v1
kind: Service
metadata:
name: llm-svc
namespace: gooseek
spec:
type: ClusterIP
selector:
app: llm-svc
ports:
- port: 3020
targetPort: 3020
name: http

View File

@@ -0,0 +1,7 @@
apiVersion: v1
kind: Namespace
metadata:
name: gooseek
labels:
app.kubernetes.io/name: gooseek
app.kubernetes.io/managed-by: kubectl

View File

@@ -0,0 +1,86 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: postgres
namespace: gooseek
labels:
app: postgres
app.kubernetes.io/name: postgres
app.kubernetes.io/part-of: gooseek
spec:
serviceName: postgres
replicas: 1
selector:
matchLabels:
app: postgres
template:
metadata:
labels:
app: postgres
spec:
containers:
- name: postgres
image: postgres:16-alpine
env:
- name: POSTGRES_USER
valueFrom:
secretKeyRef:
name: gooseek-secrets
key: POSTGRES_USER
optional: true
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: gooseek-secrets
key: POSTGRES_PASSWORD
optional: true
- name: POSTGRES_DB
value: "gooseek"
- name: PGDATA
value: "/var/lib/postgresql/data/pgdata"
ports:
- containerPort: 5432
name: postgres
volumeMounts:
- name: postgres-data
mountPath: /var/lib/postgresql/data
resources:
requests:
cpu: 200m
memory: 256Mi
limits:
cpu: 1000m
memory: 1Gi
livenessProbe:
exec:
command: ["pg_isready", "-U", "gooseek"]
initialDelaySeconds: 30
periodSeconds: 10
readinessProbe:
exec:
command: ["pg_isready", "-U", "gooseek"]
initialDelaySeconds: 5
periodSeconds: 5
volumeClaimTemplates:
- metadata:
name: postgres-data
spec:
accessModes: ["ReadWriteOnce"]
storageClassName: local-path
resources:
requests:
storage: 10Gi
---
apiVersion: v1
kind: Service
metadata:
name: postgres
namespace: gooseek
spec:
type: ClusterIP
selector:
app: postgres
ports:
- port: 5432
targetPort: 5432
name: postgres

View File

@@ -0,0 +1,63 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: redis
namespace: gooseek
labels:
app: redis
app.kubernetes.io/name: redis
app.kubernetes.io/part-of: gooseek
spec:
replicas: 1
selector:
matchLabels:
app: redis
template:
metadata:
labels:
app: redis
spec:
containers:
- name: redis
image: redis:7-alpine
command: ["redis-server", "--appendonly", "yes", "--maxmemory", "256mb", "--maxmemory-policy", "allkeys-lru"]
ports:
- containerPort: 6379
name: redis
volumeMounts:
- name: redis-data
mountPath: /data
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 500m
memory: 512Mi
livenessProbe:
exec:
command: ["redis-cli", "ping"]
initialDelaySeconds: 5
periodSeconds: 10
readinessProbe:
exec:
command: ["redis-cli", "ping"]
initialDelaySeconds: 3
periodSeconds: 5
volumes:
- name: redis-data
emptyDir: {}
---
apiVersion: v1
kind: Service
metadata:
name: redis
namespace: gooseek
spec:
type: ClusterIP
selector:
app: redis
ports:
- port: 6379
targetPort: 6379
name: redis

View File

@@ -0,0 +1,66 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: scraper-svc
namespace: gooseek
labels:
app: scraper-svc
app.kubernetes.io/name: scraper-svc
app.kubernetes.io/part-of: gooseek
spec:
replicas: 2
selector:
matchLabels:
app: scraper-svc
template:
metadata:
labels:
app: scraper-svc
spec:
containers:
- name: scraper-svc
image: gooseek/backend:latest
env:
- name: SERVICE
value: "scraper-svc"
- name: PORT
value: "3021"
envFrom:
- configMapRef:
name: gooseek-config
ports:
- containerPort: 3021
name: http
livenessProbe:
httpGet:
path: /health
port: 3021
initialDelaySeconds: 10
periodSeconds: 15
readinessProbe:
httpGet:
path: /ready
port: 3021
initialDelaySeconds: 5
periodSeconds: 10
resources:
requests:
cpu: 200m
memory: 256Mi
limits:
cpu: 1000m
memory: 512Mi
---
apiVersion: v1
kind: Service
metadata:
name: scraper-svc
namespace: gooseek
spec:
type: ClusterIP
selector:
app: scraper-svc
ports:
- port: 3021
targetPort: 3021
name: http

View File

@@ -0,0 +1,66 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: search-svc
namespace: gooseek
labels:
app: search-svc
app.kubernetes.io/name: search-svc
app.kubernetes.io/part-of: gooseek
spec:
replicas: 2
selector:
matchLabels:
app: search-svc
template:
metadata:
labels:
app: search-svc
spec:
containers:
- name: search-svc
image: gooseek/backend:latest
env:
- name: SERVICE
value: "search-svc"
- name: PORT
value: "3001"
envFrom:
- configMapRef:
name: gooseek-config
ports:
- containerPort: 3001
name: http
livenessProbe:
httpGet:
path: /health
port: 3001
initialDelaySeconds: 10
periodSeconds: 15
readinessProbe:
httpGet:
path: /ready
port: 3001
initialDelaySeconds: 5
periodSeconds: 10
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 500m
memory: 256Mi
---
apiVersion: v1
kind: Service
metadata:
name: search-svc
namespace: gooseek
spec:
type: ClusterIP
selector:
app: search-svc
ports:
- port: 3001
targetPort: 3001
name: http

View File

@@ -0,0 +1,63 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: thread-svc
namespace: gooseek
labels:
app: thread-svc
spec:
replicas: 2
selector:
matchLabels:
app: thread-svc
template:
metadata:
labels:
app: thread-svc
spec:
containers:
- name: thread-svc
image: gooseek/backend:latest
command: ["/app/thread-svc"]
ports:
- containerPort: 3027
envFrom:
- configMapRef:
name: gooseek-config
- secretRef:
name: gooseek-secrets
env:
- name: THREAD_SVC_PORT
value: "3027"
resources:
requests:
memory: "128Mi"
cpu: "100m"
limits:
memory: "512Mi"
cpu: "500m"
readinessProbe:
httpGet:
path: /ready
port: 3027
initialDelaySeconds: 5
periodSeconds: 10
livenessProbe:
httpGet:
path: /health
port: 3027
initialDelaySeconds: 10
periodSeconds: 30
---
apiVersion: v1
kind: Service
metadata:
name: thread-svc
namespace: gooseek
spec:
selector:
app: thread-svc
ports:
- port: 3027
targetPort: 3027
type: ClusterIP