NETVS - Middleware
Installation
The NETVS middleware requires python3
.
In case you don't want a venv setup, omit steps 1&2.
-
Create venv:
python3 -m venv venv/
-
Change into venv:
source venv/bin/activate
-
Install dependencies:
pip install -r requirements.txt
Generate AP-List/MACfinder certificate
Login as root on macfinder-1.tmn.scc.kit.edu
and execute /root/make-devel-cert.sh <certname>
.
The script will ask for some input. Typically, the default values and yes are correct.
Productive setup with uwsgi
uwsgi -s /tmp/net-suite.sock --virtualenv <path to env> --manage-script-name --mount /net-suite=run:app
DEV-Setup
DEBUG = True
in config.py
.
python3 main.py
or
gunicorn -k uvicorn.workers.UvicornWorker --reload --bind localhost:8000 main:app
systemd
Also take at look at the uwsgi documentation.
Configuration
Middleware
WAPI_NETVS_SUPERUSER
is the superuser for the middleware.
When queries are required which are not possible as the requesting user (due to permission restrictions), the superuser is used.
Therefore, the user must have the necessary permissions to execute those queries.
Typically, a user with cntl.default_reader
and wapi.devel_tester
is used.
As the queries are executed directly against the database, no token for the user is required; it will only be used to populate the context of the query.
NET-DB
Postgres
Net-Suite uses different databases depending on the host operation mode defined in /usr/local/etc/host_oper_mode_data.cfg
:
[op_environment]
mode = test
# mode = prod
# mode = test
[redundancy]
mode = active
[default_database_connection]
prod = pgsql_prod
test = pgsql_test
devel = psql_devel
The different databases are defined in the HOME
of the user running DNSVS in the file ~/.db_connection_data.ini
:
[pgsql_prod]
host=prodhost
port=5435
user=user
db=db
[pgsql_test]
host=testhost
port=5435
user=user
db=db
[pgsql_devel]
host=develhost
port=5435
user=user
db=db
To use the normal hosts, you can use:
[pgsql_prod]
host = net-pgsql.scc.kit.edu
db = net
user = netadmin
[pgsql_test]
host = net-pgsql-test.scc.kit.edu
db = net
user = netadmin
[pgsql_devel]
host = net-pgsql-devel.scc.kit.edu
db = net
user = netdevel
Postgres' authentication information is retrieved from ~/.pgpass
.