Zuletzt aktiv 8 months ago

整合 PostgreSQL、Redis、MinIO、SMTP 與環境變數設定,支援 https、自動掛載資料夾、支援 Typebot Builder & Viewer,還有一鍵重啟腳本 🚀

timmy hat die Gist bearbeitet 8 months ago. Zu Änderung gehen

Keine Änderungen

timmy hat die Gist bearbeitet 9 months ago. Zu Änderung gehen

3 files changed, 147 insertions

.env(Datei erstellt)

@@ -0,0 +1,44 @@
1 + # Secret key for encryption
2 + ENCRYPTION_SECRET=KPOUyIj9sZIafK2s+M61IDQOT5e6bYC6
3 +
4 + # PostgreSQL connection string
5 + DATABASE_URL=postgresql://postgres:typebot@typebot-db:5432/typebot
6 +
7 + # Optimize Node.js memory usage
8 + NODE_OPTIONS=--no-node-snapshot
9 +
10 + # Typebot URLs
11 + # NEXTAUTH_URL=http://localhost:8080
12 + # NEXTAUTH_URL=http://192.168.42.125:8080
13 + NEXTAUTH_URL=https://typebot.lotimmy.com/
14 + NEXT_PUBLIC_VIEWER_URL=http://localhost:8081
15 +
16 + # Authentication settings
17 + NEXTAUTH_SECRET=1sHGd7/dj2ex5utL9ii+sjITsZk8NeTYqmxktK+FjTQ=
18 + ADMIN_EMAIL=admin@example.com
19 + AUTH_EMAIL=true
20 +
21 + # SMTP settings for email verification
22 + SMTP_HOST=192.168.42.107 # Change this to your SMTP server
23 + SMTP_PORT=1025 # Use 465 for SSL, 587 for TLS, 25 for non-encrypted
24 + NEXT_PUBLIC_SMTP_FROM="Typebot Notifications <your-email@example.com>"
25 + SMTP_SECURE=false # Set to true for SSL
26 +
27 + SMTP_USERNAME=none
28 + SMTP_PASSWORD=none
29 +
30 + S3_ENDPOINT=192.168.42.125
31 + S3_PORT=9000
32 + S3_SSL=false
33 + S3_REGION=us-east-1
34 + S3_BUCKET=typebot-storage
35 + S3_ACCESS_KEY=minioAdmin
36 + S3_SECRET_KEY=G0dM!nS3cr3t2025
37 +
38 +
39 + ENABLE_PAYMENTS=false
40 +
41 + # Disable third-party logins
42 + AUTH_GOOGLE=false
43 + AUTH_GITHUB=false
44 + AUTH_FACEBOOK=false

docker-compose.yml(Datei erstellt)

@@ -0,0 +1,88 @@
1 + x-typebot-common: &typebot-common
2 + restart: always
3 + depends_on:
4 + typebot-redis:
5 + condition: service_healthy
6 + typebot-db:
7 + condition: service_healthy
8 + typebot-minio:
9 + condition: service_healthy
10 + networks:
11 + - typebot-network
12 + env_file: .env
13 + environment:
14 + REDIS_URL: redis://typebot-redis:6379
15 +
16 + services:
17 + typebot-db:
18 + container_name: typebot-db
19 + image: postgres:16
20 + restart: always
21 + volumes:
22 + - ./db-data:/var/lib/postgresql/data
23 + environment:
24 + - POSTGRES_DB=typebot
25 + - POSTGRES_USER=postgres
26 + - POSTGRES_PASSWORD=typebot
27 + healthcheck:
28 + test: ["CMD-SHELL", "pg_isready -U postgres -d typebot"]
29 + interval: 5s
30 + timeout: 5s
31 + retries: 10
32 + networks:
33 + - typebot-network
34 +
35 + typebot-redis:
36 + container_name: typebot-redis
37 + image: redis:alpine
38 + restart: always
39 + command: --save 60 1 --loglevel warning
40 + healthcheck:
41 + test: ["CMD-SHELL", "redis-cli ping | grep PONG"]
42 + start_period: 20s
43 + interval: 30s
44 + retries: 5
45 + timeout: 3s
46 + volumes:
47 + - ./redis-data:/data
48 + networks:
49 + - typebot-network
50 +
51 + typebot-minio:
52 + container_name: typebot-minio
53 + image: minio/minio
54 + restart: always
55 + command: server /data --console-address ":9001"
56 + environment:
57 + - MINIO_ROOT_USER=minioAdmin
58 + - MINIO_ROOT_PASSWORD=G0dM!nS3cr3t2025
59 + volumes:
60 + - ./minio-data:/data
61 + ports:
62 + - "9000:9000"
63 + - "9001:9001"
64 + networks:
65 + - typebot-network
66 + healthcheck:
67 + test: ["CMD-SHELL", "curl -f http://localhost:9000/minio/health/live || exit 1"]
68 + interval: 30s
69 + timeout: 10s
70 + retries: 5
71 +
72 + typebot-builder:
73 + container_name: typebot-builder
74 + <<: *typebot-common
75 + image: baptistearno/typebot-builder:latest
76 + ports:
77 + - "8080:3000"
78 +
79 + typebot-viewer:
80 + container_name: typebot-viewer
81 + <<: *typebot-common
82 + image: baptistearno/typebot-viewer:latest
83 + ports:
84 + - "8081:3000"
85 +
86 + networks:
87 + typebot-network:
88 + driver: bridge

restart-typebot.sh(Datei erstellt)

@@ -0,0 +1,15 @@
1 + #!/bin/bash
2 +
3 + echo "Stopping Typebot..."
4 + docker-compose down
5 +
6 + echo "Starting Typebot..."
7 + docker-compose up -d
8 +
9 + echo "Waiting for services to start..."
10 + sleep 5 # Wait 5 seconds for containers to start
11 +
12 + echo "Checking container status..."
13 + docker ps | grep typebot
14 +
15 + echo "Typebot restarted successfully!"
Neuer Älter