
Tested with Dependancy:Version
=======================
python3:3.10.6-1~22.04
python3-flask:2.0.1-2ubuntu1
sqlite3:3.37.2-2ubuntu0.1
libhunspell-dev:1.7.0-4build1
python3-hunspell:0.5.5-2build6
uwsgi-core:2.0.20-4
uwsgi-plugin-python3:2.0.20-4
apache2:2.4.52-1ubuntu4.2
python3-requests:2.25.1+dfsg-2


Installation
======
This software expects to be installed at /opt/kjv-api/ (for uwsgi use on a reverse proxy)
This installation method is intended to play nice among other Virtual Hosts

0. Install dependancies listed at the head of this document.
 - You may substitute the webserver for one of your choice, as long as it's capable
   of reverse proxy

1. For security, create a new user with the name 'kjv'
 - sudo useradd -r -s /bin/false kjv

2. Change ownership of the /opt/kjv-api/ folder to the kjv user
 - sudo chmod -R kjv:kjv /opt/kjv-api/

3. Test the software runs by running kjv-api.sh as a non-root user (preferably as kjv user)
   and that you are able to query it locally.
 - term1. sudo -Hu kjv ./kjv-api.sh
 - term2. curl -XGET 127.0.0.1:1611/random

4. If you intend to set up the software as a persistant service, copy kjv-api.service from
   the install folder to /etc/systemd/system/kjv-api.service
 - sudo cp /opt/kjv-api/install/kjv-api.service /etc/systemd/system/
 - sudo systemctl enable kjv-api.service
 - sudo systemctl start kjv-api.service

5. Configure your webserver as a reverse proxy to point to 127.0.0.1:1611 for where you
   wish to have the api hosted.
 - A sample configuration for apache is provided in the install folder.
 - It is up to you to use https or not, but if you know nginx or haproxy you should be able
   to set up local proxying to the WSGI server that runs the flask.
 - There are WSGI modules for apache avaliable, which may be better for larger scaled
   deployments, but http proxying to the local uwsgi served flask works fine for smaller uses.
