PowerDNS-Admin / PowerDNS-Admin

A PowerDNS web interface with advanced features
MIT License
2.47k stars 645 forks source link

BUG (Docker) New installation fails with clean mariadb database #795

Closed Syntax3rror404 closed 2 years ago

Syntax3rror404 commented 4 years ago

Hello,

i have a problem with a new PDA installation. I have a clean database and PDA fills that with the schema.

Thats the error code from the pda container log:

Traceback (most recent call last):
  File "/usr/bin/flask", line 8, in <module>
    sys.exit(main())
  File "/usr/lib/python3.8/site-packages/flask/cli.py", line 966, in main
    cli.main(prog_name="python -m flask" if as_module else None)
  File "/usr/lib/python3.8/site-packages/flask/cli.py", line 586, in main
    return super(FlaskGroup, self).main(*args, **kwargs)
  File "/usr/lib/python3.8/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3.8/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3.8/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python3.8/site-packages/click/decorators.py", line 21, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/usr/lib/python3.8/site-packages/flask/cli.py", line 426, in decorator
    return __ctx.invoke(f, *args, **kwargs)
  File "/usr/lib/python3.8/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python3.8/site-packages/flask_migrate/cli.py", line 134, in upgrade
    _upgrade(directory, revision, sql, tag, x_arg)
  File "/usr/lib/python3.8/site-packages/flask_migrate/__init__.py", line 95, in wrapped
    f(*args, **kwargs)
  File "/usr/lib/python3.8/site-packages/flask_migrate/__init__.py", line 280, in upgrade
    command.upgrade(config, revision, sql=sql, tag=tag)
  File "/usr/lib/python3.8/site-packages/alembic/command.py", line 298, in upgrade
    script.run_env()
  File "/usr/lib/python3.8/site-packages/alembic/script/base.py", line 489, in run_env
    util.load_python_file(self.dir, "env.py")
  File "/usr/lib/python3.8/site-packages/alembic/util/pyfiles.py", line 98, in load_python_file
    module = load_module_py(module_id, path)
  File "/usr/lib/python3.8/site-packages/alembic/util/compat.py", line 184, in load_module_py
    spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "migrations/env.py", line 88, in <module>
    run_migrations_online()
  File "migrations/env.py", line 81, in run_migrations_online
    context.run_migrations()
  File "<string>", line 8, in run_migrations
  File "/usr/lib/python3.8/site-packages/alembic/runtime/environment.py", line 846, in run_migrations
    self.get_context().run_migrations(**kw)
  File "/usr/lib/python3.8/site-packages/alembic/runtime/migration.py", line 520, in run_migrations
    step.migration_fn(**kw)
  File "/app/migrations/versions/856bb94b7040_add_comment_column_in_domain_template_.py", line 21, in upgrade
    op.add_column('domain_template_record',
  File "<string>", line 8, in add_column
  File "<string>", line 3, in add_column
  File "/usr/lib/python3.8/site-packages/alembic/operations/ops.py", line 1929, in add_column
    return operations.invoke(op)
  File "/usr/lib/python3.8/site-packages/alembic/operations/base.py", line 374, in invoke
    return fn(self, operation)
  File "/usr/lib/python3.8/site-packages/alembic/operations/toimpl.py", line 132, in add_column
    operations.impl.add_column(table_name, column, schema=schema, **kw)
  File "/usr/lib/python3.8/site-packages/alembic/ddl/impl.py", line 237, in add_column
    self._exec(base.AddColumn(table_name, column, schema=schema))
  File "/usr/lib/python3.8/site-packages/alembic/ddl/impl.py", line 140, in _exec
    return conn.execute(construct, *multiparams, **params)
  File "/usr/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 982, in execute
    return meth(self, multiparams, params)
  File "/usr/lib/python3.8/site-packages/sqlalchemy/sql/ddl.py", line 72, in _execute_on_connection
    return connection._execute_ddl(self, multiparams, params)
  File "/usr/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1039, in _execute_ddl
    ret = self._execute_context(
  File "/usr/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1249, in _execute_context
    self._handle_dbapi_exception(
  File "/usr/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1476, in _handle_dbapi_exception
    util.raise_from_cause(sqlalchemy_exception, exc_info)
  File "/usr/lib/python3.8/site-packages/sqlalchemy/util/compat.py", line 398, in raise_from_cause
    reraise(type(exception), exception, tb=exc_tb, cause=cause)
  File "/usr/lib/python3.8/site-packages/sqlalchemy/util/compat.py", line 152, in reraise
    raise value.with_traceback(tb)
  File "/usr/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1245, in _execute_context
    self.dialect.do_execute(
  File "/usr/lib/python3.8/site-packages/sqlalchemy/engine/default.py", line 581, in do_execute
    cursor.execute(statement, parameters)
  File "/usr/lib/python3.8/site-packages/MySQLdb/cursors.py", line 209, in execute
    res = self._query(query)
  File "/usr/lib/python3.8/site-packages/MySQLdb/cursors.py", line 315, in _query
    db.query(q)
  File "/usr/lib/python3.8/site-packages/MySQLdb/connections.py", line 239, in query
    _mysql.connection.query(self, query)
sqlalchemy.exc.OperationalError: (MySQLdb._exceptions.OperationalError) (1060, "Duplicate column name 'comment'")
[SQL: ALTER TABLE domain_template_record ADD COLUMN comment TEXT]
(Background on this error at: http://sqlalche.me/e/e3q8)

This is my compose file:

version: "3.7"

services:
  mariadb:
    image: mariadb:10.4
    environment:
      MYSQL_ROOT_PASSWORD: mypassword
      MYSQL_USER: powerdns
      MYSQL_PASSWORD: otherpassword
      MYSQL_DATABASE: powerdns
    restart: unless-stopped
    volumes:
      - ./pv/mariadb:/var/lib/mysql

  pdns:
    image: psitrax/powerdns:v4.3.0
    ports:
      - "53:53"
      - "53:53/udp"
    depends_on:
      - mariadb
    environment:
      MYSQL_DB: powerdns
      MYSQL_USER: powerdns
      MYSQL_PASS: otherpassword
      MYSQL_HOST: mariadb
    restart: unless-stopped
  #  volumes:
  #    - ./pv/pdns:/etc/pdns/

  pdns-admin:
    image: ngoduykhanh/powerdns-admin:0.2.2
    ports:
      - "9191:80"
    restart: unless-stopped
    depends_on:
      - mariadb
      - pdns
    logging:
      driver: json-file
      options:
        max-size: 50m
    environment:
      SQLALCHEMY_DATABASE_URI: mysql://pda:thisismypassword@mariadb/pda
      GUNICORN_TIMEOUT: 60
      GUNICORN_WORKERS: 2
      GUNICORN_LOGLEVEL: DEBUG
      OFFLINE_MODE: "False" # True for offline, False for external resources
    volumes:
      - ./pv/pdns-admin:/data

I try to delete the database and restart the pda container, but get the same error.

Please help, i hate the pdnsutil cli ^^

Thank you :)

jbe-dw commented 2 years ago

Hello,

Could you resolve your issue since you asked ?

Regards