-
Ernesto Rico Schmidt authoredErnesto Rico Schmidt authored
AURA Steering: Program Scheduler
Installation
If you want to have quick dev server and already have the steering-postgres container of the aura-web repository running, follow the steps outlined in the Setting up the configuration section and do:
$ docker build -t steering-django --target dev .
$ docker run --rm -v $(pwd):/aura --network auraweb_auranet steering-django:latest python manage.py migrate
$ docker run -it --rm -v $(pwd):/aura --network auraweb_auranet steering-django:latest python manage.py createsuperuser
$ docker run --rm -p 8000:8000 -v $(pwd):/aura --network auraweb_auranet steering-django:latest
and log into it at http://127.0.0.1:8000/admin/ with the credentials you have
set in the createsuperuser
step. Once this is done, every other time you
want to start a steering-django container, you will only have to use the
last command.
Full setup without Docker is done as described below.
To get setup you must have the following installed:
- PostgresSQL (except you are using the aura-web docker container steering-postgres for it)
- JPEG library development files
- Python 3.8 or later including development files
In Debian or Ubuntu (or derivatives) you should be able to achieve this with this command:
$ sudo apt-get install postgresql postgresql-contrib libjpeg-dev python3 python3-dev
Setting up the environment
Create a virtual environment where the dependencies will live:
$ python3 -m venv python
$ source python/bin/activate
(python)$
Change into the base directory of this software and install the project dependencies:
(python)$ pip install -r requirements.txt
Setting up the configuration
Copy the .env.example
file to .env
and change the values accordingly.
You have to at least provide the SECRET_KEY
and the DBPASS
values
for Django to start. The file provides extensive comments on all the settings.
For a developments environment the defaults should be just fine if you use the
steering-postgres docker container from the aura-web repository. If you
want to create your own database on you local machine, you will have to use
steering as the database and user name, or adopt the DB*
values
accordingly.
Also be aware that there is a RUN_IN_DOCKER
setting that is True
by
default. This should be fine for a production environment where Django is
run inside a container. If you follow these steps here to create your own
development environment you have to set this setting to False
. You also
might want to set DEBUG
to True
for your development environment.
Setting up the database
Then run:
(python)$ python manage.py migrate
(python)$ python manage.py loaddata fixtures/*/*.json
Adding an admin user
In order to create an admin user (which you will need to login to the webinterface after the next step) run:
(python)$ python manage.py createsuperuser
Running a web server
In development you should run:
(python)$ python manage.py runserver
After this you can open http://127.0.0.1:8000/admin in your browser and log in
with the credentials you have chosen in the createsuperuser
command.
If you are using some placeholder credentials, make sure to change your password by visiting http://127.0.0.1:8000/admin/auth/user/1/password/
Configuring OpenID Connect clients
To make AuRa usable, you have to set up OpenID Connect (OIDC) clients for the dashboard and tank, so they can make authenticated requests on behalf of the user against the steering API.
To do so, you can either visit the Django admin interface and create an RSA key as well as two clients, or do so programmatically by running:
(python)$ python manage.py creatersakey
(python)$ python manage.py create_oidc_client dashboard public -r "id_token token" -u https://aura-test.o94.at/oidc_callback.html -u https://aura-test.o94.at/oidc_callback_silentRenew.html -p https://aura-test.o94.at/
(python)$ python manage.py create_oidc_client tank confidential -r "code" -u https://aura-test.o94.at/tank/auth/oidc/callback
In these examples you will have to https://aura-test.o94.at and https://aura-test.o94.at/tank_with with wherever dashboard and tank are running in your setup. In a local development environment this might be something like http://localhost:8080 and http://localhost:4000 respectively.
The client id and in case of the tank also the client secret are then needed for the configuration of those components.