docker-mailman icon indicating copy to clipboard operation
docker-mailman copied to clipboard

Unable to start docker compose project - error thrown

Open duendwang opened this issue 9 months ago • 6 comments

Hi, I've tried searching but the issues I found were supposed resolved in an older version or very old.

I've modified the docker compose file to use relative paths inside the compose folder instead of /opt, added labels for traefik, and changed the version of core and web to 0.5.2, still pulling images from docker hub. I'm unable to start the containers. core throws the following error repeatedly:

mailman-core-1  | Traceback (most recent call last):
mailman-core-1  |   File "/usr/bin/mailman", line 8, in <module>
mailman-core-1  |     sys.exit(main())
mailman-core-1  |              ^^^^^^
mailman-core-1  |   File "/usr/lib/python3.12/site-packages/click/core.py", line 1157, in __call__
mailman-core-1  |     return self.main(*args, **kwargs)
mailman-core-1  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^
mailman-core-1  |   File "/usr/lib/python3.12/site-packages/click/core.py", line 1077, in main
mailman-core-1  |     with self.make_context(prog_name, args, **extra) as ctx:
mailman-core-1  |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
mailman-core-1  |   File "/usr/lib/python3.12/site-packages/click/core.py", line 943, in make_context
mailman-core-1  |     self.parse_args(ctx, args)
mailman-core-1  |   File "/usr/lib/python3.12/site-packages/click/core.py", line 1644, in parse_args
mailman-core-1  |     rest = super().parse_args(ctx, args)
mailman-core-1  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
mailman-core-1  |   File "/usr/lib/python3.12/site-packages/click/core.py", line 1408, in parse_args
mailman-core-1  |     value, args = param.handle_parse_result(ctx, opts, args)
mailman-core-1  |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
mailman-core-1  |   File "/usr/lib/python3.12/site-packages/click/core.py", line 2400, in handle_parse_result
mailman-core-1  |     value = self.process_value(ctx, value)
mailman-core-1  |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
mailman-core-1  |   File "/usr/lib/python3.12/site-packages/click/core.py", line 2362, in process_value
mailman-core-1  |     value = self.callback(ctx, self, value)
mailman-core-1  |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
mailman-core-1  |   File "/usr/lib/python3.12/site-packages/mailman/bin/mailman.py", line 95, in initialize_config
mailman-core-1  |     initialize(value)
mailman-core-1  |   File "/usr/lib/python3.12/site-packages/mailman/core/initialize.py", line 229, in initialize
mailman-core-1  |     initialize_2(propagate_logs=propagate_logs)
mailman-core-1  |   File "/usr/lib/python3.12/site-packages/mailman/core/initialize.py", line 187, in initialize_2
mailman-core-1  |     config.db = getUtility(IDatabaseFactory, utility_name).create()
mailman-core-1  |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
mailman-core-1  |   File "/usr/lib/python3.12/site-packages/mailman/database/factory.py", line 57, in create
mailman-core-1  |     database.initialize()
mailman-core-1  |   File "/usr/lib/python3.12/site-packages/mailman/database/base.py", line 117, in initialize
mailman-core-1  |     self.engine = create_engine(
mailman-core-1  |                   ^^^^^^^^^^^^^^
mailman-core-1  |   File "<string>", line 2, in create_engine
mailman-core-1  |   File "/usr/lib/python3.12/site-packages/sqlalchemy/util/deprecations.py", line 281, in warned
mailman-core-1  |     return fn(*args, **kwargs)  # type: ignore[no-any-return]
mailman-core-1  |            ^^^^^^^^^^^^^^^^^^^
mailman-core-1  |   File "/usr/lib/python3.12/site-packages/sqlalchemy/engine/create.py", line 550, in create_engine
mailman-core-1  |     entrypoint = u._get_entrypoint()
mailman-core-1  |                  ^^^^^^^^^^^^^^^^^^^
mailman-core-1  |   File "/usr/lib/python3.12/site-packages/sqlalchemy/engine/url.py", line 758, in _get_entrypoint
mailman-core-1  |     cls = registry.load(name)
mailman-core-1  |           ^^^^^^^^^^^^^^^^^^^
mailman-core-1  |   File "/usr/lib/python3.12/site-packages/sqlalchemy/util/langhelpers.py", line 375, in load
mailman-core-1  |     raise exc.NoSuchModuleError(
mailman-core-1  | sqlalchemy.exc.NoSuchModuleError: Can't load plugin: sqlalchemy.dialects:postgres

TIA. It's truncated, so let me know if you need to see more. Thanks.

duendwang avatar Apr 05 '25 16:04 duendwang

My compose file:

services:
  mailman-core:
    image: maxking/mailman-core:0.5.2 # Use a specific version tag (tag latest is not published)
#    container_name: mailman-core
#    hostname: mailman-core
    restart: unless-stopped
    volumes:
      - ./data/core:/opt/mailman/
    stop_grace_period: 30s
    depends_on:
      database:
        condition: service_healthy
    environment:
      - DATABASE_URL=postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@database/${POSTGRES_DB}
      - DATABASE_TYPE=postgres
      - DATABASE_CLASS=mailman.database.postgresql.PostgreSQLDatabase
      - HYPERKITTY_API_KEY=${HYPERKITTY_API_KEY:?missing HYPERKITTY_API_KEY}
      - MTA=${MTA:-exim}
      - SMTP_HOST=${SMTP_HOST}
      - SMTP_PORT=${SMTP_PORT:-25}
      - SMTP_SECURE_MODE=${SMTP_SECURE_MODE:-smtp}
      - SMTP_VERIFY_HOSTNAME=${SMTP_VERIFY_HOSTNAME}
      - SMTP_VERIFY_CERT=${SMTP_VERIFY_CERT}
    expose:
      - 8001 #API
    ports:
#      - "127.0.0.1:8001:8001" # API
      - "127.0.0.1:8024:8024" # LMTP - incoming emails
    networks:
      - mailman

  mailman-web:
    image: maxking/mailman-web:0.5.2 # Use a specific version tag (tag latest is not published)
#    container_name: mailman-web
#    hostname: mailman-web
    restart: unless-stopped
    depends_on:
      database:
        condition: service_healthy
#    links:
#      - mailman-core:mailman-core
#      - database:database
    volumes:
      - ./data/web:/opt/mailman-web-data
    environment:
      - DATABASE_TYPE=postgres
      - DATABASE_URL=postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@database/${POSTGRES_DB}
      - DATABASE_CLASS=mailman.database.postgresql.PostgreSQLDatabase
      - SECRET_KEY=${SECRET_KEY:?missing SECRET_KEY}
      - UWSGI_STATIC_MAP=/static=/opt/mailman-web-data/static
      - SERVE_FROM_DOMAIN=${DOMAIN:?missing DOMAIN}
      - HYPERKITTY_API_KEY=${HYPERKITTY_API_KEY:?missing HYPERKITTY_API_KEY}
      - MAILMAN_ADMIN_USER=${MAILMAN_ADMIN_USER:?missing MAILMAN_ADMIN_USER}
      - MAILMAN_ADMIN_EMAIL=${MAILMAN_ADMIN_EMAIL:?mising MAILMAN_ADMIN_EMAIL}
      - SMTP_HOST=${SMTP_HOST}
      - SMTP_PORT=${SMTP_PORT:-25}
      - SMTP_HOST_USER=${SMTP_HOST_USER:?missing SMTP_HOST_USER}
      - SMTP_HOST_PASSWORD=${SMTP_HOST_PASSWORD:?missing SMTP_HOST_PASSWORD}
      - SMTP_USE_TLS=${SMTP_USE_TLS}
      - SMTP_USE_SSL=${SMTP_USE_SSL}
      - DJANGO_LOG_URL${DJANGO_LOG_URL:-/opt/mailman-web-data/logs/mailmanweb.log}
      - DJANGO_ALLOWED_HOSTS=${DOMAIN}
      - POSTORIUS_TEMPLATE_BASE_URL=${POSTORIUS_TEMPLATE_BASE_URL:-http://mailman-web:8000}
      - DISKCACHE_PATH=${DISKCACHE_PATH:-/opt/mailman-web-data/diskcache}
      - DISKCACHE_SIZE=${DISKCACHE_SIZE:-1G}
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.mailman.entrypoints=websecure"
      - "traefik.http.routers.mailman.rule=Host(`$DOMAIN`)"
      - "traefik.http.routers.mailman.tls.certresolver=http-challenge"
      - "traefik.http.services.mailman.loadbalancer.server.port=8080"
    expose:
      - 8000 #HTTP
      - 8080 #uwsgi
#    ports:
#      - "127.0.0.1:8000:8000" # HTTP
#      - "127.0.0.1:8080:8080" # uwsgi
    networks:
      - mailman
      - traefik-proxy

  database:
    environment:
      POSTGRES_DB: ${POSTGRES_DB:-mailman}
      POSTGRES_USER: ${POSTGRES_USER:-mailman}
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?missing POSTGRES_PASSWORD}
    restart: always
    image: postgres:12-alpine
    healthcheck:
      test: ["CMD-SHELL", "pg_isready --dbname ${POSTGRES_DB:-mailman} --username ${POSTGRES_USER:-mailman}"]
      interval: 10s
      timeout: 5s
      retries: 5
    volumes:
    - ./data/database:/var/lib/postgresql/data
    networks:
      - mailman

networks:
  mailman:
  traefik-proxy:
    external: true

duendwang avatar Apr 05 '25 16:04 duendwang

Can someone help with the above? Is this a bug? Do I need to build the images myself locally?

Also why do all the documentation say that /opt/mailman on the host machine must be used? Why can't a relative path in the compose folder be used?

duendwang avatar Apr 10 '25 02:04 duendwang

Try replacing postgres everywhere in compose like in DATABASE_URL=postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@database/${POSTGRES_DB} with postgresql.

maxking avatar Apr 18 '25 02:04 maxking

Also why do all the documentation say that /opt/mailman on the host machine must be used? Why can't a relative path in the compose folder be used?

No good reasons, you can pick your directory if you want. It is just a stable path that makes it easy to debug issues when reported here.

maxking avatar Apr 18 '25 02:04 maxking

Try replacing postgres everywhere in compose like in DATABASE_URL=postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@database/${POSTGRES_DB} with postgresql.

Thank you. That got past all those errors. Now I'm getting

mailman-web-1   | CommandError: An error occurred during rendering /usr/lib/python3.8/site-packages/hyperkitty/templates/hyperkitty/thread_list.html: unsupported operand type(s) for /: 'str' and 'int'```

duendwang avatar Apr 19 '25 20:04 duendwang

Sorry. I'm still having issues with the latest error code if someone is able to help. I tried googling and there's some code-based solution, so I don't know if I need to make the code change or not. Presumably I shouldn't need to since this is a dockerhub release of a presumably working image.

duendwang avatar Jun 18 '25 21:06 duendwang