Dash App on shinyproxy Connection to mariadb database

Hi,
Im trying to deploy a python dash app via shinyproxy. The app queries data from Mariadb database (not hosted on localhost).

The problem

I have tried using sqlALchemy to make a connection to database. when I make a docker image out of the app and deploy it i get:

Error 500 : Container did not respond in time

the contents of my docker file are as follows:

FROM ubuntu:20.04

RUN apt-get update && \
    apt-get install -y python3 python3-pip && \
    rm -rf /var/lib/apt/lists/*



RUN pip3 install mariadb
RUN pip3 install dash==1.19.0 && \
    pip3 install pandas && \
    pip3 install SQLAlchemy && \
    pip3 install pyyaml  
    

RUN mkdir app
COPY app/ /app
RUN ls

EXPOSE 8050

WORKDIR /app
CMD ["python3", "app.py"] 

Furthermore, My application.yml includes the following contents

- id: shinyproxy-dash-myapp
    display-name: My App
    container-cmd:
    - python3
    - app.py
    container-image: shinyproxy-python-test
    access-groups:
    - my_access_group
    container-volumes:
    - /srv/myvol/Volume:/srv/myvol/Volume
    docker-network: host
    port: 8050

Important observation:

while debugging I have noticed everything works ok until I used the create_engine() method to make a connection to the database. So in my opinion it it somehow the culprit.

Furthermore, when I run it on local host as just a app.py python app. it runs fine, also when I run the image with docker run it runs fine. It only starts to ‘not work’ when I deploy it on shinyproxy.

1 Like

Hi Fareeha,

for debugging of your case first try to see what output your app will write on console (hope that python code will write some error on console similar as r code does). Find container id (with docker ps) and try with
docker logs --follow <container_id>
You have to be fast with commands to before container die.

Also, some options from your application.yml should be inspected also.

1 Like