最初版本

This commit is contained in:
sa19840531
2026-08-15 14:51:51 +08:00
parent 4e01df4dce
commit ea47ea4449
176 changed files with 21009 additions and 0 deletions
@@ -0,0 +1,35 @@
#!/bin/bash
set -euo pipefail
# test.pubuli.com:7777 空库初始化
sudo docker exec guest-chat bundle exec rails runner "
email = 'admin@localhost.local'
password = 'LocalCw#168'
greeting = '您好,欢迎光临【49彩票集团】客服服务中心,请问有什么可以帮到您的呢?'
site_url = 'http://test.pubuli.com:7777'
account = Account.first || Account.create!(name: '测试客服', locale: 'zh_TW')
user = User.find_by(email: email)
unless user
user = User.new(name: '测试管理员', email: email, password: password, password_confirmation: password)
user.save!
AccountUser.create!(account: account, user: user, role: :administrator)
end
inbox = account.inboxes.first
unless inbox
channel = Channel::WebWidget.create!(
account: account,
website_url: site_url,
widget_color: '#E53935',
welcome_title: '',
welcome_tagline: greeting,
pre_chat_form_enabled: false
)
inbox = Inbox.create!(account: account, name: '49彩票集团客服', channel: channel, greeting_enabled: true, greeting_message: greeting)
end
bot = AgentBot.find_by(name: 'AI 客服') || AgentBot.create!(name: 'AI 客服', outgoing_url: 'http://127.0.0.1:7788/webhook/bot1/chatwoot', account: account)
AgentBotInbox.find_or_create_by!(inbox: inbox, agent_bot: bot, account: account)
puts \"OK account=#{account.id} inbox=#{inbox.id} token=#{inbox.channel.website_token} bot_url=#{bot.outgoing_url}\"
"
@@ -0,0 +1,33 @@
#!/bin/bash
set -euo pipefail
sudo docker exec guest-chat bundle exec rails runner "
email = 'admin@localhost.local'
password = 'LocalCw#168'
greeting = '您好,欢迎光临【49彩票集团】客服服务中心,请问有什么可以帮到您的呢?'
account = Account.first || Account.create!(name: '本地客服', locale: 'zh_TW')
user = User.find_by(email: email)
unless user
user = User.new(name: '本地管理员', email: email, password: password, password_confirmation: password)
user.save!
AccountUser.create!(account: account, user: user, role: :administrator)
end
inbox = account.inboxes.first
unless inbox
channel = Channel::WebWidget.create!(
account: account,
website_url: 'http://www.pubuli.com:7777',
widget_color: '#E53935',
welcome_title: '',
welcome_tagline: greeting,
pre_chat_form_enabled: false
)
inbox = Inbox.create!(account: account, name: '49彩票集团客服', channel: channel, greeting_enabled: true, greeting_message: greeting)
end
bot = AgentBot.find_by(name: 'AI 客服') || AgentBot.create!(name: 'AI 客服', outgoing_url: 'http://127.0.0.1:7788/webhook/bot1/chatwoot', account: account)
AgentBotInbox.find_or_create_by!(inbox: inbox, agent_bot: bot, account: account)
puts \"OK account=#{account.id} inbox=#{inbox.id} token=#{inbox.channel.website_token} bot_url=#{bot.outgoing_url}\"
"
@@ -0,0 +1,28 @@
SECRET_KEY_BASE=61db0140c2e890c28f6737913fb22734365590c7b9501590cd43b108532e13dfe368b1792e6a6bee1ad90dda9dbb42fca39c9d4ef76749c24488a63246ee01ca
FRONTEND_URL=http://127.0.0.1:3000
FORCE_SSL=false
DEFAULT_LOCALE=zh_TW
ENABLE_ACCOUNT_SIGNUP=true
RAILS_ENV=production
NODE_ENV=production
RAILS_LOG_TO_STDOUT=true
RAILS_SERVE_STATIC_FILES=true
INSTALLATION_ENV=docker
BUNDLE_WITHOUT=development:test
EXECJS_RUNTIME=Disabled
REDIS_URL=redis://redis:6379
REDIS_PASSWORD=ziqIkS_An0QDXH9FQ70V7KTz
POSTGRES_HOST=postgres
POSTGRES_USERNAME=postgres
POSTGRES_PASSWORD=xi_E9IhtgSYjC9PoQXZmUnMX
POSTGRES_DATABASE=chatwoot_production
ACTIVE_STORAGE_SERVICE=local
MAILER_SENDER_EMAIL=Chatwoot <noreply@localhost>
SMTP_ADDRESS=
ENABLE_PUSH_RELAY_SERVER=false
# 允许 Agent Bot webhook 打 Docker 内网 guest-cs
SAFE_FETCH_ALLOW_PRIVATE_NETWORK=true
@@ -0,0 +1,12 @@
# 远端部署(对外 7777 → 容器 7788)
# www.pubuli.com / 20.191.152.26
services:
guest-chat:
ports: !override
- "7777:7788"
env_file:
- ./guest-cs.remote.env
environment:
CHATWOOT_GUEST_BASE_URL: http://www.pubuli.com:7777/cw
FRONTEND_URL: http://www.pubuli.com:7777
@@ -0,0 +1,12 @@
# test.pubuli.com 部署(对外 7777 → 容器 7788)
# docker compose -f docker-compose.chat.yaml -f docker-compose.chat.test7777.yaml up -d --force-recreate
services:
guest-chat:
ports: !override
- "7777:7788"
env_file:
- ./guest-cs.test.env
environment:
CHATWOOT_GUEST_BASE_URL: http://20.191.152.26:7777/cw
FRONTEND_URL: http://20.191.152.26:7777
@@ -0,0 +1,78 @@
# 只部署「在线客服聊天框」(production 预编译前端)
# 浏览器入口:http://127.0.0.1:7788/guest-customer-service
#
# docker pull ladioussuapp/guest-chat:latest
# docker compose -f docker-compose.chat.yaml -f docker-compose.reuse-chatwoot-data.yaml up -d
name: guest-chat
x-cw-env: &cw-env
NODE_ENV: production
RAILS_ENV: production
INSTALLATION_ENV: docker
RAILS_SERVE_STATIC_FILES: "true"
services:
guest-chat:
image: ladioussuapp/guest-chat:latest
build:
context: .
dockerfile: Dockerfile.chatwidget
args:
RAILS_ENV: production
NODE_ENV: production
container_name: guest-chat
restart: always
env_file:
- ./chatwoot.env
- ./guest-cs.env
environment:
<<: *cw-env
CHATWOOT_GUEST_PROXY_TARGET: http://127.0.0.1:3000
CHATWOOT_GUEST_API_BASE: http://127.0.0.1:3000
CHATWOOT_GUEST_BASE_URL: http://127.0.0.1:7788/cw
APP_DEBUG: "false"
ports:
# 只对外开聊天框;Chatwoot 后台 3000 不映射
- "127.0.0.1:7788:7788"
extra_hosts:
- "host.docker.internal:host-gateway"
volumes:
- storage_data:/app/storage
depends_on:
- postgres
- redis
networks:
- guest-chat-net
postgres:
image: pgvector/pgvector:pg16
restart: always
volumes:
- postgres_data:/var/lib/postgresql/data
environment:
POSTGRES_DB: chatwoot_production
POSTGRES_USER: postgres
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-xi_E9IhtgSYjC9PoQXZmUnMX}
networks:
- guest-chat-net
redis:
image: redis:alpine
restart: always
command: ["sh", "-c", "redis-server --requirepass \"$$REDIS_PASSWORD\""]
env_file:
- ./chatwoot.env
volumes:
- redis_data:/data
networks:
- guest-chat-net
volumes:
storage_data:
postgres_data:
redis_data:
networks:
guest-chat-net:
driver: bridge
@@ -0,0 +1,56 @@
APP_NAME=API接口系统
APP_HOST=0.0.0.0
APP_PORT=7788
APP_DEBUG=false
CHATWOOT_ENABLED=true
CHATWOOT_BASE_URL=http://pai.pubuli.com:3000
CHATWOOT_WEBSITE_TOKEN=FZBhe2W4VXSXNT9Ek4etmP3L
CHATWOOT_IDENTITY_SECRET=9Fq7fmzHmButzJdq2mkbaHx5
CHATWOOT_DEBUG=false
CHATWOOT_ACCOUNT_ID=1
CHATWOOT_INBOX_ID=1
CHATWOOT_API_EMAIL=yyds@nobody.com
CHATWOOT_API_PASSWORD=YYDSyyds#168
CHATWOOT_GREETING=您好,欢迎光临【49彩票集团】客服服务中心,请问有什么可以帮到您的呢?
# 浏览器访问仍用 127.0.0.1:7788/cw;容器内代理/API 走 docker 网
CHATWOOT_GUEST_BASE_URL=http://127.0.0.1:7788/cw
CHATWOOT_GUEST_WEBSITE_TOKEN=utiK8hZAiaqmqdp2baN6Pq14
CHATWOOT_GUEST_PROXY_TARGET=http://127.0.0.1:3000
CHATWOOT_GUEST_API_BASE=http://127.0.0.1:3000
CHATWOOT_GUEST_API_EMAIL=admin@localhost.local
CHATWOOT_GUEST_API_PASSWORD=LocalCw#168
CHATWOOT_GUEST_INBOX_ID=1
CHATWOOT_WIDGET_JWT_SECRET=61db0140c2e890c28f6737913fb22734365590c7b9501590cd43b108532e13dfe368b1792e6a6bee1ad90dda9dbb42fca39c9d4ef76749c24488a63246ee01ca
CHATWOOT_AGENT_BOT_ID=1
CHATWOOT_AGENT_BOT_TOKEN=E4rBf9TbMi1C5ShpDtLztGZh
MAXKB_BRIDGE_ENABLED=true
MAXKB_BASE_URL=http://pai.pubuli.com:8080
MAXKB_ACCESS_TOKEN=4a44cfae71e8aee7
MAXKB_TIMEOUT_SEC=120
SECRET_KEY=replace-with-a-long-random-secret
API_KEY=
SESSION_COOKIE_SECURE=false
# 会员库:本机隧道时指向宿主机;无隧道则登录会员功能不可用,游客页仍可用
DB_HOST=host.docker.internal
DB_PORT=3306
DB_USER=root
DB_PASSWORD=z88KmX2VjuiYHep
DB_NAME=member_system
DB_CHARSET=utf8mb4
DB_CONNECT_TIMEOUT=5
MEMBERS_TABLE=members
WITHDRAW_TABLE=withdraw_records
WITHDRAW_REQUEST_TABLE=withdraw_request_records
DEPOSIT_TABLE=deposit_records
READ_ONLY_MODE=true
AUTO_INIT_SIM_TABLES=false
DEFAULT_ACTIVITY_ID=ad-x1234
DEPOSIT_SEARCH_HOURS=24
MAX_ORDERS=50
@@ -0,0 +1,3 @@
# 远端 20.191.152.26 / www.pubuli.com:7777 专用(bootstrap 后 token)
CHATWOOT_GUEST_WEBSITE_TOKEN=j1UAjqBgZMWQ8WfczgJSymQx
CHATWOOT_GUEST_BASE_URL=http://www.pubuli.com:7777/cw
@@ -0,0 +1,4 @@
# test.pubuli.com:7777 专用(bootstrap 后 token)
CHATWOOT_GUEST_WEBSITE_TOKEN=j1UAjqBgZMWQ8WfczgJSymQx
CHATWOOT_GUEST_BASE_URL=http://20.191.152.26:7777/cw
CHATWOOT_AGENT_BOT_TOKEN=SrQpnTgYzXq4i17nVQhemxjT