thilojaeggi / WinGetty

An open source REST Backend for creating a private WinGet Repo without having to rely on cloud dependencies.
https://wingetty.dev
GNU Affero General Public License v3.0
168 stars 15 forks source link

Errors creating default permissions on clean database installation #10

Closed bewster closed 8 months ago

bewster commented 10 months ago

Describe the bug Running a fresh container, tagged 0.0.3, on an Azure Web Apps, is logging a bunch of errors. I don't get the same issues logged when running it under a local Docker container.

To Reproduce Steps to reproduce the behavior:

  1. Get 0.0.3 up and running with just a SQLite database (as per the examples)

Expected behavior Azure tends to detect the errors and prevent the container from loading. I had expected it to go direct to the sign-up screen (with no errors)

Screenshots These are the logs:

2023-08-29T20:20:00.045029967Z INFO  [alembic.runtime.migration] Context impl SQLiteImpl.
2023-08-29T20:20:00.045063771Z INFO  [alembic.runtime.migration] Will assume non-transactional DDL.
2023-08-29T20:20:00.083965663Z INFO  [alembic.runtime.migration] Running upgrade  -> 3d1965dfdcd5, Create database tables for the first time
2023-08-29T20:20:00.233395548Z INFO  [alembic.runtime.migration] Running upgrade 3d1965dfdcd5 -> 50b652194afc, Change name to username in user table`
2023-08-29T20:20:00.282728975Z INFO  [alembic.runtime.migration] Running upgrade 50b652194afc -> ba3c6bdf3b09, Make fields unique
2023-08-29T20:20:00.342468327Z INFO  [alembic.runtime.migration] Running upgrade ba3c6bdf3b09 -> 294fa8c8c153, Rename installer switch colum names
2023-08-29T20:20:00.400330460Z INFO  [alembic.runtime.migration] Running upgrade 294fa8c8c153 -> 9b131b465fca, Add role, permission tables
2023-08-29T20:20:00.519270780Z INFO  [alembic.runtime.migration] Running upgrade 9b131b465fca -> e28efaaea362, Add nested installer columns
2023-08-29T20:20:00.872213648Z [2023-08-29 20:20:00 +0000] [1] [INFO] Starting gunicorn 20.1.0
2023-08-29T20:20:00.873475484Z [2023-08-29 20:20:00 +0000] [1] [INFO] Listening at: http://0.0.0.0:8080 (1)
2023-08-29T20:20:00.873728697Z [2023-08-29 20:20:00 +0000] [1] [INFO] Using worker: sync
2023-08-29T20:20:00.877082570Z [2023-08-29 20:20:00 +0000] [8] [INFO] Booting worker with pid: 8
2023-08-29T20:20:00.907930410Z [2023-08-29 20:20:00 +0000] [9] [INFO] Booting worker with pid: 9
2023-08-29T20:20:00.952555170Z [2023-08-29 20:20:00 +0000] [10] [INFO] Booting worker with pid: 10
2023-08-29T20:20:00.992154335Z [2023-08-29 20:20:00 +0000] [11] [INFO] Booting worker with pid: 11
2023-08-29T20:20:05.833970841Z [2023-08-29 20:20:05 +0000] [8] [ERROR] Exception in worker process
2023-08-29T20:20:05.833998964Z Traceback (most recent call last):
2023-08-29T20:20:05.834004675Z   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1968, in _exec_single_context
2023-08-29T20:20:05.834009023Z     self.dialect.do_execute(
2023-08-29T20:20:05.834012980Z   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/default.py", line 920, in do_execute
2023-08-29T20:20:05.834017078Z     cursor.execute(statement, parameters)
2023-08-29T20:20:05.834020785Z sqlite3.IntegrityError: UNIQUE constraint failed: permission.name
2023-08-29T20:20:05.834025023Z 
2023-08-29T20:20:05.834028750Z The above exception was the direct cause of the following exception:
2023-08-29T20:20:05.834032356Z 
2023-08-29T20:20:05.834036123Z Traceback (most recent call last):
2023-08-29T20:20:05.834039570Z   File "/usr/local/lib/python3.9/site-packages/gunicorn/arbiter.py", line 589, in spawn_worker
2023-08-29T20:20:05.834043607Z     worker.init_process()
2023-08-29T20:20:05.834047464Z   File "/usr/local/lib/python3.9/site-packages/gunicorn/workers/base.py", line 134, in init_process
2023-08-29T20:20:05.834051302Z     self.load_wsgi()
2023-08-29T20:20:05.834063084Z   File "/usr/local/lib/python3.9/site-packages/gunicorn/workers/base.py", line 146, in load_wsgi
2023-08-29T20:20:05.834067141Z     self.wsgi = self.app.wsgi()
2023-08-29T20:20:05.834070878Z   File "/usr/local/lib/python3.9/site-packages/gunicorn/app/base.py", line 67, in wsgi
2023-08-29T20:20:05.834074425Z     self.callable = self.load()
2023-08-29T20:20:05.834077801Z   File "/usr/local/lib/python3.9/site-packages/gunicorn/app/wsgiapp.py", line 58, in load
2023-08-29T20:20:05.834081298Z     return self.load_wsgiapp()
2023-08-29T20:20:05.834084734Z   File "/usr/local/lib/python3.9/site-packages/gunicorn/app/wsgiapp.py", line 48, in load_wsgiapp
2023-08-29T20:20:05.834088341Z     return util.import_app(self.app_uri)
2023-08-29T20:20:05.834091577Z   File "/usr/local/lib/python3.9/site-packages/gunicorn/util.py", line 412, in import_app
2023-08-29T20:20:05.834095424Z     app = app(*args, **kwargs)
2023-08-29T20:20:05.834098720Z   File "/app/app/__init__.py", line 97, in create_app
2023-08-29T20:20:05.834102046Z     create_all()
2023-08-29T20:20:05.834105303Z   File "/app/app/permissions.py", line 6, in create_all
2023-08-29T20:20:05.834108629Z     create_permissions()
2023-08-29T20:20:05.834111764Z   File "/app/app/permissions.py", line 96, in create_permissions
2023-08-29T20:20:05.834115502Z     existing_permission = Permission.query.filter_by(name=permission).first()
2023-08-29T20:20:05.834118858Z   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/orm/query.py", line 2747, in first
2023-08-29T20:20:05.834122415Z     return self.limit(1)._iter().first()  # type: ignore
2023-08-29T20:20:05.834125791Z   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/orm/query.py", line 2846, in _iter
2023-08-29T20:20:05.834129287Z     result: Union[ScalarResult[_T], Result[_T]] = self.session.execute(
2023-08-29T20:20:05.834133555Z   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 2232, in execute
2023-08-29T20:20:05.834136871Z     return self._execute_internal(
2023-08-29T20:20:05.834140067Z   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 2106, in _execute_internal
2023-08-29T20:20:05.834143804Z     ) = compile_state_cls.orm_pre_session_exec(
2023-08-29T20:20:05.834146950Z   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/orm/context.py", line 546, in orm_pre_session_exec
2023-08-29T20:20:05.834150477Z     session._autoflush()
2023-08-29T20:20:05.834153573Z   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 2909, in _autoflush
2023-08-29T20:20:05.834156869Z     raise e.with_traceback(sys.exc_info()[2])
2023-08-29T20:20:05.834160014Z   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 2898, in _autoflush
2023-08-29T20:20:05.834163461Z     self.flush()
2023-08-29T20:20:05.834170324Z   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 4154, in flush
2023-08-29T20:20:05.834174061Z     self._flush(objects)
2023-08-29T20:20:05.834177698Z   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 4291, in _flush
2023-08-29T20:20:05.834181204Z     transaction.rollback(_capture_exception=True)
2023-08-29T20:20:05.834184390Z   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/util/langhelpers.py", line 147, in __exit__
2023-08-29T20:20:05.834187736Z     raise exc_value.with_traceback(exc_tb)
2023-08-29T20:20:05.834190892Z   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 4251, in _flush
2023-08-29T20:20:05.834194369Z     flush_context.execute()
2023-08-29T20:20:05.834197625Z   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/orm/unitofwork.py", line 467, in execute
2023-08-29T20:20:05.834201242Z     rec.execute(self)
2023-08-29T20:20:05.834204457Z   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/orm/unitofwork.py", line 644, in execute
2023-08-29T20:20:05.834207844Z     util.preloaded.orm_persistence.save_obj(
2023-08-29T20:20:05.834211110Z   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/orm/persistence.py", line 93, in save_obj
2023-08-29T20:20:05.834214787Z     _emit_insert_statements(
2023-08-29T20:20:05.834218303Z   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/orm/persistence.py", line 1223, in _emit_insert_statements
2023-08-29T20:20:05.834222241Z     result = connection.execute(
2023-08-29T20:20:05.834225577Z   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1413, in execute
2023-08-29T20:20:05.834229134Z     return meth(
2023-08-29T20:20:05.834232410Z   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/sql/elements.py", line 483, in _execute_on_connection
2023-08-29T20:20:05.834236167Z     return connection._execute_clauseelement(
2023-08-29T20:20:05.834240064Z   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1637, in _execute_clauseelement
2023-08-29T20:20:05.834243691Z     ret = self._execute_context(
2023-08-29T20:20:05.834247398Z   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1846, in _execute_context
2023-08-29T20:20:05.834250824Z     return self._exec_single_context(
2023-08-29T20:20:05.834254100Z   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1987, in _exec_single_context
2023-08-29T20:20:05.834257456Z     self._handle_dbapi_exception(
2023-08-29T20:20:05.834260542Z   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 2344, in _handle_dbapi_exception
2023-08-29T20:20:05.834264129Z     raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
2023-08-29T20:20:05.834267505Z   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1968, in _exec_single_context
2023-08-29T20:20:05.834273867Z     self.dialect.do_execute(
2023-08-29T20:20:05.834277243Z   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/default.py", line 920, in do_execute
2023-08-29T20:20:05.834280870Z     cursor.execute(statement, parameters)
2023-08-29T20:20:05.834284317Z sqlalchemy.exc.IntegrityError: (raised as a result of Query-invoked autoflush; consider using a session.no_autoflush block if this flush is occurring prematurely)
2023-08-29T20:20:05.834288134Z (sqlite3.IntegrityError) UNIQUE constraint failed: permission.name
2023-08-29T20:20:05.834291971Z [SQL: INSERT INTO permission (name) VALUES (?)]
2023-08-29T20:20:05.834295567Z [parameters: ('view:package',)]
2023-08-29T20:20:05.834298793Z (Background on this error at: https://sqlalche.me/e/20/gkpj)
2023-08-29T20:20:05.835375121Z [2023-08-29 20:20:05 +0000] [8] [INFO] Worker exiting (pid: 8)
2023-08-29T20:20:05.835802699Z Creating permission: view:package
2023-08-29T20:20:06.029765046Z [2023-08-29 20:20:06 +0000] [11] [INFO] Worker exiting (pid: 11)
2023-08-29T20:20:06.029964839Z Creating permission: view:package
2023-08-29T20:20:06.029977402Z Creating permission: add:package
2023-08-29T20:20:06.029982291Z Creating permission: edit:package
2023-08-29T20:20:06.029986138Z Creating permission: delete:package
2023-08-29T20:20:06.029989855Z Creating permission: view:version
2023-08-29T20:20:06.029993782Z Creating permission: add:version
2023-08-29T20:20:06.029997460Z Creating permission: edit:version
2023-08-29T20:20:06.030001487Z Creating permission: delete:version
2023-08-29T20:20:06.030005564Z Creating permission: view:installer
2023-08-29T20:20:06.030009803Z Creating permission: add:installer
2023-08-29T20:20:06.030013650Z Creating permission: edit:installer
2023-08-29T20:20:06.030017657Z Creating permission: delete:installer
2023-08-29T20:20:06.030021625Z Creating permission: view:installer_switch
2023-08-29T20:20:06.030025311Z Creating permission: add:installer_switch
2023-08-29T20:20:06.030029880Z Creating permission: edit:installer_switch
2023-08-29T20:20:06.030033507Z Creating permission: delete:installer_switch
2023-08-29T20:20:06.030037354Z Creating permission: view:role
2023-08-29T20:20:06.030041622Z Creating permission: add:role
2023-08-29T20:20:06.030046311Z Creating permission: edit:role
2023-08-29T20:20:06.030050388Z Creating permission: delete:role
2023-08-29T20:20:06.030054847Z Creating permission: view:permission
2023-08-29T20:20:06.030059345Z Creating permission: add:permission
2023-08-29T20:20:06.030063412Z Creating permission: edit:permission
2023-08-29T20:20:06.030066658Z Creating permission: delete:permission
2023-08-29T20:20:06.030070135Z Creating permission: view:user
2023-08-29T20:20:06.030080805Z Creating permission: add:user
2023-08-29T20:20:06.030085243Z Creating permission: edit:user
2023-08-29T20:20:06.030089080Z Creating permission: delete:user
2023-08-29T20:20:06.030092637Z Creating permission: view:own_user
2023-08-29T20:20:06.030096464Z Creating permission: edit:own_user
2023-08-29T20:20:06.058490897Z [2023-08-29 20:20:06 +0000] [10] [ERROR] Exception in worker process
2023-08-29T20:20:06.058515212Z Traceback (most recent call last):
2023-08-29T20:20:06.058520382Z   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1968, in _exec_single_context
2023-08-29T20:20:06.058525431Z     self.dialect.do_execute(
2023-08-29T20:20:06.058529990Z   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/default.py", line 920, in do_execute
2023-08-29T20:20:06.058534769Z     cursor.execute(statement, parameters)
2023-08-29T20:20:06.058538816Z sqlite3.IntegrityError: UNIQUE constraint failed: permission.name
2023-08-29T20:20:06.058543265Z 
2023-08-29T20:20:06.058547813Z The above exception was the direct cause of the following exception:
2023-08-29T20:20:06.058552071Z 
2023-08-29T20:20:06.058556039Z Traceback (most recent call last):
2023-08-29T20:20:06.058587838Z   File "/usr/local/lib/python3.9/site-packages/gunicorn/arbiter.py", line 589, in spawn_worker
2023-08-29T20:20:06.058594871Z     worker.init_process()
2023-08-29T20:20:06.058598628Z   File "/usr/local/lib/python3.9/site-packages/gunicorn/workers/base.py", line 134, in init_process
2023-08-29T20:20:06.058602165Z     self.load_wsgi()
2023-08-29T20:20:06.058605340Z   File "/usr/local/lib/python3.9/site-packages/gunicorn/workers/base.py", line 146, in load_wsgi
2023-08-29T20:20:06.058609108Z     self.wsgi = self.app.wsgi()
2023-08-29T20:20:06.058612534Z   File "/usr/local/lib/python3.9/site-packages/gunicorn/app/base.py", line 67, in wsgi
2023-08-29T20:20:06.058616702Z     self.callable = self.load()
2023-08-29T20:20:06.058620399Z   File "/usr/local/lib/python3.9/site-packages/gunicorn/app/wsgiapp.py", line 58, in load
2023-08-29T20:20:06.058623915Z     return self.load_wsgiapp()
2023-08-29T20:20:06.058627412Z   File "/usr/local/lib/python3.9/site-packages/gunicorn/app/wsgiapp.py", line 48, in load_wsgiapp
2023-08-29T20:20:06.058630999Z     return util.import_app(self.app_uri)
2023-08-29T20:20:06.058634595Z   File "/usr/local/lib/python3.9/site-packages/gunicorn/util.py", line 412, in import_app
2023-08-29T20:20:06.058638202Z     app = app(*args, **kwargs)
2023-08-29T20:20:06.058642029Z   File "/app/app/__init__.py", line 97, in create_app
2023-08-29T20:20:06.058717600Z     create_all()
2023-08-29T20:20:06.058724002Z   File "/app/app/permissions.py", line 6, in create_all
2023-08-29T20:20:06.058736435Z     create_permissions()
2023-08-29T20:20:06.058740102Z   File "/app/app/permissions.py", line 96, in create_permissions
2023-08-29T20:20:06.058743598Z     existing_permission = Permission.query.filter_by(name=permission).first()
2023-08-29T20:20:06.058747115Z   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/orm/query.py", line 2747, in first
2023-08-29T20:20:06.058751063Z     return self.limit(1)._iter().first()  # type: ignore
2023-08-29T20:20:06.058754879Z   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/orm/query.py", line 2846, in _iter
2023-08-29T20:20:06.058758767Z     result: Union[ScalarResult[_T], Result[_T]] = self.session.execute(
2023-08-29T20:20:06.058764798Z   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 2232, in execute
2023-08-29T20:20:06.058768876Z     return self._execute_internal(
2023-08-29T20:20:06.058772492Z   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 2106, in _execute_internal
2023-08-29T20:20:06.058776250Z     ) = compile_state_cls.orm_pre_session_exec(
2023-08-29T20:20:06.058779876Z   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/orm/context.py", line 546, in orm_pre_session_exec
2023-08-29T20:20:06.058783703Z     session._autoflush()
2023-08-29T20:20:06.058787390Z   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 2909, in _autoflush
2023-08-29T20:20:06.058791338Z     raise e.with_traceback(sys.exc_info()[2])
2023-08-29T20:20:06.058795025Z   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 2898, in _autoflush
2023-08-29T20:20:06.058798992Z     self.flush()
2023-08-29T20:20:06.058802669Z   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 4154, in flush
2023-08-29T20:20:06.058806576Z     self._flush(objects)
2023-08-29T20:20:06.058810343Z   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 4291, in _flush
2023-08-29T20:20:06.058814070Z     transaction.rollback(_capture_exception=True)
2023-08-29T20:20:06.058817707Z   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/util/langhelpers.py", line 147, in __exit__
2023-08-29T20:20:06.058821504Z     raise exc_value.with_traceback(exc_tb)
2023-08-29T20:20:06.058825171Z   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 4251, in _flush
2023-08-29T20:20:06.058829018Z     flush_context.execute()
2023-08-29T20:20:06.058833687Z   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/orm/unitofwork.py", line 467, in execute
2023-08-29T20:20:06.058837574Z     rec.execute(self)
2023-08-29T20:20:06.058841201Z   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/orm/unitofwork.py", line 644, in execute
2023-08-29T20:20:06.058844847Z     util.preloaded.orm_persistence.save_obj(
2023-08-29T20:20:06.058848514Z   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/orm/persistence.py", line 93, in save_obj
2023-08-29T20:20:06.058856209Z     _emit_insert_statements(
2023-08-29T20:20:06.058859946Z   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/orm/persistence.py", line 1223, in _emit_insert_statements
2023-08-29T20:20:06.058863823Z     result = connection.execute(
2023-08-29T20:20:06.058867360Z   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1413, in execute
2023-08-29T20:20:06.058871187Z     return meth(
2023-08-29T20:20:06.058874583Z   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/sql/elements.py", line 483, in _execute_on_connection
2023-08-29T20:20:06.058878400Z     return connection._execute_clauseelement(
2023-08-29T20:20:06.058882498Z   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1637, in _execute_clauseelement
2023-08-29T20:20:06.058886415Z     ret = self._execute_context(
2023-08-29T20:20:06.058889891Z   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1846, in _execute_context
2023-08-29T20:20:06.058893609Z     return self._exec_single_context(
2023-08-29T20:20:06.058897225Z   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1987, in _exec_single_context
2023-08-29T20:20:06.058901092Z     self._handle_dbapi_exception(
2023-08-29T20:20:06.058969731Z   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 2344, in _handle_dbapi_exception
2023-08-29T20:20:06.058974981Z     raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
2023-08-29T20:20:06.058979198Z   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1968, in _exec_single_context
2023-08-29T20:20:06.058983056Z     self.dialect.do_execute(
2023-08-29T20:20:06.058987204Z   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/default.py", line 920, in do_execute
2023-08-29T20:20:06.058991341Z     cursor.execute(statement, parameters)
2023-08-29T20:20:06.058995409Z sqlalchemy.exc.IntegrityError: (raised as a result of Query-invoked autoflush; consider using a session.no_autoflush block if this flush is occurring prematurely)
2023-08-29T20:20:06.058999567Z (sqlite3.IntegrityError) UNIQUE constraint failed: permission.name
2023-08-29T20:20:06.059003734Z [SQL: INSERT INTO permission (name) VALUES (?)]
2023-08-29T20:20:06.059008062Z [parameters: ('view:package',)]
2023-08-29T20:20:06.059011629Z (Background on this error at: https://sqlalche.me/e/20/gkpj)
2023-08-29T20:20:06.069200407Z Creating permission: view:package
2023-08-29T20:20:06.069302829Z [2023-08-29 20:20:06 +0000] [9] [ERROR] Exception in worker process
2023-08-29T20:20:06.069312867Z Traceback (most recent call last):
2023-08-29T20:20:06.069318157Z   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1968, in _exec_single_context
2023-08-29T20:20:06.069322285Z     self.dialect.do_execute(
2023-08-29T20:20:06.069334377Z   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/default.py", line 920, in do_execute
2023-08-29T20:20:06.069338535Z     cursor.execute(statement, parameters)
2023-08-29T20:20:06.069341931Z sqlite3.IntegrityError: UNIQUE constraint failed: permission.name
2023-08-29T20:20:06.069345258Z 
2023-08-29T20:20:06.069348894Z The above exception was the direct cause of the following exception:
2023-08-29T20:20:06.069352441Z 
2023-08-29T20:20:06.069507270Z Traceback (most recent call last):
2023-08-29T20:20:06.069515996Z   File "/usr/local/lib/python3.9/site-packages/gunicorn/arbiter.py", line 589, in spawn_worker
2023-08-29T20:20:06.069521026Z     worker.init_process()
2023-08-29T20:20:06.069525374Z   File "/usr/local/lib/python3.9/site-packages/gunicorn/workers/base.py", line 134, in init_process
2023-08-29T20:20:06.069528970Z     self.load_wsgi()
2023-08-29T20:20:06.069532247Z   File "/usr/local/lib/python3.9/site-packages/gunicorn/workers/base.py", line 146, in load_wsgi
2023-08-29T20:20:06.069535863Z     self.wsgi = self.app.wsgi()
2023-08-29T20:20:06.069539109Z   File "/usr/local/lib/python3.9/site-packages/gunicorn/app/base.py", line 67, in wsgi
2023-08-29T20:20:06.069542405Z     self.callable = self.load()
2023-08-29T20:20:06.069546353Z   File "/usr/local/lib/python3.9/site-packages/gunicorn/app/wsgiapp.py", line 58, in load
2023-08-29T20:20:06.069550611Z     return self.load_wsgiapp()
2023-08-29T20:20:06.069554678Z   File "/usr/local/lib/python3.9/site-packages/gunicorn/app/wsgiapp.py", line 48, in load_wsgiapp
2023-08-29T20:20:06.069559638Z     return util.import_app(self.app_uri)
2023-08-29T20:20:06.069563886Z   File "/usr/local/lib/python3.9/site-packages/gunicorn/util.py", line 412, in import_app
2023-08-29T20:20:06.069568674Z     app = app(*args, **kwargs)
2023-08-29T20:20:06.069572792Z   File "/app/app/__init__.py", line 97, in create_app
2023-08-29T20:20:06.069577110Z     create_all()
2023-08-29T20:20:06.069580927Z   File "/app/app/permissions.py", line 6, in create_all
2023-08-29T20:20:06.069586658Z     create_permissions()
2023-08-29T20:20:06.069590665Z   File "/app/app/permissions.py", line 96, in create_permissions
2023-08-29T20:20:06.069594583Z     existing_permission = Permission.query.filter_by(name=permission).first()
2023-08-29T20:20:06.069643724Z   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/orm/query.py", line 2747, in first
2023-08-29T20:20:06.069648023Z     return self.limit(1)._iter().first()  # type: ignore
2023-08-29T20:20:06.069653032Z   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/orm/query.py", line 2846, in _iter
2023-08-29T20:20:06.069657520Z     result: Union[ScalarResult[_T], Result[_T]] = self.session.execute(
2023-08-29T20:20:06.069663792Z   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 2232, in execute
2023-08-29T20:20:06.069676005Z     return self._execute_internal(
2023-08-29T20:20:06.069681024Z   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 2106, in _execute_internal
2023-08-29T20:20:06.069685252Z     ) = compile_state_cls.orm_pre_session_exec(
2023-08-29T20:20:06.071293943Z   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/orm/context.py", line 546, in orm_pre_session_exec
2023-08-29T20:20:06.071305865Z     session._autoflush()
2023-08-29T20:20:06.071310404Z   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 2909, in _autoflush
2023-08-29T20:20:06.071314622Z     raise e.with_traceback(sys.exc_info()[2])
2023-08-29T20:20:06.071318288Z   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 2898, in _autoflush
2023-08-29T20:20:06.071322326Z     self.flush()
2023-08-29T20:20:06.071325773Z   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 4154, in flush
2023-08-29T20:20:06.071329369Z     self._flush(objects)
2023-08-29T20:20:06.071332776Z   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 4291, in _flush
2023-08-29T20:20:06.071336132Z     transaction.rollback(_capture_exception=True)
2023-08-29T20:20:06.071339318Z   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/util/langhelpers.py", line 147, in __exit__
2023-08-29T20:20:06.071342764Z     raise exc_value.with_traceback(exc_tb)
2023-08-29T20:20:06.071346060Z   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 4251, in _flush
2023-08-29T20:20:06.071349457Z     flush_context.execute()
2023-08-29T20:20:06.071352763Z   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/orm/unitofwork.py", line 467, in execute
2023-08-29T20:20:06.071356370Z     rec.execute(self)
2023-08-29T20:20:06.071359496Z   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/orm/unitofwork.py", line 644, in execute
2023-08-29T20:20:06.071363032Z     util.preloaded.orm_persistence.save_obj(
2023-08-29T20:20:06.071366278Z   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/orm/persistence.py", line 93, in save_obj
2023-08-29T20:20:06.071369835Z     _emit_insert_statements(
2023-08-29T20:20:06.071373041Z   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/orm/persistence.py", line 1223, in _emit_insert_statements
2023-08-29T20:20:06.071376608Z     result = connection.execute(
2023-08-29T20:20:06.071380384Z   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1413, in execute
2023-08-29T20:20:06.071384091Z     return meth(
2023-08-29T20:20:06.071387889Z   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/sql/elements.py", line 483, in _execute_on_connection
2023-08-29T20:20:06.071391625Z     return connection._execute_clauseelement(
2023-08-29T20:20:06.071404199Z   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1637, in _execute_clauseelement
2023-08-29T20:20:06.071408267Z     ret = self._execute_context(
2023-08-29T20:20:06.071411713Z   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1846, in _execute_context
2023-08-29T20:20:06.071415580Z     return self._exec_single_context(
2023-08-29T20:20:06.071419057Z   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1987, in _exec_single_context
2023-08-29T20:20:06.071422964Z     self._handle_dbapi_exception(
2023-08-29T20:20:06.071426461Z   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 2344, in _handle_dbapi_exception
2023-08-29T20:20:06.071430889Z     raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
2023-08-29T20:20:06.071435437Z   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1968, in _exec_single_context
2023-08-29T20:20:06.071439866Z     self.dialect.do_execute(
2023-08-29T20:20:06.071444284Z   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/default.py", line 920, in do_execute
2023-08-29T20:20:06.071448742Z     cursor.execute(statement, parameters)
2023-08-29T20:20:06.071628637Z sqlalchemy.exc.IntegrityError: (raised as a result of Query-invoked autoflush; consider using a session.no_autoflush block if this flush is occurring prematurely)
2023-08-29T20:20:06.071638095Z (sqlite3.IntegrityError) UNIQUE constraint failed: permission.name
2023-08-29T20:20:06.071642253Z [SQL: INSERT INTO permission (name) VALUES (?)]
2023-08-29T20:20:06.071645950Z [parameters: ('view:package',)]
2023-08-29T20:20:06.071649747Z (Background on this error at: https://sqlalche.me/e/20/gkpj)
2023-08-29T20:20:06.071653313Z [2023-08-29 20:20:06 +0000] [10] [INFO] Worker exiting (pid: 10)
2023-08-29T20:20:06.071656970Z [2023-08-29 20:20:06 +0000] [9] [INFO] Worker exiting (pid: 9)
2023-08-29T20:20:06.077743716Z Creating permission: view:package
2023-08-29T20:20:06.424042727Z Traceback (most recent call last):
2023-08-29T20:20:06.424719871Z   File "/usr/local/lib/python3.9/site-packages/gunicorn/arbiter.py", line 209, in run
2023-08-29T20:20:06.425739015Z   File "/usr/local/lib/python3.9/site-packages/gunicorn/arbiter.py", line 357, in sleep
2023-08-29T20:20:06.431195875Z     ready = select.select([self.PIPE[0]], [], [], 1.0)
2023-08-29T20:20:06.431213478Z   File "/usr/local/lib/python3.9/site-packages/gunicorn/arbiter.py", line 242, in handle_chld
2023-08-29T20:20:06.431218387Z     self.reap_workers()
2023-08-29T20:20:06.431221624Z   File "/usr/local/lib/python3.9/site-packages/gunicorn/arbiter.py", line 525, in reap_workers
2023-08-29T20:20:06.431225300Z     raise HaltServer(reason, self.WORKER_BOOT_ERROR)
2023-08-29T20:20:06.431228606Z gunicorn.errors.HaltServer: <HaltServer 'Worker failed to boot.' 3>
2023-08-29T20:20:06.431242142Z 
2023-08-29T20:20:06.431245518Z During handling of the above exception, another exception occurred:
2023-08-29T20:20:06.431248894Z 
2023-08-29T20:20:06.431252050Z Traceback (most recent call last):
2023-08-29T20:20:06.431255396Z   File "/usr/local/bin/gunicorn", line 8, in <module>
2023-08-29T20:20:06.431259544Z     sys.exit(run())
2023-08-29T20:20:06.431263201Z   File "/usr/local/lib/python3.9/site-packages/gunicorn/app/wsgiapp.py", line 67, in run
2023-08-29T20:20:06.431266888Z     WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]").run()
2023-08-29T20:20:06.431270575Z   File "/usr/local/lib/python3.9/site-packages/gunicorn/app/base.py", line 231, in run
2023-08-29T20:20:06.431274101Z     super().run()
2023-08-29T20:20:06.431277327Z   File "/usr/local/lib/python3.9/site-packages/gunicorn/app/base.py", line 72, in run
2023-08-29T20:20:06.431280864Z     Arbiter(self).run()
2023-08-29T20:20:06.431284040Z   File "/usr/local/lib/python3.9/site-packages/gunicorn/arbiter.py", line 229, in run
2023-08-29T20:20:06.431287547Z     self.halt(reason=inst.reason, exit_status=inst.exit_status)
2023-08-29T20:20:06.431291033Z   File "/usr/local/lib/python3.9/site-packages/gunicorn/arbiter.py", line 342, in halt
2023-08-29T20:20:06.431294630Z     self.stop()
2023-08-29T20:20:06.431297866Z   File "/usr/local/lib/python3.9/site-packages/gunicorn/arbiter.py", line 393, in stop
2023-08-29T20:20:06.431301382Z     time.sleep(0.1)
2023-08-29T20:20:06.431304468Z   File "/usr/local/lib/python3.9/site-packages/gunicorn/arbiter.py", line 242, in handle_chld
2023-08-29T20:20:06.431308365Z     self.reap_workers()
2023-08-29T20:20:06.431311591Z   File "/usr/local/lib/python3.9/site-packages/gunicorn/arbiter.py", line 525, in reap_workers
2023-08-29T20:20:06.431315940Z     raise HaltServer(reason, self.WORKER_BOOT_ERROR)
2023-08-29T20:20:06.431319095Z gunicorn.errors.HaltServer: <HaltServer 'Worker failed to boot.' 3>

General Information:

Additional context My experience with python is limited. Tried playing with a private fork without much success. Sometimes refreshing the webpage the site will load, but not found a consistent pattern or solution.

thilojaeggi commented 10 months ago

Have weirdly noticed this as well recently, if you restart it it may fix it. Will definitely look into it though.

bewster commented 10 months ago

Cool, if you are seeing/replication the issue - this can sometimes be the hardest thing.

I will next look to attaching our an existing [persistent] database and evaluate 0.0.3 features.

Keep up the good work.

thilojaeggi commented 8 months ago

This should be solved in v0.0.04, could you try again?