首页 > 解决方案 > Docker,chatwoot TypeError:预期的 str、字节或 os.PathLike 对象,而不是 NoneType

问题描述

我正在尝试使用他们的指南在 docker 上安装 chatwoot:https ://www.chatwoot.com/docs/deployment/deploy-chatwoot-with-docker

我编辑了 .env 和 docker-composer.yaml

.env 文件

# Used to verify the integrity of signed cookies. so ensure a secure value is set
SECRET_KEY_BASE=*****Secret

# Replace with the URL you are planning to use for your app
FRONTEND_URL=http://localhost:3000

# If the variable is set, all non-authenticated pages would fallback to the default locale.
# Whenever a new account is created, the default language will be DEFAULT_LOCALE instead of en
# DEFAULT_LOCALE=en

# If you plan to use CDN for your assets, set Asset CDN Host
#ASSET_CDN_HOST=

# Force all access to the app over SSL, default is set to false
FORCE_SSL=false

# This lets you control new sign ups on your chatwoot installation
# true : default option, allows sign ups
# false : disables all the end points related to sign ups
# api_only: disables the UI for signup, but you can create sign ups via the account apis
ENABLE_ACCOUNT_SIGNUP=false

# Redis config
REDIS_URL=redis://redis:6379
REDIS_PASSWORD=****password


# Postgres Database config variables
POSTGRES_HOST=chatwoot
POSTGRES_USERNAME=postgres
POSTGRES_PASSWORD=***password
RAILS_ENV=production
RAILS_MAX_THREADS=5

# The email from which all outgoing emails are sent
MAILER_SENDER_EMAIL=BrandName <email@yourdomain.com>


#SMTP domain key is set up for HELO checking
SMTP_DOMAIN=***.com
SMTP_ADDRESS=smtp.sendgrid.net
SMTP_PORT=587
SMTP_USERNAME=chatwoot
SMTP_PASSWORD=****key
SMTP_AUTHENTICATION=plain
SMTP_ENABLE_STARTTLS_AUTO=true
SMTP_OPENSSL_VERIFY_MODE=peer

# Mail Incoming
# This is the domain set for the reply emails when conversation continuity is enabled
MAILER_INBOUND_EMAIL_DOMAIN=yourdomain.com
# Set this to appropriate ingress channel with regards to incoming emails
# Possible values are :
# relay for Exim, Postfix, Qmail
# mailgun for Mailgun
# mandrill for Mandrill
# postmark for Postmark
# sendgrid for Sendgrid
RAILS_INBOUND_EMAIL_SERVICE=sendgrid
# Use one of the following based on the email ingress service
#RAILS_INBOUND_EMAIL_PASSWORD=
#MAILGUN_INGRESS_SIGNING_KEY=
#MANDRILL_INGRESS_API_KEY=

# Storage
ACTIVE_STORAGE_SERVICE=local

# Amazon S3
S3_BUCKET_NAME=s3-chatwoot
AWS_ACCESS_KEY_ID=****id
AWS_SECRET_ACCESS_KEY=****key
AWS_REGION=***region

# Sentry
#SENTRY_DSN=

# Log settings
# Disable if you want to write logs to a file
RAILS_LOG_TO_STDOUT=true
LOG_LEVEL=info
LOG_SIZE2048

### This environment variables are only required if you are setting up social media channels

# Facebook
#FB_VERIFY_TOKEN=
#FB_APP_SECRET=
#FB_APP_ID=

# Twitter
#TWITTER_APP_ID=
#TWITTER_CONSUMER_KEY=
#TWITTER_CONSUMER_SECRET=
#TWITTER_ENVIRONMENT=

#slack integration
#SLACK_CLIENT_ID=
#SLACK_CLIENT_SECRET=

### Change this env variable only if you are using a custom build mobile app
## Mobile app env variables
IOS_APP_ID=6C953F3RX2.com.chatwoot.app


#IOS_APP_IDENTIFIER=1495796682

## Push Notification
VAPID_PUBLIC_KEY=**key
VAPID_PRIVATE_KEY=***key
#
# for mobile apps
# FCM_SERVER_KEY=

## Bot Customizations
USE_INBOX_AVATAR_FOR_BOT=true



## IP look up configuration
## works only on accounts with ip look up feature enabled
# IP_LOOKUP_SERVICE=geoip2
# maxmindb api key to use geoip2 service
# IP_LOOKUP_API_KEY=

## Development Only Config
# if you want to use letter_opener for local emails
# LETTER_OPENER=true

docker-compose.yaml

version: '3'

services:
  base: &base
    image: chatwoot/chatwoot:latest
    env_file: .env ## Change this file for customized env variables

  rails:
    <<: *base
    depends_on:
      - postgres
      - redis
    ports:
      - 3000:3000
    environment:
      - NODE_ENV=production
      - RAILS_ENV=production
    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
    command: ['bundle', 'exec', 'sidekiq', '-C', 'config/sidekiq.yml']

  postgres:
    image: postgres:12
    restart: always
    ports:
      - '5432:5432'
    volumes:
      - /data/postgres:/var/lib/postgresql/data
    environment:
      - POSTGRES_DB=chatwoot
      - POSTGRES_USER=postgres
      # Please provide your own password.
      - POSTGRES_PASSWORD=***key

  redis:
    image: redis:alpine
    restart: always
    volumes:
      - /data/redis:/data
    ports:
      - '6379:6379'

当我运行时: docker-compose run --rm rails bundle exec rails db:chatwoot_prepare

我有这个错误:

filename = fspath(filename)  # Does type-checking of `filename`.
TypeError: expected str, bytes or os.PathLike object, not NoneType

服务器日志

Starting ubuntu_redis_1    ... done
Starting ubuntu_postgres_1 ... done
Traceback (most recent call last):
  File "/usr/bin/docker-compose", line 11, in <module>
    load_entry_point('docker-compose==1.25.0', 'console_scripts', 'docker-compose')()
  File "/usr/lib/python3/dist-packages/compose/cli/main.py", line 72, in main
    command()
  File "/usr/lib/python3/dist-packages/compose/cli/main.py", line 128, in perform_command
    handler(command, command_options)
  File "/usr/lib/python3/dist-packages/compose/cli/main.py", line 896, in run
    run_one_off_container(
  File "/usr/lib/python3/dist-packages/compose/cli/main.py", line 1376, in run_one_off_container
    exit_code = call_docker(
  File "/usr/lib/python3/dist-packages/compose/cli/main.py", line 1498, in call_docker
    return subprocess.call(args, env=environment)
  File "/usr/lib/python3.8/subprocess.py", line 340, in call
    with Popen(*popenargs, **kwargs) as p:
  File "/usr/lib/python3.8/subprocess.py", line 854, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib/python3.8/subprocess.py", line 1624, in _execute_child
    env_list.append(k + b'=' + os.fsencode(v))
  File "/usr/lib/python3.8/os.py", line 806, in fsencode
    filename = fspath(filename)  # Does type-checking of `filename`.
TypeError: expected str, bytes or os.PathLike object, not NoneType

有人可以帮忙吗?

标签: pythonruby-on-railsdockerredisdocker-compose

解决方案


推荐阅读