Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker setup produces broken installation #124

Open
Nateowami opened this issue May 25, 2024 · 4 comments
Open

Docker setup produces broken installation #124

Nateowami opened this issue May 25, 2024 · 4 comments
Assignees

Comments

@Nateowami
Copy link

Nateowami commented May 25, 2024

I am attempting to follow the Docker quick start instructions at https://freetakteam.github.io/FreeTAKServer-User-Docs/Installation/mechanism/Docker/Quick_Start/

Based on my understanding of the instructions, I am running the following on Ubuntu 20.04:

git clone https://github.com/FreeTAKTeam/FreeTAKHub-Installation.git
cd FreeTAKHub-Installation/containers/
chmod -R 777 .
mv example-compose.yaml compose.yaml
docker compose up -d

And then navigating to localhost:500, I get the following error:

Traceback (most recent call last):
  File "/home/freetak/.local/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 2336, in _wrap_pool_connect
    return fn()
           ^^^^
  File "/home/freetak/.local/lib/python3.11/site-packages/sqlalchemy/pool/base.py", line 364, in connect
    return _ConnectionFairy._checkout(self)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/freetak/.local/lib/python3.11/site-packages/sqlalchemy/pool/base.py", line 778, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/freetak/.local/lib/python3.11/site-packages/sqlalchemy/pool/base.py", line 495, in checkout
    rec = pool._do_get()
          ^^^^^^^^^^^^^^
  File "/home/freetak/.local/lib/python3.11/site-packages/sqlalchemy/pool/impl.py", line 241, in _do_get
    return self._create_connection()
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/freetak/.local/lib/python3.11/site-packages/sqlalchemy/pool/base.py", line 309, in _create_connection
    return _ConnectionRecord(self)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/freetak/.local/lib/python3.11/site-packages/sqlalchemy/pool/base.py", line 440, in __init__
    self.__connect(first_connect_check=True)
  File "/home/freetak/.local/lib/python3.11/site-packages/sqlalchemy/pool/base.py", line 660, in __connect
    with util.safe_reraise():
  File "/home/freetak/.local/lib/python3.11/site-packages/sqlalchemy/util/langhelpers.py", line 68, in __exit__
    compat.raise_(
  File "/home/freetak/.local/lib/python3.11/site-packages/sqlalchemy/util/compat.py", line 182, in raise_
    raise exception
  File "/home/freetak/.local/lib/python3.11/site-packages/sqlalchemy/pool/base.py", line 656, in __connect
    connection = pool._invoke_creator(self)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/freetak/.local/lib/python3.11/site-packages/sqlalchemy/engine/strategies.py", line 114, in connect
    return dialect.connect(*cargs, **cparams)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/freetak/.local/lib/python3.11/site-packages/sqlalchemy/engine/default.py", line 508, in connect
    return self.dbapi.connect(*cargs, **cparams)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
sqlite3.OperationalError: unable to open database file

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

Traceback (most recent call last):
  File "/home/freetak/.local/lib/python3.11/site-packages/eventlet/wsgi.py", line 598, in handle_one_response
    result = self.application(self.environ, start_response)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/freetak/.local/lib/python3.11/site-packages/flask/app.py", line 2552, in __call__
    return self.wsgi_app(environ, start_response)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/freetak/.local/lib/python3.11/site-packages/flask/app.py", line 2532, in wsgi_app
    response = self.handle_exception(e)
               ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/freetak/.local/lib/python3.11/site-packages/flask_cors/extension.py", line 176, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
                                                ^^^^^^^^^^^^^^^^^^
  File "/home/freetak/.local/lib/python3.11/site-packages/flask/app.py", line 2529, in wsgi_app
    response = self.full_dispatch_request()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/freetak/.local/lib/python3.11/site-packages/flask/app.py", line 1815, in full_dispatch_request
    self.ensure_sync(func)()
  File "/home/freetak/.local/lib/python3.11/site-packages/FreeTAKServer-UI/app/__init__.py", line 33, in initialize_database
    db.create_all()
  File "/home/freetak/.local/lib/python3.11/site-packages/flask_sqlalchemy/__init__.py", line 1094, in create_all
    self._execute_for_all_tables(app, bind, 'create_all')
  File "/home/freetak/.local/lib/python3.11/site-packages/flask_sqlalchemy/__init__.py", line 1086, in _execute_for_all_tables
    op(bind=self.get_engine(app, bind), **extra)
  File "/home/freetak/.local/lib/python3.11/site-packages/sqlalchemy/sql/schema.py", line 4664, in create_all
    bind._run_visitor(
  File "/home/freetak/.local/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 2094, in _run_visitor
    with self._optional_conn_ctx_manager(connection) as conn:
  File "/usr/local/lib/python3.11/contextlib.py", line 137, in __enter__
    return next(self.gen)
           ^^^^^^^^^^^^^^
  File "/home/freetak/.local/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 2086, in _optional_conn_ctx_manager
    with self._contextual_connect() as conn:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/freetak/.local/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 2302, in _contextual_connect
    self._wrap_pool_connect(self.pool.connect, None),
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/freetak/.local/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 2339, in _wrap_pool_connect
    Connection._handle_dbapi_exception_noconnection(
  File "/home/freetak/.local/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1583, in _handle_dbapi_exception_noconnection
    util.raise_(
  File "/home/freetak/.local/lib/python3.11/site-packages/sqlalchemy/util/compat.py", line 182, in raise_
    raise exception
  File "/home/freetak/.local/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 2336, in _wrap_pool_connect
    return fn()
           ^^^^
  File "/home/freetak/.local/lib/python3.11/site-packages/sqlalchemy/pool/base.py", line 364, in connect
    return _ConnectionFairy._checkout(self)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/freetak/.local/lib/python3.11/site-packages/sqlalchemy/pool/base.py", line 778, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/freetak/.local/lib/python3.11/site-packages/sqlalchemy/pool/base.py", line 495, in checkout
    rec = pool._do_get()
          ^^^^^^^^^^^^^^
  File "/home/freetak/.local/lib/python3.11/site-packages/sqlalchemy/pool/impl.py", line 241, in _do_get
    return self._create_connection()
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/freetak/.local/lib/python3.11/site-packages/sqlalchemy/pool/base.py", line 309, in _create_connection
    return _ConnectionRecord(self)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/freetak/.local/lib/python3.11/site-packages/sqlalchemy/pool/base.py", line 440, in __init__
    self.__connect(first_connect_check=True)
  File "/home/freetak/.local/lib/python3.11/site-packages/sqlalchemy/pool/base.py", line 660, in __connect
    with util.safe_reraise():
  File "/home/freetak/.local/lib/python3.11/site-packages/sqlalchemy/util/langhelpers.py", line 68, in __exit__
    compat.raise_(
  File "/home/freetak/.local/lib/python3.11/site-packages/sqlalchemy/util/compat.py", line 182, in raise_
    raise exception
  File "/home/freetak/.local/lib/python3.11/site-packages/sqlalchemy/pool/base.py", line 656, in __connect
    connection = pool._invoke_creator(self)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/freetak/.local/lib/python3.11/site-packages/sqlalchemy/engine/strategies.py", line 114, in connect
    return dialect.connect(*cargs, **cparams)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/freetak/.local/lib/python3.11/site-packages/sqlalchemy/engine/default.py", line 508, in connect
    return self.dbapi.connect(*cargs, **cparams)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) unable to open database file
(Background on this error at: http://sqlalche.me/e/13/e3q8)
@ch08532
Copy link

ch08532 commented Aug 6, 2024

I have the same issue. Pulled example-compose.yml file from the repo and followed the instructions. Started the stack and hit the UI url and getting the errors.

freetakserver-1       | Running headless-mode config file generation for containers.
freetakserver-1       | All options will be set to default.
free-tak-server-ui-1  | (8) wsgi starting up on http://172.19.0.2:5000                                                                                                                                                                               
freetakserver-1       | Cannot find CA file locally so generating one
freetakserver-1       | Generating Key...
freetakserver-1       | Generating Key...                                                                                                                                                                                                            
freetakserver-1       | /home/freetak/FreeTAKServer/components/extended/mission/controllers/mission_persistence_controller.py:91: SAWarning: Object of type <RolePermission> not in session, add operation along 'Permission.roles' will not proceed (This warning originated from the Session 'autoflush' process, which was invoked automatically in response to a user-initiated operation.)
freetakserver-1       |   return self.ses.query(Permission).filter(Permission.permission_type == permission_type).first() # type: ignore
freetakserver-1       | /home/freetak/FreeTAKServer/components/extended/mission/controllers/mission_persistence_controller.py:294: SAWarning: Object of type <MissionChange> not in session, add operation along 'Mission.changes' will not proceed (This warning originated from the Session 'autoflush' process, which was invoked automatically in response to a user-initiated operation.)
freetakserver-1       |   mission_content: MissionContent = self.ses.query(MissionContent).filter(MissionContent.PrimaryKey == id).first() # type: ignore
freetakserver-1       | failed to register component: /home/freetak/.local/lib/python3.11/site-packages/digitalpy/core/util, with error: No module named 'Catalog'                                                                                   
freetakserver-1       | failed to register component: /home/freetak/.local/lib/python3.11/site-packages/digitalpy/core/translation, with error: No module named 'Catalog'
freetakserver-1       | failed to register component: /home/freetak/.local/lib/python3.11/site-packages/digitalpy/core/health, with error: No module named 'Catalog'                                                                                 
freetakserver-1       | failed to register component: /home/freetak/.local/lib/python3.11/site-packages/digitalpy/core/zmanager, with error: No module named 'Catalog'                                                                               
freetakserver-1       | failed to register component: /home/freetak/.local/lib/python3.11/site-packages/digitalpy/core/network, with error: name 'Facade' is not defined                                                                             
freetakserver-1       | failed to register component: /home/freetak/.local/lib/python3.11/site-packages/digitalpy/core/logic, with error: No module named 'Catalog'
freetakserver-1       | failed to register component: /home/freetak/.local/lib/python3.11/site-packages/digitalpy/core/queries, with error: No module named 'Catalog'                                                                                
freetakserver-1       | failed to register component: /home/freetak/.local/lib/python3.11/site-packages/digitalpy/core/cot_management, with error: inconsistent use of tabs and spaces in indentation (cot_management_facade.py, line 21)            
freetakserver-1       | failed to register component: /home/freetak/.local/lib/python3.11/site-packages/digitalpy/core/component_management, with error: module 'digitalpy.core.component_management.component_management_facade' has no attribute 'ComponentManagement'                                                                                                                                                                                                                                  
freetakserver-1       | failed to register component: /home/freetak/.local/lib/python3.11/site-packages/digitalpy/core/telemetry, with error: No module named 'Catalog'
freetakserver-1       | failed to register component: /home/freetak/.local/lib/python3.11/site-packages/digitalpy/core/persistence, with error: module 'digitalpy.core.persistence.persistence_facade' has no attribute 'Persistence'                
freetakserver-1       | failed to register component: /home/freetak/FreeTAKServer/core/domain, with error: module 'FreeTAKServer.core.domain.domain_facade' has no attribute 'Domain'                                                                
freetakserver-1       | failed to register component: /home/freetak/FreeTAKServer/core/fts_core, with error: module 'FreeTAKServer.core.fts_core.fts_core_facade' has no attribute 'FtsCore'                                                         
freetakserver-1       | failed to register component: /home/freetak/FreeTAKServer/core/fts_configuration, with error: module 'FreeTAKServer.core.fts_configuration.fts_configuration_facade' has no attribute 'FtsConfiguration'
freetakserver-1       | failed to register component: /home/freetak/FreeTAKServer/components/extended/track_manager, with error: module 'FreeTAKServer.components.extended.track_manager.track_manager_facade' has no attribute 'TrackManager'       
freetakserver-1       | failed to register component: /home/freetak/FreeTAKServer/components/extended/federation, with error: module 'FreeTAKServer.components.extended.federation.federation_facade' has no attribute 'Federation'                  
freetakserver-1       | failed to register component: /home/freetak/FreeTAKServer/components/extended/report, with error: module 'FreeTAKServer.components.extended.report.report_facade' has no attribute 'Report'                                  
freetakserver-1       | executing method put_mission
freetakserver-1       | failed to register component: /home/freetak/FreeTAKServer/components/extended/master_parrot, with error: module 'FreeTAKServer.components.extended.master_parrot.master_parrot_facade' has no attribute 'MasterParrot'       
freetakserver-1       | failed to register component: /home/freetak/FreeTAKServer/components/extended/cotmanager, with error: module 'FreeTAKServer.components.extended.cotmanager.cotmanager_facade' has no attribute 'Cotmanager'                  
freetakserver-1       | failed to register component: /home/freetak/FreeTAKServer/components/extended/repeater, with error: module 'FreeTAKServer.components.extended.repeater.repeater_facade' has no attribute 'Repeater'                          
freetakserver-1       | failed to register component: /home/freetak/FreeTAKServer/components/extended/companion_parrot, with error: module 'FreeTAKServer.components.extended.companion_parrot.companion_parrot_facade' has no attribute 'CompanionParrot'                                                                                                                                                                                                                                                
freetakserver-1       | starting now
freetakserver-1       | (52) wsgi starting up on http://0.0.0.0:8080
freetakserver-1       | starting SSL now
freetakserver-1       | (59) wsgi starting up on https://0.0.0.0:8443
freetakserver-1       | CoT Service Started
freetakserver-1       | CoTService started
freetakserver-1       | (52) accepted ('172.19.0.1', 33594)
freetakserver-1       | (52) accepted ('172.19.0.1', 33604)
freetakserver-1       | 172.19.0.1 - - [06/Aug/2024 17:31:51] "GET / HTTP/1.1" 200 183 0.002715                                                                                                                                                      
freetakserver-1       | 172.19.0.1 - - [06/Aug/2024 17:31:51] "GET /favicon.ico HTTP/1.1" 404 387 0.001096
free-tak-server-ui-1  | (8) accepted ('172.19.0.1', 44686)
free-tak-server-ui-1  | (8) accepted ('172.19.0.1', 44696)
free-tak-server-ui-1  | Traceback (most recent call last):                                                                                                                                                                                           
free-tak-server-ui-1  |   File "/home/freetak/.local/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 2336, in _wrap_pool_connect                                                                                                       
free-tak-server-ui-1  |     return fn()
free-tak-server-ui-1  |            ^^^^                                                                                                                                                                                                              
free-tak-server-ui-1  |   File "/home/freetak/.local/lib/python3.11/site-packages/sqlalchemy/pool/base.py", line 364, in connect                                                                                                                     
free-tak-server-ui-1  |     return _ConnectionFairy._checkout(self)                                                                                                                                                                                  
free-tak-server-ui-1  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                                                                  
free-tak-server-ui-1  |   File "/home/freetak/.local/lib/python3.11/site-packages/sqlalchemy/pool/base.py", line 778, in _checkout
free-tak-server-ui-1  |     fairy = _ConnectionRecord.checkout(pool)                                                                                                                                                                                 
free-tak-server-ui-1  |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                                                                 
free-tak-server-ui-1  |   File "/home/freetak/.local/lib/python3.11/site-packages/sqlalchemy/pool/base.py", line 495, in checkout                                                                                                                    
free-tak-server-ui-1  |     rec = pool._do_get()
free-tak-server-ui-1  |           ^^^^^^^^^^^^^^                                                                                                                                                                                                     
free-tak-server-ui-1  |   File "/home/freetak/.local/lib/python3.11/site-packages/sqlalchemy/pool/impl.py", line 241, in _do_get                                                                                                                     
free-tak-server-ui-1  |     return self._create_connection()
free-tak-server-ui-1  |            ^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                                                                         
free-tak-server-ui-1  |   File "/home/freetak/.local/lib/python3.11/site-packages/sqlalchemy/pool/base.py", line 309, in _create_connection                                                                                                          
free-tak-server-ui-1  |     return _ConnectionRecord(self)                                                                                                                                                                                           
free-tak-server-ui-1  |            ^^^^^^^^^^^^^^^^^^^^^^^
free-tak-server-ui-1  |   File "/home/freetak/.local/lib/python3.11/site-packages/sqlalchemy/pool/base.py", line 440, in __init__                                                                                                                    
free-tak-server-ui-1  |     self.__connect(first_connect_check=True)                                                                                                                                                                                 
free-tak-server-ui-1  |   File "/home/freetak/.local/lib/python3.11/site-packages/sqlalchemy/pool/base.py", line 660, in __connect                                                                                                                   
free-tak-server-ui-1  |     with util.safe_reraise():
free-tak-server-ui-1  |   File "/home/freetak/.local/lib/python3.11/site-packages/sqlalchemy/util/langhelpers.py", line 68, in __exit__                                                                                                              
free-tak-server-ui-1  |     compat.raise_(                                                                                                                                                                                                           
free-tak-server-ui-1  |   File "/home/freetak/.local/lib/python3.11/site-packages/sqlalchemy/util/compat.py", line 182, in raise_                                                                                                                    
free-tak-server-ui-1  |     raise exception
free-tak-server-ui-1  |   File "/home/freetak/.local/lib/python3.11/site-packages/sqlalchemy/pool/base.py", line 656, in __connect                                                                                                                   
free-tak-server-ui-1  |     connection = pool._invoke_creator(self)                                                                                                                                                                                  
free-tak-server-ui-1  |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                                                                  
free-tak-server-ui-1  |   File "/home/freetak/.local/lib/python3.11/site-packages/sqlalchemy/engine/strategies.py", line 114, in connect
free-tak-server-ui-1  |     return dialect.connect(*cargs, **cparams)                                                                                                                                                                                
free-tak-server-ui-1  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                                                                
free-tak-server-ui-1  |   File "/home/freetak/.local/lib/python3.11/site-packages/sqlalchemy/engine/default.py", line 508, in connect                                                                                                                
free-tak-server-ui-1  |     return self.dbapi.connect(*cargs, **cparams)

@NicodeSS
Copy link

Same issue too. The ui container has no migrated default flask sqlite3 database. Manual migrating is not working. Maybe we need to copy a default database file from a non-docker installation.

@RadioAndrea
Copy link
Contributor

Same issue too. The ui container has no migrated default flask sqlite3 database. Manual migrating is not working. Maybe we need to copy a default database file from a non-docker installation.

If you use the latest docker via compose file provided, you should not have any issues.

In the worst case you should be able to simply touch the needed file at the proper location.

@NicodeSS
Copy link

Same issue too. The ui container has no migrated default flask sqlite3 database. Manual migrating is not working. Maybe we need to copy a default database file from a non-docker installation.

If you use the latest docker via compose file provided, you should not have any issues.

In the worst case you should be able to simply touch the needed file at the proper location.

I did considered the possibility that the image might be outdated, but when I tried "docker compose pull", using image "ghcr.io/freetakteam/ui:latest", it is convinced that my image is already the latest. And there is still no db file.

Besides, in my volume, the version of socket.io js file is still 1.4.5, causing a api fetch error.

Due to the fact that the code in "UI" repository has merged the socket.io version fix for quite a while. And I used no cdn when pulling the docker image. From my perspective, it seems more like the image on the ghcr.io server is outdated.

Touch a db file is useless - you have no user table. Flask will remain crash still. I tried create a table as the schema in the migration folder. But it's fake. I had no choice but created a vps and copied a db file, and got a different user table schema.

Furthermore, why the UI container use the code in .local/python3.x/site-packages when the ui project code is already in the home root directory?What a confusing structure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants