-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update the django requirements to 3.0
The tests already use django 3+ so we should align this everywhere. Signed-off-by: Peter Robinson <[email protected]> Add a guide to setup zezere instance Signed-off-by: rdotjain <[email protected]> Update .gitignore for conf file Signed-off-by: rdotjain <[email protected]> Add endpoint to upload ov Signed-off-by: rdotjain <[email protected]> Update endpoint to accept CBOR encoded vouchers Signed-off-by: rdotjain <[email protected]> Improve error listing in UI using messages Signed-off-by: rdotjain <[email protected]> tweak endpoint to accept multiple vouchers Signed-off-by: rdotjain <[email protected]> bug fix: navbar active tab Signed-off-by: rdotjain <[email protected]> Add error handling in API call Signed-off-by: rdotjain <[email protected]> ui: change button style Signed-off-by: rdotjain <[email protected]> update template for multiple ownership vouchers Signed-off-by: rdotjain <[email protected]> add server base url in default conf Signed-off-by: rdotjain <[email protected]>
- Loading branch information
Showing
9 changed files
with
197 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -106,3 +106,6 @@ venv.bak/ | |
|
||
# mypy | ||
.mypy_cache/ | ||
|
||
# conf file | ||
zezere.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
# Setup a zezere instance locally | ||
|
||
1. To install requirements in a Python virtual environment, set it up first. | ||
```sh | ||
$ virtualenv venv | ||
$ . venv/bin/activate | ||
``` | ||
|
||
2. Before installing other Python requirements, you need to install Apache httpd first. Follow the instructions from [mod-wsgi project documentation](https://pypi.org/project/mod-wsgi/). | ||
<br> | ||
In order to satisfy the `psycopg2` dependency please follow instructions from | ||
[psycopg2 project documentation](https://www.psycopg.org/docs/install.html). | ||
|
||
3. Install the requirements | ||
```sh | ||
$ (venv) pip install . | ||
``` | ||
|
||
4. Before using the `zezere-manage` tool, a configuration needs to be created. | ||
Default configuration can be used as a base: | ||
|
||
``` | ||
$ cp zezere/default.conf ./zezere.conf | ||
``` | ||
|
||
5. Authentication method and secret key needs to be set in order to satisfy the | ||
tool. Also, make sure that the allowed_hosts is what you want. | ||
|
||
``` | ||
allowed_hosts = localhost, 127.0.0.1 | ||
secret_key = very-secret | ||
auth_method = local | ||
``` | ||
|
||
6. Now run the migrations, to create a database file. | ||
```sh | ||
$ python manage.py migrate --noinput | ||
``` | ||
|
||
7. To collect the static files, run | ||
``` | ||
$ python manage.py collectstatic | ||
``` | ||
|
||
8. Now we can create a superuser: | ||
|
||
``` | ||
$ zezere-manage createsuperuser --username admin --email [email protected] | ||
``` | ||
|
||
9. After a password has been set, we are ready to run Zezere: | ||
|
||
``` | ||
./app.sh | ||
``` | ||
|
||
Use the admin credentials we created to login to localhost:8080 | ||
|
||
<br> | ||
|
||
# Setup using Docker | ||
The easiest way to run Zezere is to run the official container and authenticate | ||
with OpenID Connect: | ||
|
||
``` | ||
$ docker run --detach --rm --name zezere \ | ||
-e OIDC_RP_CLIENT_ID=<client id> \ | ||
-e OIDC_RP_CLIENT_SECRET=<client secret> \ | ||
-e OIDC_OP_AUTHORIZATION_ENDPOINT=<authorization endpoint> \ | ||
-e OIDC_OP_TOKEN_ENDPOINT=<token endpoint> \ | ||
-e OIDC_OP_USER_ENDPOINT=<userinfo endpoint> \ | ||
-e OIDC_OP_JWKS_ENDPOINT=<jwks endpoint> \ | ||
-e AUTH_METHOD=oidc \ | ||
-e SECRET_KEY=localtest \ | ||
-e ALLOWED_HOSTS=localhost \ | ||
-p 8080:8080 \ | ||
-t quay.io/fedora-iot/zezere:latest | ||
``` | ||
The default signing algorithm is `RS256` but it can also be controlled with the | ||
environment variable `OIDC_OP_SIGN_ALGO` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
django>=2.1 | ||
django>=3.0 | ||
djangorestframework | ||
django-ipware | ||
psycopg2 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{% extends "./master.html" %} | ||
|
||
{% load rules %} | ||
|
||
{% block title %}Add Voucher{% endblock %} | ||
|
||
{% block content %} | ||
|
||
{% if messages %} | ||
{% for message in messages %} | ||
<div{% if message.tags %} class="{{ message.tags }}"{% endif %}>{{ message }}</div> | ||
{% endfor %} | ||
{% endif %} | ||
|
||
Add a new ownership voucher: | ||
<form method="POST" action="/portal/ov/add/" enctype="multipart/form-data"> | ||
{% csrf_token %} | ||
Enter the number of vouchers: <input type="number" name="no_of_vouchers" required> <br> <br> | ||
Enter your voucher contents:<br> | ||
<textarea name="ov" rows="10" cols="50" ></textarea> <br> <br> | ||
OR <br> <br> | ||
Upload a CBOR encoded voucher: <input type="file" name="ov_file" multiple> <br><br> | ||
<input type="submit" class="btn btn-primary btn-sm" value="Add voucher"> <br> | ||
</form> | ||
|
||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters