Author: Bjørnar Hagen
Date published: 2023-09-27T11:15:00Z
Tolgee has good documentation on how to run in Docker: https://tolgee.io/platform/self_hosting/running_with_docker, but unfortunately nothing on k8s, hence this post.
Preqrequisites
You have a running PostgreSQL database available.
You need to have the following Postgre extentions enabled:
- pg_trgm
- unaccent
nb: you have to be superuser to do this
Kubernetes setup
File structure:
File contents:
tolgee-k8s-manifest.yaml:
1apiVersion: apps/v1
2kind: Deployment
3metadata:
4 name: tolgee-deployment
5 namespace: REPLACE_WITH_NAMESPACE
6spec:
7 replicas: 1
8 selector:
9 matchLabels:
10 app: tolgee
11 template:
12 metadata:
13 labels:
14 app: tolgee
15 spec:
16 containers:
17 - name: tolgee
18 image: tolgee/tolgee
19 resources:
20 requests:
21 cpu: '100m'
22 memory: '512Mi'
23 limits:
24 memory: '2Gi'
25 envFrom:
26 - secretRef:
27 name: tolgee-secret
28 ports:
29 - name: http
30 containerPort: 8080
31 volumeMounts:
32 - mountPath: /data
33 name: tolgee-data
34 startupProbe:
35 initialDelaySeconds: 60
36 httpGet:
37 path: /
38 port: http
39 readinessProbe:
40 httpGet:
41 path: /login
42 port: http
43 livenessProbe:
44 httpGet:
45 path: /login
46 port: http
47 volumes:
48 - name: tolgee-data
49 emptyDir: {}
50---
51apiVersion: v1
52kind: Service
53metadata:
54 name: tolgee-service
55 namespace: REPLACE_WITH_NAMESPACE
56spec:
57 selector:
58 app: tolgee
59 ports:
60 - protocol: TCP
61 port: 8080
62 targetPort: 8080
63 name: http
64 type: ClusterIP
65---
66apiVersion: networking.k8s.io/v1
67kind: Ingress
68metadata:
69 annotations:
70 kubernetes.io/ingress.class: nginx
71 nginx.ingress.kubernetes.io/backend-protocol: HTTP
72 nginx.ingress.kubernetes.io/ssl-redirect: 'true'
73 # Uncomment the following line to turn on a whitelist with your IP
74 # nginx.ingress.kubernetes.io/whitelist-source-range: 10.0.0.0/8,172.16.0.0/12,192.168.0.0/16,REPLACE_WITH_IP/28
75 name: tolgee-ingress
76 namespace: REPLACE_WITH_NAMESPACE
77spec:
78 tls:
79 - hosts:
80 - tolgee.example.com
81 secretName: tolgee-tls
82 rules:
83 - host: tolgee.example.com
84 http:
85 paths:
86 - backend:
87 service:
88 name: tolgee-service
89 port:
90 name: http
91 path: /
92 pathType: Prefix
93---
94apiVersion: cert-manager.io/v1
95kind: Certificate
96metadata:
97 name: tolgee-certificate
98 namespace: REPLACE_WITH_NAMESPACE
99spec:
100 dnsNames:
101 - tolgee.example.com
102 secretName: tolgee-tls
103 issuerRef:
104 name: letsencrypt-production
105 kind: ClusterIssuer
.env:
1SERVER_PORT=8080
2SPRING_DATASOURCE_URL=REPLACE_ME
3SPRING_DATASOURCE_USERNAME=REPLACE_ME
4SPRING_DATASOURCE_PASSWORD=REPLACE_ME
5TOLGEE_FILE_STORAGE_URL=
6TOLGEE_FRONT_END_URL=
7TOLGEE_MAX_SCREENSHOTS_PER_KEY=20
8TOLGEE_MAX_TRANSLATION_TEXT_LENGTH=10000
9TOLGEE_MAX_UPLOAD_FILE_SIZE=51200
10TOLGEE_AUTHENTICATION_CREATE_INITIAL_USER=true
11TOLGEE_AUTHENTICATION_ENABLED=true
12TOLGEE_AUTHENTICATION_INITIAL_PASSWORD=REPLACE_ME
13TOLGEE_AUTHENTICATION_INITIAL_USERNAME=REPLACE_ME
14TOLGEE_AUTHENTICATION_JWT_EXPIRATION=604800000
15TOLGEE_AUTHENTICATION_JWT_SECRET=REPLACE_WITH_TOKEN
16TOLGEE_AUTHENTICATION_JWT_SUPER_EXPIRATION=3600000
17TOLGEE_AUTHENTICATION_NATIVE_ENABLED=true
18TOLGEE_AUTHENTICATION_NEEDS_EMAIL_VERIFICATION=false
19TOLGEE_AUTHENTICATION_REGISTRATIONS_ALLOWED=true
20TOLGEE_AUTHENTICATION_USER_CAN_CREATE_ORGANIZATIONS=true
21TOLGEE_BATCH_CONCURRENCY=1
22TOLGEE_CACHE_CAFFEINE_MAX_SIZE=-1
23TOLGEE_CACHE_DEFAULT_TTL=7200000
24TOLGEE_CACHE_ENABLED=false
25TOLGEE_CACHE_USE_REDIS=false
26TOLGEE_FILE_STORAGE_S3_ACCESS_KEY=
27TOLGEE_FILE_STORAGE_S3_BUCKET_NAME=
28TOLGEE_FILE_STORAGE_S3_ENABLED=false
29TOLGEE_FILE_STORAGE_S3_ENDPOINT=
30TOLGEE_FILE_STORAGE_S3_SECRET_KEY=
31TOLGEE_FILE_STORAGE_S3_SIGNING_REGION=
32TOLGEE_MACHINE_TRANSLATION_FREE_CREDITS_AMOUNT=-1
33TOLGEE_MACHINE_TRANSLATION_AWS_ACCESS_KEY=
34TOLGEE_MACHINE_TRANSLATION_AWS_DEFAULT_ENABLED=false
35TOLGEE_MACHINE_TRANSLATION_AWS_DEFAULT_PRIMARY=false
36TOLGEE_MACHINE_TRANSLATION_AWS_ENABLED=
37TOLGEE_MACHINE_TRANSLATION_AWS_REGION=eu-central-1
38TOLGEE_MACHINE_TRANSLATION_AWS_SECRET_KEY=
39TOLGEE_MACHINE_TRANSLATION_AZURE_AUTH_KEY=
40TOLGEE_MACHINE_TRANSLATION_AZURE_DEFAULT_ENABLED=false
41TOLGEE_MACHINE_TRANSLATION_AZURE_DEFAULT_PRIMARY=false
42TOLGEE_MACHINE_TRANSLATION_AZURE_REGION=
43TOLGEE_MACHINE_TRANSLATION_BAIDU_ACTION=false
44TOLGEE_MACHINE_TRANSLATION_BAIDU_APP_ID=
45TOLGEE_MACHINE_TRANSLATION_BAIDU_APP_SECRET=
46TOLGEE_MACHINE_TRANSLATION_BAIDU_DEFAULT_ENABLED=false
47TOLGEE_MACHINE_TRANSLATION_BAIDU_DEFAULT_PRIMARY=false
48TOLGEE_MACHINE_TRANSLATION_DEEPL_AUTH_KEY=
49TOLGEE_MACHINE_TRANSLATION_DEEPL_DEFAULT_ENABLED=false
50TOLGEE_MACHINE_TRANSLATION_DEEPL_DEFAULT_PRIMARY=false
51TOLGEE_MACHINE_TRANSLATION_DEEPL_FORMALITY=default
52TOLGEE_MACHINE_TRANSLATION_GOOGLE_API_KEY=
53TOLGEE_MACHINE_TRANSLATION_GOOGLE_DEFAULT_ENABLED=false
54TOLGEE_MACHINE_TRANSLATION_GOOGLE_DEFAULT_PRIMARY=false
55TOLGEE_POSTGRES_AUTOSTART_CONTAINER_NAME=tolgee_postgres
56TOLGEE_POSTGRES_AUTOSTART_DATABASE_NAME=tolgee_db
57TOLGEE_POSTGRES_AUTOSTART_ENABLED=false
58TOLGEE_POSTGRES_AUTOSTART_MODE=DOCKER
59TOLGEE_POSTGRES_AUTOSTART_PASSWORD=password
60TOLGEE_POSTGRES_AUTOSTART_PORT=25432
61TOLGEE_POSTGRES_AUTOSTART_USER=tolgee_user
62TOLGEE_RATE_LIMITS_ENABLED=true
63TOLGEE_SENTRY_CLIENT_DSN=
64TOLGEE_SENTRY_SERVER_DSN=
65TOLGEE_SENTRY_TRACES_SAMPLE_RATE=
66TOLGEE_SMTP_AUTH=false
67TOLGEE_SMTP_FROM=
68TOLGEE_SMTP_HOST=
69TOLGEE_SMTP_PASSWORD=
70TOLGEE_SMTP_PORT=25
71TOLGEE_SMTP_SSL_ENABLED=false
72TOLGEE_SMTP_TLS_ENABLED=false
73TOLGEE_SMTP_TLS_REQUIRED=false
74TOLGEE_SMTP_USERNAME=
75TOLGEE_TELEMETRY_ENABLED=true
76TOLGEE_WEBSOCKET_USE_REDIS=false
install.sh:
1#!/bin/bash
2
3kubectl -n REPLACE_WITH_NAMESPACE create secret generic tolgee-secret --from-env-file=.env --save-config --dry-run=client -o yaml | kubectl -n REPLACE_WITH_NAMESPACE apply -f -
4kubectl -n REPLACE_WITH_NAMESPACE apply -f tolgee-k8s-manifest.yaml
Now all you need to do is update the .env
with your own values, and run ./install.sh
.