eNMS-automation / eNMS

An enterprise-grade vendor-agnostic network automation platform.
https://www.enms.io/
GNU General Public License v3.0
814 stars 162 forks source link

Error launching gunicorn with mariadb #379

Closed rokkhan closed 2 years ago

rokkhan commented 2 years ago

Hello i am trying to do a fresh install of the latest version eNMS 4.2.1. Any help will be higly appreciated.

The app runs without any problems on development mode running gunicorn manually but if i try to launch witch a Mariadb database backend i get this error:

2022-06-15 23:41:23,330 INFO Bypassing metadata creation for process 23246 2022-06-15 23:41:23,967 WARNING Fetch n°0 failed ((MySQLdb._exceptions.ProgrammingError) (1146, "Table 'enms.user' doesn't exist") [SQL: SELECT user.id AS user_id, user.name AS user_name, user.description AS user_description, user.groups AS user_groups, user.email AS user_email, user.password AS user_password, user.authentication AS user_authentication, user.menu AS user_menu, user.pages AS user_pages, user.upper_menu AS user_upper_menu, user.get_requests AS user_get_requests, user.post_requests AS user_post_requests, user.delete_requests AS user_delete_requests, user.small_menu AS user_small_menu, user.theme AS user_theme, user.is_admin AS user_is_admin FROM user WHERE user.name = %s LIMIT %s] [parameters: ('admin', 1)] (Background on this error at: https://sqlalche.me/e/14/f405)) 2022-06-15 23:41:26,973 WARNING Fetch n°1 failed ((MySQLdb._exceptions.ProgrammingError) (1146, "Table 'enms.user' doesn't exist") [SQL: SELECT user.id AS user_id, user.name AS user_name, user.description AS user_description, user.groups AS user_groups, user.email AS user_email, user.password AS user_password, user.authentication AS user_authentication, user.menu AS user_menu, user.pages AS user_pages, user.upper_menu AS user_upper_menu, user.get_requests AS user_get_requests, user.post_requests AS user_post_requests, user.delete_requests AS user_delete_requests, user.small_menu AS user_small_menu, user.theme AS user_theme, user.is_admin AS user_is_admin FROM user WHERE user.name = %s LIMIT %s] [parameters: ('admin', 1)] (Background on this error at: https://sqlalche.me/e/14/f405)) 2022-06-15 23:41:32,989 ERROR Fetch n°2 failed (Traceback (most recent call last): File "/home/enms/.local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1819, in _execute_context self.dialect.do_execute( File "/home/enms/.local/lib/python3.9/site-packages/sqlalchemy/engine/default.py", line 732, in do_execute cursor.execute(statement, parameters) File "/usr/lib64/python3.9/site-packages/MySQLdb/cursors.py", line 206, in execute res = self._query(query) File "/usr/lib64/python3.9/site-packages/MySQLdb/cursors.py", line 319, in _query db.query(q) File "/usr/lib64/python3.9/site-packages/MySQLdb/connections.py", line 254, in query _mysql.connection.query(self, query) MySQLdb._exceptions.ProgrammingError: (1146, "Table 'enms.user' doesn't exist")

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/home/enms/eNMS/eNMS/database.py", line 353, in fetch result = query.all() if all_matches else query.first() File "/home/enms/.local/lib/python3.9/site-packages/sqlalchemy/orm/query.py", line 2819, in first return self.limit(1)._iter().first() File "/home/enms/.local/lib/python3.9/site-packages/sqlalchemy/orm/query.py", line 2903, in _iter result = self.session.execute( File "/home/enms/.local/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 1712, in execute result = conn._execute_20(statement, params or {}, execution_options) File "/home/enms/.local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1631, in _execute_20 return meth(self, args_10style, kwargs_10style, execution_options) File "/home/enms/.local/lib/python3.9/site-packages/sqlalchemy/sql/elements.py", line 325, in _execute_on_connection return connection._execute_clauseelement( File "/home/enms/.local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1498, in _execute_clauseelement ret = self._execute_context( File "/home/enms/.local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1862, in _execute_context self.handle_dbapi_exception( File "/home/enms/.local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 2043, in handle_dbapi_exception util.raise( File "/home/enms/.local/lib/python3.9/site-packages/sqlalchemy/util/compat.py", line 208, in raise raise exception File "/home/enms/.local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1819, in _execute_context self.dialect.do_execute( File "/home/enms/.local/lib/python3.9/site-packages/sqlalchemy/engine/default.py", line 732, in do_execute cursor.execute(statement, parameters) File "/usr/lib64/python3.9/site-packages/MySQLdb/cursors.py", line 206, in execute res = self._query(query) File "/usr/lib64/python3.9/site-packages/MySQLdb/cursors.py", line 319, in _query db.query(q) File "/usr/lib64/python3.9/site-packages/MySQLdb/connections.py", line 254, in query _mysql.connection.query(self, query) sqlalchemy.exc.ProgrammingError: (MySQLdb._exceptions.ProgrammingError) (1146, "Table 'enms.user' doesn't exist") [SQL: SELECT user.id AS user_id, user.name AS user_name, user.description AS user_description, user.groups AS user_groups, user.email AS user_email, user.password AS user_password, user.authentication AS user_authentication, user.menu AS user_menu, user.pages AS user_pages, user.upper_menu AS user_upper_menu, user.get_requests AS user_get_requests, user.post_requests AS user_post_requests, user.delete_requests AS user_delete_requests, user.small_menu AS user_small_menu, user.theme AS user_theme, user.is_admin AS user_is_admin FROM user WHERE user.name = %s LIMIT %s] [parameters: ('admin', 1)] (Background on this error at: https://sqlalche.me/e/14/f405) ) Traceback (most recent call last): File "/home/enms/.local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1819, in _execute_context self.dialect.do_execute( File "/home/enms/.local/lib/python3.9/site-packages/sqlalchemy/engine/default.py", line 732, in do_execute cursor.execute(statement, parameters) File "/usr/lib64/python3.9/site-packages/MySQLdb/cursors.py", line 206, in execute res = self._query(query) File "/usr/lib64/python3.9/site-packages/MySQLdb/cursors.py", line 319, in _query db.query(q) File "/usr/lib64/python3.9/site-packages/MySQLdb/connections.py", line 254, in query _mysql.connection.query(self, query) MySQLdb._exceptions.ProgrammingError: (1146, "Table 'enms.user' doesn't exist")

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/home/enms/.local/bin/gunicorn", line 8, in sys.exit(run()) File "/home/enms/.local/lib/python3.9/site-packages/gunicorn/app/wsgiapp.py", line 67, in run WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]").run() File "/home/enms/.local/lib/python3.9/site-packages/gunicorn/app/base.py", line 231, in run super().run() File "/home/enms/.local/lib/python3.9/site-packages/gunicorn/app/base.py", line 72, in run Arbiter(self).run() File "/home/enms/.local/lib/python3.9/site-packages/gunicorn/arbiter.py", line 58, in init self.setup(app) File "/home/enms/.local/lib/python3.9/site-packages/gunicorn/arbiter.py", line 118, in setup self.app.wsgi() File "/home/enms/.local/lib/python3.9/site-packages/gunicorn/app/base.py", line 67, in wsgi self.callable = self.load() File "/home/enms/.local/lib/python3.9/site-packages/gunicorn/app/wsgiapp.py", line 58, in load return self.load_wsgiapp() File "/home/enms/.local/lib/python3.9/site-packages/gunicorn/app/wsgiapp.py", line 48, in load_wsgiapp return util.import_app(self.app_uri) File "/home/enms/.local/lib/python3.9/site-packages/gunicorn/util.py", line 359, in import_app mod = importlib.import_module(module) File "/usr/lib64/python3.9/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1030, in _gcd_import File "", line 1007, in _find_and_load File "", line 986, in _find_and_load_unlocked File "", line 680, in _load_unlocked File "", line 850, in exec_module File "", line 228, in _call_with_frames_removed File "/home/enms/eNMS/app.py", line 1, in from eNMS.server import server as app # noqa: F401 File "/home/enms/eNMS/eNMS/init.py", line 20, in initialize() File "/home/enms/eNMS/eNMS/init.py", line 12, in initialize first_init = db._initialize(env) File "/home/enms/eNMS/eNMS/database.py", line 84, in _initialize first_init = not self.fetch("user", allow_none=True, name="admin") File "/home/enms/eNMS/eNMS/database.py", line 359, in fetch raise exc File "/home/enms/eNMS/eNMS/database.py", line 353, in fetch result = query.all() if all_matches else query.first() File "/home/enms/.local/lib/python3.9/site-packages/sqlalchemy/orm/query.py", line 2819, in first return self.limit(1)._iter().first() File "/home/enms/.local/lib/python3.9/site-packages/sqlalchemy/orm/query.py", line 2903, in _iter result = self.session.execute( File "/home/enms/.local/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 1712, in execute result = conn._execute_20(statement, params or {}, execution_options) File "/home/enms/.local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1631, in _execute_20 return meth(self, args_10style, kwargs_10style, execution_options) File "/home/enms/.local/lib/python3.9/site-packages/sqlalchemy/sql/elements.py", line 325, in _execute_on_connection return connection._execute_clauseelement( File "/home/enms/.local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1498, in _execute_clauseelement ret = self._execute_context( File "/home/enms/.local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1862, in _execute_context self.handle_dbapi_exception( File "/home/enms/.local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 2043, in handle_dbapi_exception util.raise( File "/home/enms/.local/lib/python3.9/site-packages/sqlalchemy/util/compat.py", line 208, in raise raise exception File "/home/enms/.local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1819, in _execute_context self.dialect.do_execute( File "/home/enms/.local/lib/python3.9/site-packages/sqlalchemy/engine/default.py", line 732, in do_execute cursor.execute(statement, parameters) File "/usr/lib64/python3.9/site-packages/MySQLdb/cursors.py", line 206, in execute res = self._query(query) File "/usr/lib64/python3.9/site-packages/MySQLdb/cursors.py", line 319, in _query db.query(q) File "/usr/lib64/python3.9/site-packages/MySQLdb/connections.py", line 254, in query _mysql.connection.query(self, query) sqlalchemy.exc.ProgrammingError: (MySQLdb._exceptions.ProgrammingError) (1146, "Table 'enms.user' doesn't exist") [SQL: SELECT user.id AS user_id, user.name AS user_name, user.description AS user_description, user.groups AS user_groups, user.email AS user_email, user.password AS user_password, user.authentication AS user_authentication, user.menu AS user_menu, user.pages AS user_pages, user.upper_menu AS user_upper_menu, user.get_requests AS user_get_requests, user.post_requests AS user_post_requests, user.delete_requests AS user_delete_requests, user.small_menu AS user_small_menu, user.theme AS user_theme, user.is_admin AS user_is_admin FROM user WHERE user.name = %s LIMIT %s] [parameters: ('admin', 1)] (Background on this error at: https://sqlalche.me/e/14/f405)

Environment: Sles 15 SP3 Python 3.9 Mariadb 10.5

rokkhan commented 2 years ago

Any help?

afourmy commented 2 years ago

something in your env is misconfigured try with a mysql db perhaps

afourmy commented 2 years ago

Closing as this is not caused by eNMS, the application works fine for me with a mariadb database. I guess you're using the wrong sqlalchemy connector, or the wrong database engine parameters, or the database itself is not configured properly.