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

Running WebDC3 as standalone with gunicorn #19

Open
volcan01010 opened this issue Jul 12, 2019 · 6 comments
Open

Running WebDC3 as standalone with gunicorn #19

volcan01010 opened this issue Jul 12, 2019 · 6 comments
Assignees

Comments

@volcan01010
Copy link

Hi,

I realise that this is not the preferred method, but I am trying to run WebDC3 from a user home directory, without Apache (I have permission problems accessing system level folders on server). I am using the gunicorn wsgi runner for Python.

I have been following the instructions in operator.rst. I have symlinked my webinterface.cfg into the seiscomp3/etc/ directory and set the SERVER_FOLDER. I copied the generic html files to the project root directory.

The repository is checkout out in /home/eida/webdc3/webdc3-github. I use the following command to start the server from within the wsgi directory:

gunicorn webinterface:application --log-level DEBUG \
  --chdir /home/eida/webdc3/webdc3-github \
  --env SEISCOMP_ROOT=/home/eida/seiscomp3 \
  --env LD_LIBRARY_PATH=/home/eida/seiscomp3/lib \
  --env PYTHONPATH="/home/eida/webdc3/webdc3-github/wsgi;/home/eida/seiscomp3/lib/python"

When I try to access the webserver, I get 404 errors. e.g.

curl localhost:8000/
curl localhost:8000/index.html
curl localhost:8000/webinterface

The debug logs record the GET requests.

However the following query does work:

curl localhost:8000/request/types.

Do you have any idea how I can fix this?

Thanks,
John

@javiquinte javiquinte assigned javiquinte and andres-h and unassigned javiquinte Jul 12, 2019
@andres-h
Copy link
Contributor

I'm not familiar with gunicorn, but unless it has built-in webserver functionality to serve static files (index.html, css, javascript, images), you may need to run it in combination with a web server like nginx. We are actually running nginx+uwsgi.

@volcan01010
Copy link
Author

volcan01010 commented Jul 25, 2019 via email

@andres-h
Copy link
Contributor

Here is the nginx config that I dropped in /etc/nginx/conf.d:

server {
        listen 80 default_server;
        listen [::]:80 default_server;

        root /var/www/html;
        index index.html;

        location / {
                # First attempt to serve request as file, then
                # as directory, then fall back to displaying a 404.
                try_files $uri $uri/ =404;
        }

        location = / {
                return 301 /webdc3/;
        }

        location /webdc3/data/ {
                return 404;
        }

        location /webdc3/wsgi/ {
                include uwsgi_params;
                uwsgi_pass localhost:9000;
        }
}

If you use gunicorn, you'd probably use "proxy_pass" instead of "uwsgi_pass". We run uwsgi using:

source <(/sbin/setuser sysop /home/sysop/seiscomp3/bin/seiscomp print env)
exec /usr/bin/uwsgi --master --processes 8 --die-on-term --socket 127.0.0.1:9000 --uid sysop --plugins syslog,python --logger syslog --manage-script-name --mount /webdc3/wsgi=/var/www/html/webdc3/wsgi/webdc3.wsgi

@volcan01010
Copy link
Author

Thanks. I'll have a go and let you know how I get on.

@nikosT
Copy link

nikosT commented Apr 22, 2020

Thanks. I'll have a go and let you know how I get on.

@volcan01010 Did you dockerized it? It will save a lot of time, if you could share it.

@fthturhan
Copy link

Hi all,

Has anyone created a Docker container for webdc3?

Thanks,
Fatih

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

No branches or pull requests

5 participants