Skip to content

[BUG] Traceback from DB migration step on Unraid container startup #554

Description

@thekiefs

Describe the bug
Really want to love MM but running into some serious startup pains with DB setup. Running MM from App installed directly on Unraid docker.

To Reproduce

  1. Install MediaManager from Unraid apps repo
  2. Install Postgres18 from Unraid apps repo
  3. Setup both

Expected behavior

  1. Start docker container
  2. Container successfully starts or gives a clear error why startup failed

Server Logs

Buy me a coffee at https://buymeacoffee.com/maxdorninger
Checking configuration setup...
Config file found at: /app/config/config.toml
Running as root. Ensuring file permissions for mediamanager user...
/data ownership is already correct.
Running DB migrations...
Traceback (most recent call last):
  File "/app/.venv/bin/alembic", line 10, in <module>
    sys.exit(main())
             ~~~~^^
  File "/app/.venv/lib/python3.13/site-packages/alembic/config.py", line 1033, in main
    CommandLine(prog=prog).main(argv=argv)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^
  File "/app/.venv/lib/python3.13/site-packages/alembic/config.py", line 1023, in main
    self.run_cmd(cfg, options)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.13/site-packages/alembic/config.py", line 957, in run_cmd
    fn(
    ~~^
        config,
        ^^^^^^^
        *[getattr(options, k, None) for k in positional],
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        **{k: getattr(options, k, None) for k in kwarg},
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/app/.venv/lib/python3.13/site-packages/alembic/command.py", line 483, in upgrade
    script.run_env()
    ~~~~~~~~~~~~~~^^
  File "/app/.venv/lib/python3.13/site-packages/alembic/script/base.py", line 545, in run_env
    util.load_python_file(self.dir, "env.py")
    ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.13/site-packages/alembic/util/pyfiles.py", line 116, in load_python_file
    module = load_module_py(module_id, path)
  File "/app/.venv/lib/python3.13/site-packages/alembic/util/pyfiles.py", line 136, in load_module_py
    spec.loader.exec_module(module)  # type: ignore
    ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
  File "<frozen importlib._bootstrap_external>", line 1023, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/app/alembic/env.py", line 140, in <module>
    run_migrations_online()
    ~~~~~~~~~~~~~~~~~~~~~^^
  File "/app/alembic/env.py", line 120, in run_migrations_online
    connectable = engine_from_config(
        config.get_section(config.config_ini_section, {}),
        prefix="sqlalchemy.",
        poolclass=pool.NullPool,
    )
  File "/app/.venv/lib/python3.13/site-packages/sqlalchemy/engine/create.py", line 838, in engine_from_config
    return create_engine(url, **options)
  File "<string>", line 2, in create_engine
  File "/app/.venv/lib/python3.13/site-packages/sqlalchemy/util/deprecations.py", line 281, in warned
    return fn(*args, **kwargs)  # type: ignore[no-any-return]
  File "/app/.venv/lib/python3.13/site-packages/sqlalchemy/engine/create.py", line 564, in create_engine
    u = _url.make_url(url)
  File "/app/.venv/lib/python3.13/site-packages/sqlalchemy/engine/url.py", line 856, in make_url
    return _parse_url(name_or_url)
  File "/app/.venv/lib/python3.13/site-packages/sqlalchemy/engine/url.py", line 919, in _parse_url
    return URL.create(name, **components)  # type: ignore
           ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.13/site-packages/sqlalchemy/engine/url.py", line 213, in create
    cls._assert_port(port),
    ~~~~~~~~~~~~~~~~^^^^^^
  File "/app/.venv/lib/python3.13/site-packages/sqlalchemy/engine/url.py", line 223, in _assert_port
    return int(port)
ValueError: invalid literal for int() with base 10: ''

Version
How do I find this if I can't successfully start MM?

Additional context
I installed

docker-compose.yaml
I'm running this on Unraid Community template which maps to this run command:

docker run
  -d
  --name='MediaManager'
  --net='bridge'
  --pids-limit 2048
  -e TZ="America/Los_Angeles"
  -e HOST_OS="Unraid"
  -e HOST_HOSTNAME="Host"
  -e HOST_CONTAINERNAME="MediaManager"
  -e 'CONFIG_DIR'='/app/config'
  -l net.unraid.docker.managed=dockerman
  -l net.unraid.docker.webui='http://[IP]:[PORT:8000]/'
  -l net.unraid.docker.icon='https://raw.githubusercontent.com/maxdorninger/MediaManager/refs/heads/master/Writerside/images/logo.svg'
  -p '8000:8000/tcp'
  -v '/mnt/user/data/':'/data':'rw'
  -v '/mnt/user/appdata/media_manager/data/images':'/data/images':'rw'
  -v '/mnt/user/appdata/media_manager/config/':'/app/config':'rw' 'ghcr.io/maxdorninger/mediamanager/mediamanager:latest'
1789ccbec06d438b410d54b17be7cfc8b187dcd50b8ce9dcfd7c4cd169e5765a

The command finished successfully!

config.toml

# MediaManager Example Configuration File
# This file contains all available configuration options for MediaManager
# Documentation: https://maxdorninger.github.io/MediaManager/
#
# This is an example configuration file that gets copied to your config folder
# on first boot. You should modify the values below to match your setup.

[misc]
frontend_url = "http://192.168.1.10:8000" # note the lack of a trailing slash
cors_urls = ["http://192.168.1.10:8000"] # note the lack of a trailing slash

image_directory = "/data/images"
tv_directory = "/data/media/shows"
movie_directory = "/data/media/movies"
torrent_directory = "/data/downloads/torrents" # this is where MediaManager will search for the downloaded torrents and usenet files

# you probaly don't need to change this
development = false

# Custom Media Libraries
# These paths should match your volume mounts in docker-compose.yaml
# Example: if you mount "./movies:/media/movies" then use path = "/media/movies/subdirectory"

[database]
host = "http://192.168.1.10"
port = 5432
user = "MediaManager"
password = "test"
dbname = "MediaManager"

[auth]
email_password_resets = false # if true, you also need to set up SMTP (notifications.smtp_config)
token_secret = "CHANGE_ME_GENERATE_RANDOM_STRING" # generate a random string with "openssl rand -hex 32", e.g. here https://www.cryptool.org/en/cto/openssl/
session_lifetime = 86400  # this is how long you will be logged in after loggin in, in seconds

# Admin users: Users who register with these email addresses will automatically become administrators
# If no users exist in the database, a default admin user will be created with the first email in this list
admin_emails = ["admin@example.com", "admin2@example.com"]

# OpenID Connect settings
[auth.openid_connect]
enabled = false
client_id = ""
client_secret = ""
configuration_endpoint = "https://openid.example.com/.well-known/openid-configuration"
name = "OpenID"

[torrents]
[torrents.transmission]
enabled = true
username = "test"
password = "test"
https_enabled = true
host = "localhost"
port = 9091
path = "/transmission/rpc" # RPC request path target, usually "/transmission/rpc"

[indexers]
# Prowlarr settings
[indexers.prowlarr]
enabled = true
url = "http://192.168.1.10:9696"
api_key = "X"
timeout_seconds = 60

# its very unlikely that you need to change this
[metadata]
[metadata.tmdb]
tmdb_relay_url = "https://metadata-relay.dorninger.co/tmdb"
primary_languages = [""]
default_language = "en"

[metadata.tvdb]
tvdb_relay_url = "https://metadata-relay.dorninger.co/tvdb"
  • I understand, that without logs and/or screenshots and a detailed description of the problem, it is very hard to fix bugs.
  • I have checked the documentation for help.
  • I have searched the issues for similar issues and found none.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions