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

Error by using docker image 0.8.13 #681

Closed
DavidHenryThoreau opened this issue Jan 10, 2025 · 4 comments
Closed

Error by using docker image 0.8.13 #681

DavidHenryThoreau opened this issue Jan 10, 2025 · 4 comments
Labels

Comments

@DavidHenryThoreau
Copy link
Contributor

I've got that error (i'm using docker image 0.8.13)

$ docker logs fittrackee 
The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/opt/venv/lib/python3.13/site-packages/flask/app.py", line 1511, in wsgi_app
    response = self.full_dispatch_request()
  File "/opt/venv/lib/python3.13/site-packages/flask/app.py", line 919, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/opt/venv/lib/python3.13/site-packages/flask/app.py", line 917, in full_dispatch_request
    rv = self.dispatch_request()
  File "/opt/venv/lib/python3.13/site-packages/flask/app.py", line 902, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)  # type: ignore[no-any-return]
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/usr/src/app/fittrackee/application/app_config.py", line 67, in get_application_config
    config = AppConfig.query.one()
  File "/opt/venv/lib/python3.13/site-packages/sqlalchemy/orm/query.py", line 2870, in one
    return self._iter().one()
           ~~~~~~~~~~^^
  File "/opt/venv/lib/python3.13/site-packages/sqlalchemy/orm/query.py", line 2916, in _iter
    result = self.session.execute(
        statement,
        params,
        execution_options={"_sa_orm_load_options": self.load_options},
    )
  File "/opt/venv/lib/python3.13/site-packages/sqlalchemy/orm/session.py", line 1717, in execute
    result = conn._execute_20(statement, params or {}, execution_options)
  File "/opt/venv/lib/python3.13/site-packages/sqlalchemy/engine/base.py", line 1710, in _execute_20
    return meth(self, args_10style, kwargs_10style, execution_options)
  File "/opt/venv/lib/python3.13/site-packages/sqlalchemy/sql/elements.py", line 334, in _execute_on_connection
    return connection._execute_clauseelement(
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        self, multiparams, params, execution_options
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/opt/venv/lib/python3.13/site-packages/sqlalchemy/engine/base.py", line 1577, in _execute_clauseelement
    ret = self._execute_context(
        dialect,
    ...<8 lines>...
        cache_hit=cache_hit,
    )
  File "/opt/venv/lib/python3.13/site-packages/sqlalchemy/engine/base.py", line 1953, in _execute_context
    self._handle_dbapi_exception(
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        e, statement, parameters, cursor, context
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/opt/venv/lib/python3.13/site-packages/sqlalchemy/engine/base.py", line 2134, in _handle_dbapi_exception
    util.raise_(
    ~~~~~~~~~~~^
        sqlalchemy_exception, with_traceback=exc_info[2], from_=e
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/opt/venv/lib/python3.13/site-packages/sqlalchemy/util/compat.py", line 211, in raise_
    raise exception
  File "/opt/venv/lib/python3.13/site-packages/sqlalchemy/engine/base.py", line 1910, in _execute_context
    self.dialect.do_execute(
    ~~~~~~~~~~~~~~~~~~~~~~~^
        cursor, statement, parameters, context
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/opt/venv/lib/python3.13/site-packages/sqlalchemy/engine/default.py", line 736, in do_execute
    cursor.execute(statement, parameters)
    ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
sqlalchemy.exc.OperationalError: (psycopg2.OperationalError) server closed the connection unexpectedly
        This probably means the server terminated abnormally
        before or while processing the request.

[SQL: SELECT app_config.id AS app_config_id, app_config.max_users AS app_config_max_users, app_config.gpx_limit_import AS app_config_gpx_limit_import, app_config.max_single_file_size AS app_config_max_single_file_size, app_config.max_zip_file_size AS app_config_max_zip_file_size, app_config.admin_contact AS app_config_admin_contact, app_config.privacy_policy_date AS app_config_privacy_policy_date, app_config.privacy_policy AS app_config_privacy_policy, app_config.about AS app_config_about, app_config.stats_workouts_limit AS app_config_stats_workouts_limit
FROM app_config]
(Background on this error at: https://sqlalche.me/e/14/e3q8)

@SamR1
Copy link
Owner

SamR1 commented Jan 11, 2025

Hi,

Is it possible to have the docker-compose.yml file?

@SamR1 SamR1 added the docker label Jan 11, 2025
@DavidHenryThoreau
Copy link
Contributor Author

  fittrackee:
    image: fittrackee/fittrackee:latest
    container_name: fittrackee
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Europe/Paris
      - FLASK_APP=fittrackee
      - FLASK_SKIP_DOTENV=1
      - APP_SECRET_KEY="MYPWD"
      - UPLOAD_FOLDER=/usr/src/app/uploads
      - DATABASE_URL=postgresql://fittrackee:fittrackee@fittrackee-db:5432/fittrackee
    user: 1000:1000
    volumes:
      - ./fittrackee-config/upload:/usr/src/app/uploads/uploads/
      - ./fittrackee-config/logs:/usr/src/app/logs
    ports:
      - 127.0.0.1:5000:5000
    depends_on:
      fittrackee-db:
        condition: service_started
    command: sh docker-entrypoint.sh
    restart: unless-stopped

  fittrackee-db:
    image: postgres:17-alpine
    container_name: fittrackee-db
    environment:
      - PUID=70
      - PGID=70
      - TZ=Europe/Paris
      - POSTGRES_USER=fittrackee
      - POSTGRES_PASSWORD=fittrackee
      - POSTGRES_DB=fittrackee
    volumes:
      - ./fittrackee-config/fittrackee-db:/var/lib/postgresql/data
    ports:
      - 127.0.0.1:5432:5432
    restart: unless-stopped

Another things, in the /statistics for this week, i've got workouts from monday to yesterday and some workouts are set to the next week (13/01/2025)

@SamR1
Copy link
Owner

SamR1 commented Jan 11, 2025

I didn't reproduce this issue with the docker-compose.yml file (FitTrackee runs without error, I was able to add workouts).
I just had to add the following lines (not related with the issue, I think):

    services:
      fittrackee:
        image: fittrackee/fittrackee:latest
        container_name: fittrackee
        environment:
          - PUID=1000
          - PGID=1000
          - FLASK_APP=fittrackee
          - FLASK_SKIP_DOTENV=1
          - APP_SECRET_KEY="MYPWD"
          - UPLOAD_FOLDER=/usr/src/app/uploads
          - DATABASE_URL=postgresql://fittrackee:fittrackee@fittrackee-db:5432/fittrackee
        user: 1000:1000
        volumes:
          - ./fittrackee-config/upload:/usr/src/app/uploads/uploads/
          - ./fittrackee-config/logs:/usr/src/app/logs
        ports:
          - 127.0.0.1:5000:5000
        depends_on:
          fittrackee-db:
            condition: service_started
        command: sh docker-entrypoint.sh
        restart: unless-stopped
+       post_start:
+         - command: chown -R fittrackee:fittrackee /usr/src/app/uploads /usr/src/app/logs
+          user: root
    
      fittrackee-db:
        image: postgres:17-alpine
        container_name: fittrackee-db
        environment:
          - PUID=70
          - PGID=70
          - POSTGRES_USER=fittrackee
          - POSTGRES_PASSWORD=fittrackee
          - POSTGRES_DB=fittrackee
        volumes:
          - ./fittrackee-config/fittrackee-db:/var/lib/postgresql/data
        ports:
          - 127.0.0.1:5432:5432
        restart: unless-stopped

Docker and docker compose versions:

$ docker --version
Docker version 27.3.1, build ce1223035a
$ docker-compose --version
Docker Compose version 2.31.0

For the statistics, I reproduced the issue (not related to the Docker image), I will investigate further. Thanks for the report.

@DavidHenryThoreau
Copy link
Contributor Author

Seems to be corrected with latest 0.9.0 version 👍

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

No branches or pull requests

2 participants