question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Deploying behind Nginx

See original GitHub issue

Hi I have an app that runs normally on development server. But on my deployment server, Dockerized and behind an Nginx webserver, it fails to update the plotly graphs (I am guessing this is related to ASGI issues in this setup)

This is the script I use to start gunicorn:

#!/usr/bin/env bash

DEPLOY_HOME="/srv/deploy/myapp"
NUM_WORKERS=4
WSGI_HOST="0.0.0.0"
WSGI_PORT="8000"
ERRLOG="$DEPLOY_HOME/logs/wsgi_server.err"
ACCESS_LOG="$DEPLOY_HOME/logs/wsgi_server.access"

if [ "$DATABASE" = "postgres" ]
then
    echo "Waiting for postgres..."

    while ! nc -z db 5432 ; do
      sleep 0.1
    done

    echo "PostgreSQL started"
fi


cd $DEPLOY_HOME
#echo "Doing Migrations..."
python3 manage.py makemigrations
python3 manage.py migrate

echo "Collecting Static files..."
chown -R deploy:deploy $DEPLOY_HOME

python3 manage.py collectstatic --noinput
python3 manage.py createsuperuser --noinput --username $DJANGO_SUPERUSER_USERNAME --email $DJANGO_SUPERUSER_EMAIL



exec gunicorn -w $NUM_WORKERS -b $WSGI_HOST:$WSGI_PORT --access-logfile $ACCESS_LOG --error-logfile $ERRLOG myapp.wsgi:application --preload --timeout 480

I think I need to update my nginx.conf but I am not sure how. Do I also need to setup a separate ASGI server process? Like they did here

Any suggestions are welcome.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
fccoelhocommented, Jun 29, 2020

I found out that the error I was getting behind NGINX had to do with using Scattergl. Once I switched to a regular Scatter plot it all seems to be working.

0reactions
fccoelhocommented, Jun 27, 2020

Yes, static files served from the dash app path is tricky. I am having issues loading a logo image but that shouldn’t block the dashboard from functioning.

What I have been able to find upon loading the dashboard page was this error related to plotly’s react code:

TypeError: Cannot read property 'regl' of null
    at new y (async-plotlyjs.js:1)
    at e.exports (async-plotlyjs.js:1)
    at Object.e.exports [as plot] (async-plotlyjs.js:1)
    at d (async-plotlyjs.js:1)
    at Object.r.plot (async-plotlyjs.js:1)
    at r.drawData (async-plotlyjs.js:1)
    at Object.l.syncOrAsync (async-plotlyjs.js:1)
    at r.plot (async-plotlyjs.js:1)
    at Object.l.syncOrAsync (async-plotlyjs.js:1)
    at Object.r.react (async-plotlyjs.js:1)

Do you think this may have something to do with the version of Plotly I am using?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Deployment Guides | NGINX Plus
Deployment guides for deploying NGINX Plus in cloud environments, global server load balancing, configuring NGINX Plus to load balance or interoperate with ......
Read more >
How to deploy web applications using Nginx on Remote ...
We need to follow the given steps in order to deploy web applications using Nginx. Step 1: Open the terminal, and change the...
Read more >
How To Deploy a Go Web Application Using Nginx on Ubuntu ...
Step 1 — Building the Go Web Application · Step 2 — Creating a Systemd Unit File · Step 3 — Setting Up...
Read more >
How to accelerate web app deployment with Nginx
In order to deploy our application with the Nginx web server, we'll first make a couple of configurations in the /etc/Nginx/Nginx.conf file.
Read more >
How to setup an Nginx reverse proxy server example
Nginx reverse proxy configuration steps · Install Nginx on your Windows or Linux server (prerequisite). · Add the Nginx proxy_pass setting in a ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found