moloch-- / RootTheBox

A Game of Hackers (CTF Scoreboard & Game Manager)
http://root-the-box.com/
Apache License 2.0
915 stars 292 forks source link

Breaking change: failed to start on latest update? #532

Closed PJNorrisS1 closed 1 year ago

PJNorrisS1 commented 1 year ago

I think there is an sql update that has caused a fatal error. In the logs I see:

rtb-uk1-webapp-1     | [*] 20:08:48 : Creating the database ...
rtb-uk1-webapp-1     | /opt/rtb/models/Theme.py:80: SAWarning: User-placed attribute <property object at 0x7eff1c961b80> on Mapper[Box(box)] being replaced with new property "Box.game_level"; the old attribute will be discarded (This warning originated from the `configure_mappers()` process, which was invoked automatically in response to a user-initiated operation.)
rtb-uk1-webapp-1     |   return dbsession.query(cls).all()
rtb-uk1-webapp-1     | /opt/rtb/models/Theme.py:80: SAWarning: User-placed attribute <property object at 0x7eff1c961b30> on Mapper[Box(box)] being replaced with new property "Box.corporation"; the old attribute will be discarded (This warning originated from the `configure_mappers()` process, which was invoked automatically in response to a user-initiated operation.)
rtb-uk1-webapp-1     |   return dbsession.query(cls).all()
rtb-uk1-webapp-1     | /opt/rtb/models/Theme.py:80: SAWarning: User-placed attribute <property object at 0x7eff1c961bd0> on Mapper[Box(box)] being replaced with new property "Box.category"; the old attribute will be discarded (This warning originated from the `configure_mappers()` process, which was invoked automatically in response to a user-initiated operation.)
rtb-uk1-webapp-1     |   return dbsession.query(cls).all()
rtb-uk1-webapp-1     | /opt/rtb/models/Theme.py:80: SAWarning: User-placed attribute <property object at 0x7eff1c841ea0> on Mapper[Flag(flag)] being replaced with new property "Flag.box"; the old attribute will be discarded (This warning originated from the `configure_mappers()` process, which was invoked automatically in response to a user-initiated operation.)
rtb-uk1-webapp-1     |   return dbsession.query(cls).all()
rtb-uk1-webapp-1     | /opt/rtb/models/Theme.py:80: SAWarning: User-placed attribute <property object at 0x7eff1c813720> on Mapper[Hint(hint)] being replaced with new property "Hint.flag"; the old attribute will be discarded (This warning originated from the `configure_mappers()` process, which was invoked automatically in response to a user-initiated operation.)
rtb-uk1-webapp-1     |   return dbsession.query(cls).all()
rtb-uk1-webapp-1     | [I 230127 20:08:48 rootthebox:262] Environment Configuration (SQL_DIALECT): sqlite
rtb-uk1-webapp-1     | [E 230127 20:08:48 rootthebox:54] Error: autocommit=True is no longer supported

Under libs/BotManger.py line 121 has the autocommit statement. I changed that, ran build, but getting 404 glitch in matrix on the home page after login. image

eljeffeg commented 1 year ago

I think version 1.4.24 of sqlalchemy fixed that. Can you run pip3 show sqlalchemy? Might need to update that package. I haven't tested sqlalchemy 2.x.

PJNorrisS1 commented 1 year ago

Hmm.....

root@b319fec8c736:/# pip3 show sqlalchemy
Name: SQLAlchemy
Version: 2.0.0
Summary: Database Abstraction Library
Home-page: https://www.sqlalchemy.org
Author: Mike Bayer
Author-email: mike_mp@zzzcomputing.com
License: MIT
Location: /usr/local/lib/python3.8/site-packages
Requires: greenlet, typing-extensions
Required-by: alembic
eljeffeg commented 1 year ago

Hmm, yeah - try to back that down to 1.4.47

PJNorrisS1 commented 1 year ago

Please could you give me a couple of pointers on how to do that? I'm running this in a docker container. Thank you

PJNorrisS1 commented 1 year ago

I assume I could edit the requirements.txt to put a version in there.

eljeffeg commented 1 year ago

This is sort of going off of memory

docker ps
docker exec -it {containeid} pip3 install sqlalchemy==1.4.47

Yeah or you could edit the requirements file to specify the version.

simon-hoegl commented 1 year ago

Just edit the setup/requirements.txt to use sqlalchemy==1.4.47 (i used 1.4.46 for testing) Edit: too slow.

I tried to fix the issues ocurring with SQLAlchemy 2.0.0. As im not to experienced with python nor SQLAlchemy (and their documentation could be a bit clearer) im not sure if this is fixed correctly or introduces some new problems. For me everything seems to work

See: https://github.com/simon-hoegl/RootTheBox/commit/51b94183783ad3e1384cca677c5cfae1f704e527

PJNorrisS1 commented 1 year ago

#0 5.857 ERROR: No matching distribution found for sqlalchemy==1.4.47

PJNorrisS1 commented 1 year ago

Looks like 1.4.46 was last 1.4 release. 2.0 came out yesterday!!!

PJNorrisS1 commented 1 year ago

Fixed. Adding 1.4.46 to the requirements resolved that. Will you change that on master, as that's a breaking change since 2.0 came out yesterday? Thanks for the speedy response as always.

eljeffeg commented 1 year ago

Done - thanks for the report