赞
踩
Chatwoot 是一款开源的多渠道客户支持平台,旨在帮助企业建立强大、高效的客户服务体系。以下是 Chatwoot 的一些主要特点和功能:
通过使用 Chatwoot,企业可以更好地管理和响应客户请求,提高客户满意度,同时保持对话历史记录,以更好地了解客户需求。
效果图
Ubuntu
docker
docker compose
apt-get update
apt-get upgrade
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
apt install docker-compose-plugin
cd ~
mkdir chatwoot
cd chatwoot
# 新建docker挂载的子目录
mkdir -p ./{postgres,redis,storage}
# env 环境变量文件
wget -O .env https://raw.githubusercontent.com/chatwoot/chatwoot/develop/.env.example
# docker-compose.yaml
wget -O docker-compose.yaml https://raw.githubusercontent.com/chatwoot/chatwoot/develop/docker-compose.production.yaml
.env
vim .env
需要修改的环境变量:
SECRET_KEY_BASE
: 可以用命令 openssl rand -base64 32
来生成;FRONTEND_URL
: 前端地址,根据实际情况填写,例如 http://127.0.0.1:3000
,或具体ip,例如http://192.168.0.10:3000
HELPCENTER_URL
: 帮助中心地址,可以和 FRONTEND_URL
一样POSTGRES_PASSWORD
: PostgresSQL
数据库密码,这个密码需要与 docker-compose.yaml
里的 PostgresSQL
密码一致我的这些设置为(具体位置需要自行寻找):
SECRET_KEY_BASE=45t2G7OgWpfgvnsOgzwilYY9q5hd7DyxiJWk1YbCRyI=
FRONTEND_URL=http://192.168.0.10:3000
HELPCENTER_URL=http://192.168.0.10:3000
POSTGRES_PASSWORD=password
保存配置
docker-compose.yaml
vim docker-compose.yaml
version: '3' services: base: &base image: chatwoot/chatwoot:latest env_file: .env ## 环境变量 volumes: - ./storage:/app/storage ## 挂载的路径 rails: <<: *base depends_on: - postgres - redis ports: - 3000:3000 environment: - NODE_ENV=production - RAILS_ENV=production - INSTALLATION_ENV=docker entrypoint: docker/entrypoints/rails.sh command: ['bundle', 'exec', 'rails', 's', '-p', '3000', '-b', '0.0.0.0'] sidekiq: <<: *base depends_on: - postgres - redis environment: - NODE_ENV=production - RAILS_ENV=production - INSTALLATION_ENV=docker command: ['bundle', 'exec', 'sidekiq', '-C', 'config/sidekiq.yml'] postgres: image: postgres:12 restart: always ports: - 5432:5432 volumes: - ./postgres:/var/lib/postgresql/data ## 挂载的路径 environment: - POSTGRES_DB=chatwoot - POSTGRES_USER=postgres - POSTGRES_PASSWORD=password ## .env 里设置的 postgres 密码 redis: image: redis:alpine restart: always command: ["sh", "-c", "redis-server --requirepass \"$REDIS_PASSWORD\""] env_file: .env volumes: - ./redis:/data ## 挂载的路径 ports: - 6379:6379
保存配置
# `docker compose` 是新版 cli 命令,如果执行不了,就换成 `docker-compose`
# 即 `docker-compose run --rm rails bundle exec rails db:chatwoot_prepare`
docker compose run --rm rails bundle exec rails db:chatwoot_prepare
会先拉取镜像,请确保网络正确,我已经拉取好了镜像,运行结果如下
ubuntu@ubuntu:~/chatwoot$ docker compose run --rm rails bundle exec rails db:chatwoot_prepare [+] Creating 2/2 ✔ Container chatwoot-postgres-1 Recreated 0.1s ✔ Container chatwoot-redis-1 Recreated 0.4s [+] Running 2/2 ✔ Container chatwoot-postgres-1 Started 0.3s ✔ Container chatwoot-redis-1 Started 0.4s + rm -rf /app/tmp/pids/server.pid + rm -rf '/app/tmp/cache/*' + echo 'Waiting for postgres to become ready....' Waiting for postgres to become ready.... + docker/entrypoints/helpers/pg_database_url.rb + export 'POSTGRES_PORT=5432' + PG_READY='pg_isready -h postgres -p 5432 -U postgres' + pg_isready -h postgres -p 5432 -U postgres postgres:5432 - no response + sleep 2 + pg_isready -h postgres -p 5432 -U postgres postgres:5432 - accepting connections + echo 'Database ready to accept connections.' Database ready to accept connections. + bundle install Bundle complete! 125 Gemfile dependencies, 247 gems now installed. Gems in the groups 'development' and 'test' were not installed. Bundled gems are installed into `/gems` + BUNDLE='bundle check' + bundle check The Gemfile's dependencies are satisfied + exec bundle exec rails db:chatwoot_prepare /gems/ruby/3.2.0/gems/gmail_xoauth-0.4.2/lib/gmail_xoauth/imap_xoauth_authenticator.rb:31: warning: Net::IMAP.add_authenticator is deprecated. Use Net::IMAP::SASL.add_authenticator instead. /gems/ruby/3.2.0/gems/gmail_xoauth-0.4.2/lib/gmail_xoauth/imap_xoauth2_authenticator.rb:24: warning: Net::IMAP.add_authenticator is deprecated. Use Net::IMAP::SASL.add_authenticator instead. fatal: not a git repository (or any of the parent directories): .git Created database 'chatwoot_production' ubuntu@ubuntu:~/chatwoot$
当看到 Created database 'chatwoot_production'
即表示创建成功,继续执行下面的命令
# 需要先删除数据库容器
docker compose down
# 一键启动
docker compose up -d
ubuntu@ubuntu:~/chatwoot$ docker compose down [+] Running 6/6 ✔ Container chatwoot-sidekiq-1 Removed 0.0s ✔ Container chatwoot-base-1 Removed 0.0s ✔ Container chatwoot-rails-1 Removed 0.0s ✔ Container chatwoot-redis-1 Removed 0.0s ✔ Container chatwoot-postgres-1 Removed 0.0s ✔ Network chatwoot_default Removed ubuntu@ubuntu:~/chatwoot$ docker compose up -d [+] Running 6/6 ✔ Network chatwoot_default Created 0.1s ✔ Container chatwoot-postgres-1 Started 0.1s ✔ Container chatwoot-redis-1 Started 0.0s ✔ Container chatwoot-base-1 Started 0.1s ✔ Container chatwoot-sidekiq-1 Started 0.1s ✔ Container chatwoot-rails-1 Started 0.0s
正确填写信息后创建
生成 script 代码
<script> (function(d,t) { var BASE_URL="http://192.168.0.10:3000"; var g=d.createElement(t),s=d.getElementsByTagName(t)[0]; g.src=BASE_URL+"/packs/js/sdk.js"; g.defer = true; g.async = true; s.parentNode.insertBefore(g,s); g.onload=function(){ window.chatwootSDK.run({ websiteToken: 'ERpVa8q5916PQqnEbNNNH3GS', baseUrl: BASE_URL }) } })(document,"script"); </script>
将script
标签内容添加在index.html
的head
标签内
效果如下:
客服:
我的博客,欢迎前往: https://blog.ivwv.site/
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。