1
0
Fork 0
Commit graph

31 commits

Author SHA1 Message Date
e13f24eba0
panel service: set NIX_BIN 2025-03-20 11:14:11 +01:00
c98663ae71
pass nix binary explicitly rather than thru PATH 2025-03-20 09:44:24 +01:00
3700b6e383 remove option fediversity.eu ()
removing fediversity.eu from form options as its subdomains are running live services

Reviewed-on: 
Reviewed-by: Kevin Muller <kevin@procolix.com>
Co-authored-by: Kiara Grouwstra <kiara@procolix.eu>
Co-committed-by: Kiara Grouwstra <kiara@procolix.eu>
2025-03-19 16:01:03 +01:00
e3b816d85e
revert change on USER_SETTINGS_FILE, fixing dev shell 2025-03-19 10:22:52 +01:00
afbbcbc22d simplify configuration via environment 2025-03-19 10:06:38 +01:00
c5fe0157b0
factor reading env vars out to settings.py 2025-03-19 09:51:23 +01:00
53d3791eaa
move NIX_DIR to env, making its use more explicit 2025-03-19 09:51:23 +01:00
53658e9880
trigger nixops from panel
adds a deploy button to the panel form - covers the local part of .

As a workaround to pass info (from our user form) into nixops4 uses
environment variable `DEPLOYMENT` thru nix's
`--extra-experimental-features configurable-impure-env`.
2025-03-19 09:51:23 +01:00
3364d6c972 fix: NixOS deployment code
- simplify the configuration module

  the `package` attribute makes little sense to be user-configurable,
  since it will always need to be the derivation defined in this very
  repository. for debugging one may as well change the original code itself.

- unbreak deployment

  setting `CREDENTIALS_DIRECTORY` disabled the systemd mechanism set up
  in the configuration module.

- remove unneeded configuration for deployment

- unbreak integration tests

  before that missed waiting for the service to create some
  state before running the application-level tests.
2025-03-19 09:48:41 +01:00
8f0bcc35f0 fix: run manage in service directory
for everything else it will error on CHDIR, even if $PWD has the right owner and permissions.
2025-03-18 09:52:14 +01:00
4d748c91d7
remove paragraph: Configuration schema version, following 2025-03-17 14:11:58 +01:00
08d109cc82 Remove versions 2025-03-13 15:31:09 +01:00
e41f9c572a add basic service configuration ()
- test the form interaction for a fixed schema version
- also add a database migration missed in the last commit

Closes 

Reviewed-on: 
Co-authored-by: Valentin Gagarin <valentin.gagarin@tweag.io>
Co-committed-by: Valentin Gagarin <valentin.gagarin@tweag.io>
2025-03-13 15:28:54 +01:00
9dd92b4cc1 basic versioned forms
this is still rudimentary since the actual forms are not auto-generated
from the underlying model. the comments show a path towards that.
2025-03-06 11:47:26 +01:00
981ba011ab store versioned configurations
Test manually:

```shell-session
$ manage shell
>>> from panel.models import Configuration
>>> Configuration().value
'{"enable":false,"domain":"fediversity.eu"}'
>>> Configuration().save()
>>> Configuration.objects.first().parsed_value
Configuration(enable=False, domain=<Domain.EU: 'fediversity.eu'>)
```
2025-03-05 09:32:03 +01:00
438f7d280a add django-pydantic-field 2025-03-05 09:00:18 +01:00
cba66d1b8b allow adding extra Python packages 2025-03-05 08:57:55 +01:00
f828afd5d5
minimum setup i got working for deployment 2025-02-27 09:07:13 +01:00
c2db12a735 add simple (ngi) favicon to fedi panel, fixes 404 not found error ()
Reviewed-on: 
Reviewed-by: Valentin Gagarin <valentin.gagarin@tweag.io>
Co-authored-by: Kiara Grouwstra <kiara@procolix.eu>
Co-committed-by: Kiara Grouwstra <kiara@procolix.eu>
2025-02-19 23:10:33 +01:00
92563d387a test login/logout redirection ()
this concludes  with a test covering most of the user story.

test in the devshell:
```
manage test panel
```

test in full isolation:
```
nix-build -A tests
```

Reviewed-on: 
Reviewed-by: kiara Grouwstra <kiara@procolix.eu>
2025-02-19 23:07:51 +01:00
59122901ce make login link part of global navigation
this makes navigation uniform and the information architecture easier to
reason about
2025-02-19 15:43:45 +01:00
fc586273dc implement login URL as templatetag
this eases testing as it allows generating that URL inside a test
instead of scraping HTML output
2025-02-19 15:40:51 +01:00
65782c65ba add debug toolbar 2025-02-18 18:25:37 +01:00
857e1b12f5 add more fresh-start instructions ()
Reviewed-on: 
Reviewed-by: kiara Grouwstra <kiara@procolix.eu>
2025-02-18 18:21:58 +01:00
a3365eb508 more conventional naming for views and templates 2025-02-18 17:29:06 +01:00
73c9c884d7 redirect to current page after login/logout 2025-02-18 17:15:55 +01:00
ed4912800f Add page showing account info
Co-authored-by: lois <lois@procolix.eu>
Co-authored-by: Kiara Grouwstra <kiara.grouwstra@gmail.com>
2025-02-18 15:44:15 +01:00
ffd6213549 Add login indicator 2025-02-18 11:01:09 +01:00
Kiara Grouwstra
ec4e802124
add .envrc files 2025-02-13 14:48:21 +01:00
f97dc7e121 fix settings and add dummy view
This introduces customisation to `settings.py` that
- allow controlling the relevant parameters from our systemd wrapper
  (more brittle and non-obvious than it should be, see TODOs)
- correctly configure SASS processing and static file compression
  (not as easy as it sounds)
2025-02-13 00:26:28 +01:00
7c33e8aaf3 scaffold Django web service
This setup is greatly inspired by the one used for [0], although with
notable modifications, such as:
- a SASS preprocessor and CSS compressor
- more streamlined NixOS integration tests
- cleaned up service configuration
- a few notes on how to do things better in the future

[0]: https://github.com/Nix-Security-WG/nix-security-tracker/

Apart from cloning the Nix setup, there were additional steps:
- Create an empty `src` directory, since the package requires it
- In the development shell, run `django-admin startproject panel src`

Note that while you can already do

```bash
manage migrate
manage runserver
```

the NixOS integration tests will fail, since `settings.py` needs
careful massaging to expose knobs that can be turned from our systemd
wrapper. The required changes are introduced in the next commit to make
them observable.

Noteworthy related work:

- https://github.com/sephii/django.nix

  Rather mature setup with a clean interface, uses Caddy as reverse proxy.

- https://git.dgnum.eu/mdebray/djangonix

  A work-in-progress attempt to capture more moving parts through the
  module system, in particular secrets.

- https://github.com/DavHau/django-nixos

  Out of date and somewhat simplistic, but serves as a reasonable
  example for what can be done

I chose the variant I'm intimately familiar with in order to be able to
pass on knowledge or help with maintenance. But for the future
I strongly recommend picking the good bits from the other
implementations that control complexity in static configuration parts
through Nix expressions.
2025-02-13 00:26:28 +01:00