@DavidMStraub, what would it take to make gramps-web be usable as my local desktop gramps?
For example, I’d like to just start up the flask server, and go to localhost:port and start using gramps-web. This would be similar to how Jupyter Lab and other client/server systems work. This would also be useful for development.
Questions:
Is this possible without using Docker? I don’t mind logging in if necessary.
If so, can I use my sqlite database?
Would there be any issues? I know Jupyter went for years with a security token, but with that, it should also be secure, right?
Is this possible without using Docker? I don’t mind logging in if necessary.
Yes, that’s definitely possible. gramps_webapi is a pip-installable Python package and a flask app, so you can run the flask development server (warning: do not use to deploy a website) to run it. The package also has its own CLI script for convenience, see python -m gramps_webapi --help.
I personally don’t use docker during development and the command I use is:
LANGUAGE=en python3 -O -m gramps_webapi --config some_config.cfg run --port 5555
If so, can I use my sqlite database?
Yes, it will use your normal grampsdb by default. You can use TREE='My Tree Name' to select the tree to use.
Would there be any issues?
To use all the features (e.g. import and export), it makes sense to run celery as well. This also works without docker:
GRAMPS_API_CONFIG=some_config.cfg celery -A gramps_webapi.celery worker --loglevel=INFO
but you also need Redis, which I have never tried outside of docker since it’s so simple to spin up a redis container.
I know Jupyter went for years with a security token, but with that, it should also be secure, right?
I’m not sure what you mean by secure - clearly, such a setup is only good for local testing, without HTTPS it’s completely insecure and the flask development server is not suited for production.
I don’t think security is an issue if you are just running it locally, correct? When you say “not suited for production” you mean when not run locally, correct?
As message broker for celery. Gramps Web (API) will mostly work also without celery, but some long-running operations might time out. But for some of them (e.g. creating a search index), you can also directly use the command line, which doesn’t suffer from the timeout problem.
$ FLASK_DEBUG=1 LANGUAGE=en python -m gramps_webapi --config gramps-web.cfg run --port 5555
* Serving Flask app 'gramps_webapi.app'
* Debug mode: on
INFO:werkzeug:WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
* Running on http://127.0.0.1:5555
INFO:werkzeug:Press CTRL+C to quit
INFO:werkzeug: * Restarting with watchdog (inotify)
WARNING:werkzeug: * Debugger is active!
INFO:werkzeug: * Debugger PIN: 598-699-581
INFO:werkzeug:127.0.0.1 - - [13/Nov/2024 12:12:17] "GET / HTTP/1.1" 304 -
INFO:werkzeug:127.0.0.1 - - [13/Nov/2024 12:12:17] "GET /favicon.ico HTTP/1.1" 304 -
INFO:werkzeug:127.0.0.1 - - [13/Nov/2024 12:12:30] "GET /favicon.ico HTTP/1.1" 304 -
Hi @dsblank, do you want to run Gramps Web API only or the whole web app?
If you’re only running the API, it’s expected to get a blank page. You can interact with it by sending HTTP requests (manually with curl, using httpie as described here or perhaps using my half-finished API client). API docs are here.
If you want to run the web app, you also need to download the frontend (e.g. the released one here if you don’t want to build form source) and set the STATIC_PATH config option accordingly.
Thanks! That was enough to get me going, but there are a lot of missing pieces in the docs. I found this page by searching, but it doesn’t appear in the menu that I could find.
Here are my step-by-step instructions if one wants to run gramps-web locally.
Make sure you have gramps, gramps-web-api, and gramps-web installed. I git cloned each of them and pip install -e . each to have a development environment
Create a gramps-web.config file, like the following: