Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Register
  • Sign in
  • funkwhale funkwhale
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
    • Locked files
  • Issues 408
    • Issues 408
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
    • Requirements
  • Merge requests 16
    • Merge requests 16
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Artifacts
    • Schedules
    • Test cases
  • Deployments
    • Deployments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Container Registry
    • Terraform modules
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • funkwhalefunkwhale
  • funkwhalefunkwhale
  • Issues
  • #1071
Closed
Open
Issue created Apr 11, 2020 by Charlie Woolf@ccwoolf

Docker Compose multi-container instructions don't include first-time database setup information

/label Type: Bug Status: Need triage

Steps to reproduce

  1. Browse to https://docs.funkwhale.audio/installation/docker.html#multi-container-installation
  2. Follow multi-container setup instructions up to and including docker-compose pull
  3. Run initial database migrations (docker-compose up -d postgres; docker-compose run --rm api python manage.py migrate)

What happens?

  1. Postgres container fails to come up and enters restart loop with the following logs:

    postgres_1      | Error: Database is uninitialized and superuser password is not specified.
    postgres_1      |        You must specify POSTGRES_PASSWORD to a non-empty value for the
    postgres_1      |        superuser. For example, "-e POSTGRES_PASSWORD=password" on "docker run".
    postgres_1      |
    postgres_1      |        You may also use "POSTGRES_HOST_AUTH_METHOD=trust" to allow all
    postgres_1      |        connections without a password. This is *not* recommended.
    postgres_1      |
  2. Migrations fail to run with the following logs:

    Starting funkwhale_postgres_1 ... done
    Starting funkwhale_redis_1    ... done
    2020-04-09 22:51:29,055 funkwhale_api.config INFO     Running with no plugins
    :0: UserWarning: You do not have a working installation of the service_identity module: 'No module named 'service_identity''.  Please install it from <https://pypi.python.org/pypi/service_identity> and make sure all of its dependencies are satisfied.  Without the service_identity module, Twisted can perform only rudimentary TLS client hostname verification.  Many valid certificate/hostname mappings may be rejected.
    Traceback (most recent call last):
      File "/usr/lib/python3.6/site-packages/django/db/backends/base/base.py", line 217, in ensure_connection
        self.connect()
      File "/usr/lib/python3.6/site-packages/django/db/backends/base/base.py", line 195, in connect
        self.connection = self.get_new_connection(conn_params)
      File "/usr/lib/python3.6/site-packages/django/db/backends/postgresql/base.py", line 178, in get_new_connection
        connection = Database.connect(**conn_params)
      File "/usr/lib/python3.6/site-packages/psycopg2/__init__.py", line 126, in connect
        conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
    psycopg2.OperationalError: could not translate host name "postgres" to address: Name does not resolve
    
    
    The above exception was the direct cause of the following exception:
    
    Traceback (most recent call last):
      File "manage.py", line 20, in <module>
        execute_from_command_line(sys.argv)
      File "/usr/lib/python3.6/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
        utility.execute()
      File "/usr/lib/python3.6/site-packages/django/core/management/__init__.py", line 375, in execute
        self.fetch_command(subcommand).run_from_argv(self.argv)
      File "/usr/lib/python3.6/site-packages/django/core/management/base.py", line 323, in run_from_argv
        self.execute(*args, **cmd_options)
      File "/usr/lib/python3.6/site-packages/django/core/management/base.py", line 364, in execute
        output = self.handle(*args, **options)
      File "/usr/lib/python3.6/site-packages/django/core/management/base.py", line 83, in wrapped
        res = handle_func(*args, **kwargs)
      File "/usr/lib/python3.6/site-packages/django/core/management/commands/migrate.py", line 87, in handle
        executor = MigrationExecutor(connection, self.migration_progress_callback)
      File "/usr/lib/python3.6/site-packages/django/db/migrations/executor.py", line 18, in __init__
        self.loader = MigrationLoader(self.connection)
      File "/usr/lib/python3.6/site-packages/django/db/migrations/loader.py", line 49, in __init__
        self.build_graph()
      File "/usr/lib/python3.6/site-packages/django/db/migrations/loader.py", line 212, in build_graph
        self.applied_migrations = recorder.applied_migrations()
      File "/usr/lib/python3.6/site-packages/django/db/migrations/recorder.py", line 73, in applied_migrations
        if self.has_table():
      File "/usr/lib/python3.6/site-packages/django/db/migrations/recorder.py", line 56, in has_table
        return self.Migration._meta.db_table in self.connection.introspection.table_names(self.connection.cursor())
      File "/usr/lib/python3.6/site-packages/django/db/backends/base/base.py", line 256, in cursor
        return self._cursor()
      File "/usr/lib/python3.6/site-packages/django/db/backends/base/base.py", line 233, in _cursor
        self.ensure_connection()
      File "/usr/lib/python3.6/site-packages/django/db/backends/base/base.py", line 217, in ensure_connection
        self.connect()
      File "/usr/lib/python3.6/site-packages/django/db/utils.py", line 89, in __exit__
        raise dj_exc_value.with_traceback(traceback) from exc_value
      File "/usr/lib/python3.6/site-packages/django/db/backends/base/base.py", line 217, in ensure_connection
        self.connect()
      File "/usr/lib/python3.6/site-packages/django/db/backends/base/base.py", line 195, in connect
        self.connection = self.get_new_connection(conn_params)
      File "/usr/lib/python3.6/site-packages/django/db/backends/postgresql/base.py", line 178, in get_new_connection
        connection = Database.connect(**conn_params)
      File "/usr/lib/python3.6/site-packages/psycopg2/__init__.py", line 126, in connect
        conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
    django.db.utils.OperationalError: could not translate host name "postgres" to address: Name does not resolve

What is expected?

Database migrations run and user is ready to continue following the installation guide

Context

django.db.utils.OperationalError: could not translate host name "postgres" to address: Name does not resolve is a symptom of the Postgres container restart loop: if the container is in the process of restarting, the Docker network will not resolve the container hostname, manifesting in what appears to be a name resolution error.

To resolve the issue, the user also needs to do the following:

  1. In .env, a new key POSTGRES_PASSWORD needs to be added and set with a value.
  2. In .env again, DATABASE_URL needs to be set to postgresql://postgres:<paste POSTGRES_PASSWORD here>@postgres:5432/postgres. You need to paste the password in due to .env files not supporting any string interpolation.

This resolves the issue by setting the database password and a correct DATABASE_URL value, allowing the user to move onto the next step.

Funkwhale version(s) affected: 0.20.1

  • OS: Arch Linux (up-to-date as of 2020-04-10)
  • docker --version: Docker version 19.03.8-ce, build afacb8b7f0
  • docker-compose --version: docker-compose version 1.25.4, build unknown
Assignee
Assign to
Time tracking