Hi there!

After my initial problem I tried to upgrade redash from v8 to v10 and followed this instruction very carefully. But since that I can’t login to redash anymore … If I open localhost:8888/login I get a “500 Internal Server Error” with the following response:

server_1            | [2021-11-27 11:55:15,819][PID:12][ERROR][redash.app] Exception on /login [GET]
server_1            | Traceback (most recent call last):
server_1            |   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1249, in _execute_context
server_1            |     cursor, statement, parameters, context
server_1            |   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/default.py", line 580, in do_execute
server_1            |     cursor.execute(statement, parameters)
server_1            | psycopg2.errors.UndefinedTable: relation "organizations" does not exist
server_1            | LINE 2: FROM organizations
server_1            |              ^
server_1            |
server_1            |
server_1            | The above exception was the direct cause of the following exception:
server_1            |
server_1            | Traceback (most recent call last):
server_1            |   File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 2446, in wsgi_app
server_1            |     response = self.full_dispatch_request()
server_1            |   File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1951, in full_dispatch_request
server_1            |     rv = self.handle_user_exception(e)
server_1            |   File "/usr/local/lib/python3.7/site-packages/flask_restful/__init__.py", line 269, in error_router
server_1            |     return original_handler(e)
server_1            |   File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1820, in handle_user_exception
server_1            |     reraise(exc_type, exc_value, tb)
server_1            |   File "/usr/local/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise
server_1            |     raise value
server_1            |   File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1949, in full_dispatch_request
server_1            |     rv = self.dispatch_request()
server_1            |   File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1935, in dispatch_request
server_1            |     return self.view_functions[rule.endpoint](**req.view_args)
server_1            |   File "/usr/local/lib/python3.7/site-packages/flask_limiter/extension.py", line 442, in __inner
server_1            |     return obj(*a, **k)
server_1            |   File "/app/redash/handlers/authentication.py", line 190, in login
server_1            |     if current_org == None and not settings.MULTI_ORG:
server_1            |   File "/usr/local/lib/python3.7/site-packages/werkzeug/local.py", line 370, in <lambda>
server_1            |     __eq__ = lambda x, o: x._get_current_object() == o
server_1            |   File "/usr/local/lib/python3.7/site-packages/werkzeug/local.py", line 307, in _get_current_object
server_1            |     return self.__local()
server_1            |   File "/app/redash/authentication/org_resolving.py", line 18, in _get_current_org
server_1            |     g.org = Organization.get_by_slug(slug)
server_1            |   File "/app/redash/models/organizations.py", line 31, in get_by_slug
server_1            |     return cls.query.filter(cls.slug == slug).first()
server_1            |   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/orm/query.py", line 3240, in first
server_1            |     ret = list(self[0:1])
server_1            |   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/orm/query.py", line 3018, in __getitem__server_1            |     return list(res)
server_1            |   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/orm/query.py", line 3342, in __iter__
server_1            |     return self._execute_and_instances(context)
server_1            |   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/orm/query.py", line 3367, in _execute_and_instances
server_1            |     result = conn.execute(querycontext.statement, self._params)
server_1            |   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 988, in execute
server_1            |     return meth(self, multiparams, params)
server_1            |   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/sql/elements.py", line 287, in _execute_on_connection
server_1            |     return connection._execute_clauseelement(self, multiparams, params)
server_1            |   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1107, in _execute_clauseelement
server_1            |     distilled_params,
server_1            |   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1253, in _execute_context
server_1            |     e, statement, parameters, cursor, context
server_1            |   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1473, in _handle_dbapi_exception
server_1            |     util.raise_from_cause(sqlalchemy_exception, exc_info)
server_1            |   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/util/compat.py", line 398, in raise_from_cause
server_1            |     reraise(type(exception), exception, tb=exc_tb, cause=cause)
server_1            |   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/util/compat.py", line 152, in reraise
server_1            |     raise value.with_traceback(tb)
server_1            |   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1249, in _execute_context
server_1            |     cursor, statement, parameters, context
server_1            |   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/default.py", line 580, in do_execute
server_1            |     cursor.execute(statement, parameters)
server_1            | sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation "organizations" does not exist
server_1            | LINE 2: FROM organizations
server_1            |              ^
server_1            |
server_1            | [SQL: SELECT organizations.updated_at AS organizations_updated_at, organizations.created_at AS organizations_created_at, organizations.id AS organizations_id, organizations.name AS organizations_name, organizations.slug AS organizations_slug, organizations.settings AS organizations_settings
server_1            | FROM organizations
server_1            | WHERE organizations.slug = %(slug_1)s
server_1            |  LIMIT %(param_1)s]
server_1            | [parameters: {'slug_1': 'default', 'param_1': 1}]
server_1            | (Background on this error at: http://sqlalche.me/e/f405)
server_1            | [2021-11-27 11:55:15,824][PID:12][INFO][metrics] method=GET path=/login endpoint=redash_login status=500 content_type=text/html content_length=290 duration=99.49 query_count=0 query_duration=0.00
server_1            | [2021-11-27 11:55:15,826][PID:12][INFO][metrics] method=GET path=/login endpoint=redash_login status=500 content_type=? content_length=-1 duration=101.18 query_count=0 query_duration=0.00
nginx_1             | 172.18.0.1 - - [27/Nov/2021:11:55:15 +0000] "GET /login?next=http%3A%2F%2Flocalhost%3A8888%2Ffavicon.ico HTTP/1.1" 500 290 "http://localhost:8888/login" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36" "-"

This is my docker-compose.yml:

version: "2"
x-redash-service: &redash-service
  image: redash/redash:10.0.0.b50363
  depends_on:
    - postgres
    - redis
  env_file: G:\redash\.env
  restart: always
services:
  server:
    <<: *redash-service
    command: server
    ports:
      - "5000:5000"
    environment:
      REDASH_WEB_WORKERS: 4
  scheduler:
    <<: *redash-service
    command: scheduler
  scheduled_worker:
    <<: *redash-service
    command: worker
    environment:
      QUEUES: "scheduled_queries,schemas"
      WORKERS_COUNT: 1
  adhoc_worker:
    <<: *redash-service
    command: worker
    environment:
      QUEUES: "queries"
      WORKERS_COUNT: 2
  worker:
    <<: *redash-service
    command: worker
    environment:
      QUEUES: "periodic emails default"
      WORKERS_COUNT: 1      
  redis:
    image: redis:5.0-alpine
    restart: always
  postgres:
    image: postgres:9.6-alpine
    env_file: G:\redash\.env
    volumes:
      - /opt/redash/postgres-data:/var/lib/postgresql/data
    restart: always
  nginx:
    image: redash/nginx:latest
    ports:
      - "8888:80"
    depends_on:
      - server
    links:
      - server:redash
    restart: always

What am I doing wrong? I really appreciate your help! Thanks

I’ll try to provide more informations. Feel free to ask for more information if I missing something out:

Browser/OS: Google Chrome/ Windows 10

image

Thanks for your detailed description.

That error usually means that your database hasn’t been initialised. You can initialise it with docker-compose run --rm server create_db. That command is part of the instructions for a fresh installation. It’s weird that it seems necessary during an upgrade.

Are you running the development setup? Did you happen to run docker-compose down during the upgrade? Did you back-up your database before you began?

2 Likes

Thank you very much jesse for your answer. Your suggestion helped, I needed to initialise my database. As I recall I couldnt back-up my database correctly (?) but I didnt run docker-compose down during the upgrade (I didnt run the development setup either). But I’m glad that it works now.

There is but one thing: If I stop my docker container ( docker-compose stop ) und restart my computer, I need to initialise again my database in order to access redash(?). This comes only If I restart/shutdown my computer. If I stop the containter and I restart the containter again, I can access redash by my credentials. Do I need to save my intialised database somehow before shuting down my pc?

What you’re describing is not normal behavior. It sounds like you configured Redash to save its database to a temporary folder that is deleted whenever you restart. This is not suitable for production use.

How exactly did you install Redash? Your compose file appears to be borrowed from the cloud AMI. But you’re running it on your local computer? Notice that the postgres service defines a mapped volume where all the data will be stored. Does this map to a real location on your local computer?

Thanks for asking: Yes, I’m running redash local from my computer, just to get in touch with the mechanics. For that I used this docker-compose.yml here and I modified it. But you’re absolutely right: The location of volume does not match with my local computer. Do you have any suggestions to modify the docker-compose.yml further to make it suitable for a local running?

I think for this you should follow the well-defined process for running Redash locally: https://redash.io/help/open-source/dev-guide/docker

1 Like

Appreciated, thank you very much. I will try it out!