Issue Summary

A summary of the issue and the browser/OS environment in which it occurs.

Technical details:

  • Redash Version:7.0.0+b18042
  • Browser/OS:chrome/
  • How did you install Redash: using docker image

I am new to docker containers and trying this redash installation on our AWS account for testing.
The redash stack is deployed successfully but the workerservers on ecs shows below error
ProgrammingError: (psycopg2.ProgrammingError) relation “queries” does not exist

But when i logging to the RDS postgres database manually i could query this table

export REDASH_DATABASE_URL=“postgresql://svc_redash:password@reddish.xxxxxxxxx.rds.amazonaws.com/redash”
export REDASH_REDIS_URL=“redis://redis.xxxxxxx.us-west-2.dev.23andme.net:6379/0”

docker images -a
docker run -it 9f858f446630 bash
bin/run ./manage.py check_settings
bin/run ./manage.py database create_tables

I have performed the above to create the tables

Before that i have created the user on the postgres database

create user svc_redash with password ‘xxxxxxxx’
grant all privileges on database postgres to svc_redash;
grant all privileges on database redash to svc_redash;
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO svc_redash;

what i am i doing wrong or missing something in the setup?Please help.

1 Like

Are you sure all your containers use the same REDASH_DATABASE_URL setting? When manually checking the DB were you logged in with the same svc_redash user and using the redash database?

Can you also share more details on how you’re executing your containers? Is it using ECS services? Can you share the task definition you’re using?

Thanks for the reply @arikfr.
I did not find any .env file on the docker container and thats why i logged into the container and by setting the variable REDASH_DATABASE_URL manually created the tables.

How can we set this variables for the container and for existing containers how can i find the value of these variables?

Yes we are using ECS.

this is the dockerfile we are using.

cat Dockerfile
ARG THIS_REDASH_VERSION=latest
FROM redash/redash:${THIS_REDASH_VERSION}

Have to do this again as it goes “out of scope” above

ARG THIS_REDASH_VERSION=latest
ENV THIS_REDASH_VERSION=${THIS_REDASH_VERSION}

Set to root and install stuff

USER root
RUN pip install credstash cx_Oracle
RUN apt-get update &&
apt-get install libaio1 &&
apt-get clean && rm -rf /var/lib/apt/lists/*

COPY oracle-patch-v5.0.2 /tmp/oracle-patch-v5.0.2
RUN patch -p1 < /tmp/oracle-patch-v5.0.2
COPY admin-patch /tmp/admin-patch
RUN patch -p1 < /tmp/admin-patch

ARG ORACLE_VERSION=unknown-oracle
ENV ORACLE_VERSION={ORACLE_VERSION} COPY {ORACLE_VERSION} /opt/oracle/{ORACLE_VERSION}/ RUN echo /opt/oracle/{ORACLE_VERSION} > /etc/ld.so.conf.d/oracle-instantclient.conf && ldconfig
ENV TNS_ADMIN=/opt/oracle/{ORACLE_VERSION}/network/admin RUN chown redash:redash {TNS_ADMIN}

Now set things up for our custom launch

COPY entrypoint /entrypoint

Put back the user

USER redash

ENTRYPOINT ["/entrypoint"]

At the end since this changes with every build (almost)

ARG TTAM_VERSION=latest
ENV TTAM_VERSION=${TTAM_VERSION}

build-container:
[ -z “$(ORACLE_VERSION)” ] && echo “You must set $$ORACLE_VERSION” && exit 1;
docker build --build-arg THIS_REDASH_VERSION=(THIS_REDASH_VERSION) --build-arg ORACLE_VERSION=(ORACLE_VERSION) --build-arg TTAM_VERSION=(TTAM_VERSION) -t (REPO_PARAMS):$(TTAM_VERSION) .

push-container:
aws ecr get-login --registry-ids (DOCKER_REGISTRY_ID) | sed -e 's/ -e none / /' | sh && \ docker tag (REPO_PARAMS):(TTAM_VERSION) (DOCKER_REGISTRY)/(REPO_PARAMS):(TTAM_VERSION) &&
docker push (DOCKER_REGISTRY)/(REPO_PARAMS):$(TTAM_VERSION)

task definition as below:

Define the Fargate tasks

ServerTaskDefinition:
Type: AWS::ECS::TaskDefinition
Properties:
Family: !Ref ‘ServiceName’
Cpu: !Ref ‘ContainerCpu’
Memory: !Ref ‘ContainerMemory’
NetworkMode: awsvpc
RequiresCompatibilities:
- FARGATE
ExecutionRoleArn: !Ref ECSTaskExecutionRole
TaskRoleArn: !Ref ECSTaskRole
ContainerDefinitions:
- Name: !Ref ‘ServiceName’
Command:
- server
Cpu: !Ref ‘ContainerCpu’
Memory: !Ref ‘ContainerMemory’
Image: !Ref ‘ImageUrl’
PortMappings:
- ContainerPort: !Ref ContainerPort
LogConfiguration:
LogDriver: awslogs
Options:
awslogs-create-group: true
awslogs-region: !Ref “AWS::Region”
awslogs-group: !Sub “{AWS::StackName}" awslogs-stream-prefix: server Environment: - Name: PYTHONUNBUFFERED Value: 0 - Name: REDASH_DATE_FORMAT Value: YYYY-MM-DD - Name: REDASH_LOG_LEVEL Value: !Ref RedashLogLevel - Name: REDASH_REDIS_URL Value: !Sub - "redis://{RedisEndpoint}/0”
- RedisEndpoint: !ImportValue “redash-redis-ConfigurationEndpoint”
- Name: DB_HOSTNAME
Value: !Ref DBHostname
- Name: REDASH_WEB_WORKERS
Value: 4
- Name: REDASH_DISABLED_QUERY_RUNNERS
Value: !Ref RedashDisabledQueryRunners
- Name: REDASH_ADDITIONAL_QUERY_RUNNERS
Value: !Ref RedashAdditionalQueryRunners
- Name: REDASH_ENABLED_DESTINATIONS
Value: !Ref RedashDestinations
- Name: REDASH_HOST
Value: !Ref LoadBalancerRecord
- Name: REDASH_MAIL_DEFAULT_SENDER
Value: donotreply@xxxxxx.com

WorkerTaskDefinition:
Type: AWS::ECS::TaskDefinition
Properties:
Family: !Ref ‘ServiceName’
Cpu: !Ref ‘ContainerCpu’
Memory: !Ref ‘ContainerMemory’
NetworkMode: awsvpc
RequiresCompatibilities:
- FARGATE
ExecutionRoleArn: !Ref ECSTaskExecutionRole
TaskRoleArn: !Ref ECSTaskRole
ContainerDefinitions:
- Name: !Ref ‘ServiceName’
Command:
- scheduler
Cpu: !Ref ‘ContainerCpu’
Memory: !Ref ‘ContainerMemory’
Image: !Ref ‘ImageUrl’
PortMappings:
- ContainerPort: !Ref ContainerPort
LogConfiguration:
LogDriver: awslogs
Options:
awslogs-create-group: true
awslogs-region: !Ref “AWS::Region”
awslogs-group: !Sub “{AWS::StackName}" awslogs-stream-prefix: worker Environment: - Name: PYTHONUNBUFFERED Value: 0 - Name: REDASH_DATE_FORMAT Value: YYYY-MM-DD - Name: REDASH_LOG_LEVEL Value: !Ref RedashLogLevel - Name: REDASH_REDIS_URL Value: !Sub - "redis://{RedisEndpoint}/0”
- RedisEndpoint: !ImportValue “redash-redis-ConfigurationEndpoint”
- Name: DB_HOSTNAME
Value: !Ref DBHostname
- Name: QUEUES
Value: queries,scheduled_queries,celery
- Name: WORKERS_COUNT
Value: 2
- Name: REDASH_DISABLED_QUERY_RUNNERS
Value: !Ref RedashDisabledQueryRunners
- Name: REDASH_ADDITIONAL_QUERY_RUNNERS
Value: !Ref RedashAdditionalQueryRunners
- Name: REDASH_ENABLED_DESTINATIONS
Value: !Ref RedashDestinations
- Name: REDASH_HOST
Value: !Ref LoadBalancerRecord
- Name: REDASH_MAIL_DEFAULT_SENDER
Value: donotreply@xxxxx.com

export REDASH_DATABASE_URL=“postgresql://svc_redash:password@reddish.xxxxxxxxx.rds.amazonaws.com/postgres”

this fixed the issue

as i was pointing it to different database this was not working

1 Like