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 a server" documentation outdated #46
Comments
Hi @dirkdevriendt! Thanks for the heads up on this. You're right; the docs are probably out of date in this section... I know that I personally haven't tried to use Paster for this for years (my organization runs Pydap using Flask, gunicorn and supervisord. We'll leave this issue open until someone gets to writing up the docs. In the mean time, I can advise that you can use It would looks something (very rough approximation) like this: from flask import Flask
from pydap.wsgi.app import DapServer
pydap_inst = DapServer('/path/to/my/data/files')
app = Flask(__name__)
app.wsgi_app = pydap_inst
app.run('0.0.0.0', 8000) YMMV. |
Excellent info! We'll be testing a bit and if it works properly, I can send you the resulting setup so you can create a docker repo from it if you want. |
Seems to work just fine (note: we're pulling the netcdf handler from github since the pypi version is not up-to-date) I'll add a stripped down setup here so you can see what it looks like, but if you're interested you probable want to either integrate the relevant files in the pydap repo or create a dedicated docker repo. I can help set it up when you decide if/how you want to proceed. ./README.md
./DockerfileFROM tiangolo/uwsgi-nginx-flask:flask
COPY ./requirements.txt .
COPY ./app /app
COPY ./pydap.conf /etc/nginx/conf.d/
RUN \
apt-get update && \
apt-get install -y netcdf-bin libnetcdf-dev nano rsync && \
pip install --upgrade pip && \
pip install -r requirements.txt
RUN rsync -r /usr/local/lib/python2.7/site-packages/pydap/wsgi/templates/static/ /app/static/ ./pydap.conf
./requirements.txt
./app/main.pyimport os
from flask import Flask
from pydap.wsgi.app import DapServer
app_debug = (os.environ.get('APP_DEBUG', 'False').lower() in ['true', 'yes', 'y', '1'])
app_path = os.environ.get('APP_PATH', '/data')
app_host = os.environ.get('APP_HOST', '0.0.0.0')
app_port = int(os.environ.get('APP_PORT', '80'))
app = Flask(__name__)
app.wsgi_app = DapServer(app_path)
if __name__ == "__main__":
app.run(host=app_host, debug=app_debug, port=app_port) |
Cool, thanks for putting that together! I think that it would probably be best to (as the title of this issue indicates) update the documentation with the information, and not necessarily integrate it directly into the main repo. I would see it as "guidance on how to use PyDAP in the real world" and not necessarily as executable code that will 100% be up-to-date at all times (especially given the limited volunteer bandwidth behind PyDAP at present). If we did add them to the repo, I would probably want to put them in a "contrib" dir, and temper expectations regarding its maintenance. But I'd be happy to see a PR that integrates the above into a section in the docs (maybe replacing the Paster section). |
I have no intention to change your mind or to push more work onto the pydap volunteers, but putting this in documentation seems counterproductive since it makes the setup (appear) harder, which is not what docker is about :-)
If you prefer to not add it under the pydap organisation, no problem, I'll see if I can set something up myself or propose a PR to an existing repo (https://github.com/cynici/pydap from @cynici, maybe?) |
Yeah, that does make sense. I'll give it some thought and others are free to chime in to the discussion :) |
My two cents, it would be better to have something in the docs that actually works which apparently the paste script no longer does ;) |
+1 agree. I just tried installing pydap from scratch via the Quickstart and run into this error as well. |
I suppose it might even make more sense to point people to Hyrax instead of Pydap for new server deployments. |
@jameshiebert I tried your code ,but I get error!!
|
Update the server docs Fixes #46 Rewrote the Apache section, rewrote the uwsgi section, removed the paste references, added instructions for using the standalone server script, added a Flask section, added docker links.
Thanks for the hard work on this project!
This problem may be due to my lack of experience with Python Paste (and the fact the documentation on http://pythonpaste.org/ has been down for two months now), but we are trying to setup a pydap docker instance and have trouble getting the instructions to work for us.
Is there a way to get some guidance on what is needed to get paste to work?
Even better might be documentation or a code update to get a uwsgi server setup without having to pass via Python Paste? There is no conventional "application" method in the wsgi/app.py and the "main" method relies on gunicorn.app.pasterapp.paste_server as well.
Paste seems to add significant complexity for a limited benefit
The text was updated successfully, but these errors were encountered: