setup.mailu.io 生成的master版本docker-compose.yml和mailu.env 使用postgresql和mysql 数据库时roundcube会启动不了,见 https://github.com/Mailu/Mailu/issues/1471

所以自己修改镜像来让Roundcube 也用上postgresql

下载mailu源码,进入webmails/roundcube目录,修改start.py 25-28行

os.environ.get("ROUNDCUBE_DB_USER","roundcube"),
os.environ.get("ROUNDCUBE_DB_PW"),
os.environ.get("ROUNDCUBE_DB_HOST",os.environ.get("DB_HOST","database")),
os.environ.get("ROUNDCUBE_DB_NAME","roundcube")

修改下面的,maildb为docker-compose.yml中为Roundcube准备的容器host

os.environ.get("ROUNDCUBE_DB_USER","roundcube"),
os.environ.get("ROUNDCUBE_DB_PW","roundcube"),
os.environ.get("ROUNDCUBE_DB_HOST","maildb"),
os.environ.get("ROUNDCUBE_DB_NAME","roundcube")

docker build -t roundcube . # 编译修改过的镜像

修改docker-compose.yml的webmail 镜像为roundcube

docker-compose.yml中添加

  maildb:
    restart: always
    image: postgres:12-alpine
    healthcheck:
      test: ["CMD", "pg_isready", "-U", "postgres"]
    environment:
      - POSTGRES_PASSWORD=roundcube
      - POSTGRES_USER=roundcube
      - POSTGRES_DB=roundcube
    volumes:
      - ./data/webmaildb:/var/lib/postgresql/data

然后就可以愉快的使用postgresql了

标签: mailu.io