全球主机交流论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

CeraNetworks网络延迟测速工具IP归属甄别会员请立即修改密码
楼主: 小萝卜

有没有大佬教学一下宝塔下chatwoot的安装,送个小红包

[复制链接]
 楼主| 发表于 2024-3-27 17:20:37 | 显示全部楼层
misakafa 发表于 2024-3-27 17:19
这个是iptables命令报错了,看看你的docker-compose.yml文件

  1. version: '3'

  2. services:
  3.   base: &base
  4.     image: chatwoot/chatwoot:latest
  5.     env_file: .env ## Change this file for customized env variables
  6.     volumes:
  7.       - /data/storage:/app/storage

  8.   rails:
  9.     <<: *base
  10.     depends_on:
  11.       - postgres
  12.       - redis
  13.     ports:
  14.       - '127.0.0.1:3000:3000'
  15.     environment:
  16.       - NODE_ENV=production
  17.       - RAILS_ENV=production
  18.       - INSTALLATION_ENV=docker
  19.     entrypoint: docker/entrypoints/rails.sh
  20.     command: ['bundle', 'exec', 'rails', 's', '-p', '3000', '-b', '0.0.0.0']

  21.   sidekiq:
  22.     <<: *base
  23.     depends_on:
  24.       - postgres
  25.       - redis
  26.     environment:
  27.       - NODE_ENV=production
  28.       - RAILS_ENV=production
  29.       - INSTALLATION_ENV=docker
  30.     command: ['bundle', 'exec', 'sidekiq', '-C', 'config/sidekiq.yml']

  31.   postgres:
  32.     image: postgres:12
  33.     restart: always
  34.     ports:
  35.       - '127.0.0.1:5431:5432'
  36.     volumes:
  37.       - /data/postgres:/var/lib/postgresql/data
  38.     environment:
  39.       - POSTGRES_DB=chatwoot
  40.       - POSTGRES_USER=postgres
  41.       # Please provide your own password.
  42.       - POSTGRES_PASSWORD=bb4539bbef963874da80cedc0ecaca989

  43.   redis:
  44.     image: redis:alpine
  45.     restart: always
  46.     command: ["sh", "-c", "redis-server --requirepass "$REDIS_PASSWORD""]
  47.     env_file: .env
  48.     volumes:
  49.       - /data/redis:/data
  50.     ports:
  51.       - '127.0.0.1:6378:6379'
复制代码
发表于 2024-3-27 17:37:34 | 显示全部楼层
小萝卜 发表于 2024-3-27 17:12
关闭防火墙还是连不上

docker的规则被你清掉了,删除镜像重新启吧,参考28楼提供docker-compose试试,docker-compose中的有些端口要改一下,别和你宝塔启动的服务端口冲突了
 楼主| 发表于 2024-3-27 17:49:45 | 显示全部楼层
misakafa 发表于 2024-3-27 17:37
docker的规则被你清掉了,删除镜像重新启吧,参考28楼提供docker-compose试试,docker-compose中的有些端 ...

  1. [root@workserver chatwoot]# docker compose run --rm rails bundle exec rails db:chatwoot_prepare
  2. WARN[0000] /www/wwwroot/support.rose.com/chatwoot/docker-compose.yaml: `version` is obsolete
  3. [+] Creating 2/2
  4. ✔ Container chatwoot-redis-1     Created                                               2.5s
  5. ✔ Container chatwoot-postgres-1  Created                                               2.5s
  6. [+] Running 0/2
  7. ⠸ Container chatwoot-redis-1     Starting                                              4.3s
  8. ⠸ Container chatwoot-postgres-1  Starting                                              4.3s
  9. Error response from daemon: driver failed programming external connectivity on endpoint chatwoot-redis-1 (2ab104c1ba6c4af259ac6bab16adea28bd354c27006d252917b81b352ea19a62):  (iptables failed: iptables --wait -t nat -A DOCKER -p tcp -d 127.0.0.1 --dport 6378 -j DNAT --to-destination 172.24.0.2:6379 ! -i br-0442c7e2ad68: iptables: No chain/target/match by that name.
  10. (exit status 1))
  11. [root@workserver chatwoot]# docker compose run --rm rails bundle exec rails db:chatwoot_prepare
  12. WARN[0000] /www/wwwroot/support.rose.com/chatwoot/docker-compose.yaml: `version` is obsolete
  13. [+] Creating 2/2
  14. ✔ Container chatwoot-redis-1     Created                                               2.1s
  15. ✔ Container chatwoot-postgres-1  Created                                               2.1s
  16. [+] Running 2/2
  17. ✔ Container chatwoot-redis-1     Started                                               2.1s
  18. ✔ Container chatwoot-postgres-1  Started                                               2.1s
  19. [+] Running 12/12
  20. ✔ rails 11 layers [⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿]      0B/0B      Pulled                                43.9s
  21.    ✔ c926b61bad3b Pull complete                                                         0.4s
  22.    ✔ 0bfb8f508c71 Pull complete                                                         0.4s
  23.    ✔ e49674a1e21a Pull complete                                                         0.3s
  24.    ✔ a8d637e9f7e0 Pull complete                                                         1.6s
  25.    ✔ 80c3bd4e2c8c Pull complete                                                         1.0s
  26.    ✔ 71db01de2232 Pull complete                                                         4.4s
  27.    ✔ d81ce3c1e381 Pull complete                                                         1.3s
  28.    ✔ fb043248c8af Pull complete                                                         7.7s
  29.    ✔ 28c50097771b Pull complete                                                         4.9s
  30.    ✔ 6ac8f70d1ae3 Pull complete                                                         4.9s
  31.    ✔ 4f4fb700ef54 Pull complete                                                         5.2s
  32. + rm -rf /app/tmp/pids/server.pid
  33. + rm -rf '/app/tmp/cache/*'
  34. + echo 'Waiting for postgres to become ready....'
  35. Waiting for postgres to become ready....
  36. + docker/entrypoints/helpers/pg_database_url.rb
  37. + export 'POSTGRES_PORT=5432'
  38. + PG_READY='pg_isready -h postgres -p 5432 -U postgres'
  39. + pg_isready -h postgres -p 5432 -U postgres
  40. postgres:5432 - accepting connections
  41. + echo 'Database ready to accept connections.'
  42. Database ready to accept connections.
  43. + bundle install
  44. Bundle complete! 126 Gemfile dependencies, 247 gems now installed.
  45. Gems in the groups 'development' and 'test' were not installed.
  46. Bundled gems are installed into `/gems`
  47. + BUNDLE='bundle check'
  48. + bundle check
  49. The Gemfile's dependencies are satisfied
  50. + exec bundle exec rails db:chatwoot_prepare
  51. Created database 'chatwoot_production'
  52. rails aborted!
  53. Redis::CannotConnectError: Connection refused - connect(2) for 127.0.0.1:6378 (Redis::CannotConnectError)
  54. /app/lib/global_config.rb:24:in `block in clear_cache'
  55. /app/lib/global_config.rb:24:in `clear_cache'
  56. /app/db/seeds.rb:2:in `<main>'
  57. /app/lib/tasks/db_enhancements.rake:28:in `rescue in block (3 levels) in <main>'
  58. /app/lib/tasks/db_enhancements.rake:19:in `block (3 levels) in <main>'
  59. /app/lib/tasks/db_enhancements.rake:18:in `each'
  60. /app/lib/tasks/db_enhancements.rake:18:in `block (2 levels) in <main>'

  61. Caused by:
  62. RedisClient::CannotConnectError: Connection refused - connect(2) for 127.0.0.1:6378 (RedisClient::CannotConnectError)
  63. /app/lib/global_config.rb:24:in `block in clear_cache'
  64. /app/lib/global_config.rb:24:in `clear_cache'
  65. /app/db/seeds.rb:2:in `<main>'
  66. /app/lib/tasks/db_enhancements.rake:28:in `rescue in block (3 levels) in <main>'
  67. /app/lib/tasks/db_enhancements.rake:19:in `block (3 levels) in <main>'
  68. /app/lib/tasks/db_enhancements.rake:18:in `each'
  69. /app/lib/tasks/db_enhancements.rake:18:in `block (2 levels) in <main>'

  70. Caused by:
  71. Errno::ECONNREFUSED: Connection refused - connect(2) for 127.0.0.1:6378 (Errno::ECONNREFUSED)/app/lib/global_config.rb:24:in `block in clear_cache'
  72. /app/lib/global_config.rb:24:in `clear_cache'
  73. /app/db/seeds.rb:2:in `<main>'
  74. /app/lib/tasks/db_enhancements.rake:28:in `rescue in block (3 levels) in <main>'
  75. /app/lib/tasks/db_enhancements.rake:19:in `block (3 levels) in <main>'
  76. /app/lib/tasks/db_enhancements.rake:18:in `each'
  77. /app/lib/tasks/db_enhancements.rake:18:in `block (2 levels) in <main>'

  78. Caused by:
  79. ActiveRecord::NoDatabaseError: We could not find your database: chatwoot_production. Which can be found in the database configuration file located at config/database.yml. (ActiveRecord::NoDatabaseError)

  80. To resolve this issue:

  81. - Did you create the database for this app, or delete it? You may need to create your database.
  82. - Has the database name changed? Check your database.yml config has the correct database name.

  83. To create your database, run:

  84.         bin/rails db:create
  85. /app/lib/tasks/db_enhancements.rake:20:in `block (3 levels) in <main>'
  86. /app/lib/tasks/db_enhancements.rake:18:in `each'
  87. /app/lib/tasks/db_enhancements.rake:18:in `block (2 levels) in <main>'

  88. Caused by:
  89. PG::ConnectionBad: connection to server at "172.24.0.2", port 5432 failed: FATAL:  database "chatwoot_production" does not exist (PG::ConnectionBad)
  90. /app/lib/tasks/db_enhancements.rake:20:in `block (3 levels) in <main>'
  91. /app/lib/tasks/db_enhancements.rake:18:in `each'
  92. /app/lib/tasks/db_enhancements.rake:18:in `block (2 levels) in <main>'
  93. Tasks: TOP => db:setup => db:seed
  94. (See full trace by running task with --trace)
复制代码



用28楼的配置文件把pgsql改成跟.env一样后就这样
发表于 2024-3-27 18:59:50 | 显示全部楼层
小萝卜 发表于 2024-3-27 17:49
用28楼的配置文件把pgsql改成跟.env一样后就这样

搞好没
发表于 2024-3-27 19:02:29 来自手机 | 显示全部楼层
你在容器内要怎么连127.0.0.1,redis在宿主机就把参数换成docker网卡的网关,要是redis也在容器内塞进一个网络里不就好了
发表于 2024-3-27 19:04:21 | 显示全部楼层
本帖最后由 misakafa 于 2024-3-27 19:10 编辑
小萝卜 发表于 2024-3-27 17:49
用28楼的配置文件把pgsql改成跟.env一样后就这样


.env文件中REDIS_URL=redis://redis:6379 改成这个
docker-compose文件中这里改一下
  redis:
    image: redis:alpine
    restart: always
    command: ["sh", "-c", "redis-server --requirepass \"$REDIS_PASSWORD\""]
    env_file: .env
    volumes:
      - ./data/redis:/data
    ports:
      - 6378:6379
在重新启一下试试
 楼主| 发表于 2024-3-27 19:38:04 | 显示全部楼层
misakafa 发表于 2024-3-27 19:04
.env文件中REDIS_URL=redis://redis:6379 改成这个
docker-compose文件中这里改一下
  redis:
  1. [root@workserver chatwoot]# docker compose run --rm rails bundle exec rails db:chatwoot_prepare
  2. WARN[0000] /www/wwwroot/support.rosehacker.com/chatwoot/docker-compose.yaml: `version` is obsolete
  3. [+] Creating 2/2
  4. ✔ Container chatwoot-redis-1     Created                                               1.0s
  5. ✔ Container chatwoot-postgres-1  Created                                               1.0s
  6. [+] Running 2/2
  7. ✔ Container chatwoot-redis-1     Started                                               1.8s
  8. ✔ Container chatwoot-postgres-1  Started                                               1.9s
  9. [+] Running 12/12
  10. ✔ rails 11 layers [⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿]      0B/0B      Pulled                                43.6s
  11.    ✔ c926b61bad3b Pull complete                                                         0.4s
  12.    ✔ 0bfb8f508c71 Pull complete                                                         0.4s
  13.    ✔ e49674a1e21a Pull complete                                                         0.3s
  14.    ✔ a8d637e9f7e0 Pull complete                                                         1.1s
  15.    ✔ 80c3bd4e2c8c Pull complete                                                         0.8s
  16.    ✔ 71db01de2232 Pull complete                                                         5.4s
  17.    ✔ d81ce3c1e381 Pull complete                                                         1.2s
  18.    ✔ fb043248c8af Pull complete                                                         7.0s
  19.    ✔ 28c50097771b Pull complete                                                         5.1s
  20.    ✔ 6ac8f70d1ae3 Pull complete                                                         5.5s
  21.    ✔ 4f4fb700ef54 Pull complete                                                         5.7s
  22. + rm -rf /app/tmp/pids/server.pid
  23. + rm -rf '/app/tmp/cache/*'
  24. + echo 'Waiting for postgres to become ready....'
  25. Waiting for postgres to become ready....
  26. + docker/entrypoints/helpers/pg_database_url.rb
  27. + export 'POSTGRES_PORT=5432'
  28. + PG_READY='pg_isready -h postgres -p 5432 -U postgres'
  29. + pg_isready -h postgres -p 5432 -U postgres
  30. postgres:5432 - accepting connections
  31. + echo 'Database ready to accept connections.'
  32. Database ready to accept connections.
  33. + bundle install
  34. Bundle complete! 126 Gemfile dependencies, 247 gems now installed.
  35. Gems in the groups 'development' and 'test' were not installed.
  36. Bundled gems are installed into `/gems`
  37. + BUNDLE='bundle check'
  38. + bundle check
  39. The Gemfile's dependencies are satisfied
  40. + exec bundle exec rails db:chatwoot_prepare
  41. Loading Installation config
复制代码



现在按大佬说的改完,好像是完成了,但是访问起来还是502错误。


发表于 2024-3-27 20:10:32 | 显示全部楼层
小萝卜 发表于 2024-3-27 19:38
现在按大佬说的改完,好像是完成了,但是访问起来还是502错误。

自己看看是不是ngx配置错了
 楼主| 发表于 2024-3-27 22:46:49 | 显示全部楼层
misakafa 发表于 2024-3-27 20:10
自己看看是不是ngx配置错了

  1. #PROXY-START/

  2. location ^~ /
  3. {
  4.     proxy_pass http://127.0.0.1:3000;
  5.     proxy_set_header Host $host;
  6.     proxy_set_header X-Real-IP $remote_addr;
  7.     proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  8.     proxy_set_header REMOTE-HOST $remote_addr;
  9.     proxy_set_header Upgrade $http_upgrade;
  10.     proxy_set_header Connection $connection_upgrade;
  11.     proxy_http_version 1.1;
  12.     # proxy_hide_header Upgrade;

  13.     add_header X-Cache $upstream_cache_status;

  14.     #Set Nginx Cache
  15.    
  16.    
  17.     set $static_filexRm0w58E 0;
  18.     if ( $uri ~* "\.(gif|png|jpg|css|js|woff|woff2)$" )
  19.     {
  20.             set $static_filexRm0w58E 1;
  21.             expires 1m;
  22.         }
  23.     if ( $static_filexRm0w58E = 0 )
  24.     {
  25.     add_header Cache-Control no-cache;
  26.     }
  27. }

  28. #PROXY-END/
复制代码


刚刚出门了下,我感觉没有配错呢。
 楼主| 发表于 2024-3-27 22:52:19 | 显示全部楼层
misakafa 发表于 2024-3-27 20:10
自己看看是不是ngx配置错了

大佬方便加个联系方式不,虽然还没成功,但我感觉应该快成功了,发个小红包请你喝个奶茶。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|全球主机交流论坛

GMT+8, 2024-5-29 05:48 , Processed in 0.062925 second(s), 7 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表