Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

guide to setting up and running zezere locally #117

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Static files
zezere/static/netboot/
static/
zezere.conf
venv
zezere-venv

# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down
72 changes: 70 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,74 @@
# zezere
# Zezere

[Zezere](https://en.wikipedia.org/wiki/Z%C3%AAzere_River) is a provisioning server for Fedora IoT.
It can be used for deploying Fedora IoT to devices without needing a physical console.

It is still under development.
## Getting Started

### Running with Docker


### Running with Python

If you're using any Python virtual environment you might want to setup that
first. Using venv:

```
$ venv zezere-venv
```
$ source zezere-venv/bin/activate
```
Before you can install the python requirements you need to have Apache httpd
installed. Please follow instructions from
[mod-wsgi-httpd project documentation](https://pypi.org/project/mod-wsgi-httpd/)

After the prequisites have been met we can install required packages:

```
$ pip install -r requirements.txt
```

Before using the `zezere-manage` tool, database and models needs to be migrated
and a configuration needs to be created.

Synchronize the database state with the current set of models and migrations:

```
$ python manage.py migrate
```

Default configuration can be used as a base:

```
$ cp zezere/default.conf ./zezere.conf
```

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
secret_key = very-secret
auth_method = local
```

Now we can create a superuser:

```
$ python-manage.py createsuperuser
```

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

### Running Tests

## Testing Local Setup


## Contributing
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
django>=2.1
djangorestframework
django-ipware
psycopg2
psycopg2-binary
rules
requests
mozilla-django-oidc
mod_wsgi
mod-wsgi
4 changes: 3 additions & 1 deletion tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
from contextlib import contextmanager

from django.test import TestCase as djangoTestCase
from django.contrib.auth.models import User
from django.contrib.auth import get_user_model
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why these changes here and to the requirements file?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(this is probably better contained in a specific commit also)


from zezere import models

User = get_user_model()


class TestCase(djangoTestCase):
# Some test users
Expand Down
20 changes: 20 additions & 0 deletions zezere/migrations/0013_alter_device_mac_address.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Generated by Django 4.0.4 on 2022-04-11 18:51

import django.core.validators
from django.db import migrations, models
import zezere.models


class Migration(migrations.Migration):

dependencies = [
('zezere', '0012_auto_20200323_1130'),
]

operations = [
migrations.AlterField(
model_name='device',
name='mac_address',
field=models.CharField(max_length=20, unique=True, validators=[django.core.validators.RegexValidator('^([0-9A-F]{2}[:]){5}([0-9A-F]{2})$'), zezere.models.validator_disallow_blacklisted_mac], verbose_name='Device MAC Address'),
),
]
4 changes: 3 additions & 1 deletion zezere/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from django.core.exceptions import ValidationError
from django.db import models
from django.core.validators import RegexValidator
from django.contrib.auth.models import User
from django.contrib.auth import get_user_model
from django.http import HttpRequest
from django.shortcuts import get_object_or_404
from django.utils.translation import gettext_lazy as _
Expand All @@ -18,6 +18,8 @@
from . import ignconfig


User = get_user_model()

class AttrDict(dict):
def __getattr__(self, name):
ret = self[name]
Expand Down