Commit graph

66 commits

Author SHA1 Message Date
b791bd515d pass sources via specialArgs (#464)
this gets rid of ugly in-place imports and upward paths

Reviewed-on: Fediversity/Fediversity#464
Reviewed-by: kiara Grouwstra <kiara@procolix.eu>
Co-authored-by: Valentin Gagarin <valentin.gagarin@tweag.io>
Co-committed-by: Valentin Gagarin <valentin.gagarin@tweag.io>
2025-07-16 10:53:36 +02:00
b0848727fd clarify the use of isNormalUser (#436)
Reviewed-on: Fediversity/Fediversity#436
Co-authored-by: Kiara Grouwstra <kiara@procolix.eu>
Co-committed-by: Kiara Grouwstra <kiara@procolix.eu>
2025-07-06 09:09:43 +02:00
3f1c8a9bb7
Document why Nix and OpenSSH
lost in #412. Alternatively, we could have a comment on both lines
saying eg. “for NixOps4”
2025-06-30 14:30:29 +02:00
737aecaba6 set default value for nixops4Package (#412)
Co-authored-by: Valentin Gagarin <valentin.gagarin@tweag.io>
Reviewed-on: Fediversity/Fediversity#412
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-06-30 12:44:53 +02:00
1c44004cfe update documentation for #375 (#406)
Reviewed-on: Fediversity/Fediversity#406
Co-authored-by: Kiara Grouwstra <kiara@procolix.eu>
Co-committed-by: Kiara Grouwstra <kiara@procolix.eu>
2025-06-27 14:40:40 +02:00
9a25a04bfa specify _class module attributes to explicitly declare module types (#398)
closes #93.

note that this includes classes:

- `nixos`
- `nixosTest`
- `nixops4Resource`
- `nixops4Deployment`

.. and my (made-up, as per the [docs](https://ryantm.github.io/nixpkgs/module-system/module-system/#module-system-lib-evalModules-param-class)):

- `nix-unit`
- `package`

.. while i did not manage to cover:

- service tests, given `pkgs.nixosTest` seemed to not actually like `_class = "nixosTest"` (?!)

... nor #93's mentioned destructured arguments for that matter, as per Fediversity/Fediversity#93 (comment) - let me know if that is still desired as well.

Reviewed-on: Fediversity/Fediversity#398
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-06-23 17:24:54 +02:00
d073bd706d
cast DEPLOYMENT_FLAKE to string 2025-06-22 14:42:14 +02:00
bd1cfd7a7c Introduce test for deploying all services via FediPanel (#361)
Closes #277

Same as #329 but where we run the FediPanel and interact with it via a browser
instead of running NixOps4 directly.

Reviewed-on: Fediversity/Fediversity#361
Reviewed-by: kiara Grouwstra <kiara@procolix.eu>
Reviewed-by: Valentin Gagarin <valentin.gagarin@tweag.io>
Co-authored-by: Nicolas “Niols” Jeannerod <nicolas.jeannerod@moduscreate.com>
Co-committed-by: Nicolas “Niols” Jeannerod <nicolas.jeannerod@moduscreate.com>
2025-06-18 12:37:47 +02:00
3a3a083793 FediPanel: allow configuring flake and deployment (#376)
Last part of #361.

Builds on top of #375.

Reviewed-on: Fediversity/Fediversity#376
Reviewed-by: kiara Grouwstra <kiara@procolix.eu>
Co-authored-by: Nicolas “Niols” Jeannerod <nicolas.jeannerod@moduscreate.com>
Co-committed-by: Nicolas “Niols” Jeannerod <nicolas.jeannerod@moduscreate.com>
2025-06-15 16:55:19 +02:00
ace56e754e FediPanel: do not call nix develop (#375)
Yet another piece of #361.

Reviewed-on: Fediversity/Fediversity#375
Reviewed-by: kiara Grouwstra <kiara@procolix.eu>
Co-authored-by: Nicolas “Niols” Jeannerod <nicolas.jeannerod@moduscreate.com>
Co-committed-by: Nicolas “Niols” Jeannerod <nicolas.jeannerod@moduscreate.com>
2025-06-15 15:06:23 +02:00
5a514b96e9 use deployed environment for launching nixops4 from the panel 2025-06-13 16:39:34 +02:00
4dd1491e71 FediPanel: fix deployment status
also remove unused `dummy_user`
2025-06-06 11:02:40 +02:00
2f55e1512a FediPanel: bump nginx timeout to an hour 2025-06-06 10:57:19 +02:00
b59f8a4183 simplify login tests (#352)
don't go through template generation but use underlying the tag
implementation directly

Co-authored-by: Nicolas Jeannerod <nicolas.jeannerod@moduscreate.com>
Reviewed-on: Fediversity/Fediversity#352
2025-06-06 10:56:34 +02:00
1f8677e83d FediPanel: better logging of NixOps4 2025-06-06 10:53:22 +02:00
69579fea1c expose JSON schema for inspection (#351)
intending to document more about how our schemas work, i found our code currently buries this somewhere in `/nix/store`.
this change exposes that generated file in the project structure as well, facilitating inspection of our data schema in this more generic format.

Reviewed-on: Fediversity/Fediversity#351
Reviewed-by: Nicolas Jeannerod <nicolas.jeannerod@moduscreate.com>
Co-authored-by: Kiara Grouwstra <kiara@procolix.eu>
Co-committed-by: Kiara Grouwstra <kiara@procolix.eu>
2025-06-04 19:15:26 +02:00
df9ce821de collapse VM tests into one, use subtests 2025-05-05 09:22:43 +02:00
6100b278b6 generate Python data models from module options (#285)
this shows a proof of concept for generating Django forms from NixOS modules

note that the form behavior is still rather clumsy and doesn't exactly map to the module semantics:
- since forms can only be sent wholesale, empty form fields will show up as empty strings
  and break validation without additional cleanup (not done here)
- it's not possible to faithfully translate `type = submodule { /* ... */}; default = {};`, since the default
  is translated to an empty dict `{}`. this is because the JSON schema converter does not preserve type information.
  this can be added by making it use `$defs` [1], but that would likely amount to half a rewrite
- there's a glitch in enum default values that needs to be fixed in `datamodel-code-generator` [0]

[0]: dd44480359/src/datamodel_code_generator/parser/base.py (L1015)
[1]: https://json-schema.org/understanding-json-schema/structuring#defs

a generated file will be placed into the source (by the development shell and the package respectively)
that declares Pydantic types from which to render the form. it looks something like this:

```python
from __future__ import annotations

from enum import Enum
from typing import Optional

from pydantic import BaseModel, Extra, Field
from drf_pydantic import BaseModel

class Domain(Enum):
    fediversity_net = 'fediversity.net'

# ...

class Model(BaseModel):
    class Config:
        extra = Extra.forbid

    domain: Optional[Domain] = Field(
        'fediversity.net',
        description='Apex domain under which the services will be deployed.\n',
    )

  # ...
```
2025-05-01 01:26:52 +02:00
5db04d0c50 panel - enable proper logger that will show up in the console (#320)
[usage](https://docs.python.org/3/library/logging.html):

```py
import logging
logger = logging.getLogger(__name__)
logger.info("hi")
```

Reviewed-on: Fediversity/Fediversity#320
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-04-23 15:58:11 +02:00
725520ddd4 don't track symlinked htmx 2025-04-22 16:34:09 +02:00
061314a062 programmatically place generated files in development environment
this allows to add more generated files later as needed without
cluttering the `shellHook`.
2025-04-22 16:24:12 +02:00
c69f1f52e0 allow accessing test vms from fedi201, closes #286 (#297)
Reviewed-on: Fediversity/Fediversity#297
Co-authored-by: Kiara Grouwstra <kiara@procolix.eu>
Co-committed-by: Kiara Grouwstra <kiara@procolix.eu>
2025-04-09 16:58:50 +02:00
535da821fd Display url after deployment (#287)
closes #264
Added a clickable link to the services that deployed.

Reviewed-on: Fediversity/Fediversity#287
Reviewed-by: kiara Grouwstra <kiara@procolix.eu>
Co-authored-by: lois <lois@procolix.eu>
Co-committed-by: lois <lois@procolix.eu>
2025-04-02 08:48:59 +02:00
88674c8efc Show if deployment succeeded (#283)
Show which services deployed and if so, the urls

Co-authored-by: kevin <kevin@procolix.com>
Reviewed-on: Fediversity/Fediversity#283
Reviewed-by: kiara Grouwstra <kiara@procolix.eu>
Co-authored-by: lois <lois@procolix.eu>
Co-committed-by: lois <lois@procolix.eu>
2025-03-28 13:36:02 +01:00
59f2ef1171 Remove print statements 2025-03-26 12:59:49 +01:00
7cfacc3306 Save before deployment 2025-03-26 12:56:52 +01:00
b4fbc457a6 Progress Indicator (#259)
closes #74
Show progress indicator to track deployment

- Disable deploy button when deployment is in progress.

Co-authored-by: kevin <kevin@procolix.com>
Reviewed-on: Fediversity/Fediversity#259
Reviewed-by: kiara Grouwstra <kiara@procolix.eu>
2025-03-26 10:14:06 +01:00
d78995b34c
make re-exports explicit again
Fediversity/Fediversity#269 (comment)
2025-03-25 08:43:45 +01:00
a5c310ad03 refactor variables (#269)
Reviewed-on: Fediversity/Fediversity#269
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-03-24 10:04:43 +01:00
f8ac63853c source htmx by nix (#268)
Reviewed-on: Fediversity/Fediversity#268
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-03-24 08:41:16 +01:00
af18b39b63 clean up shebang of manage.py (#271)
Reviewed-on: Fediversity/Fediversity#271
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-03-24 08:38:13 +01:00
de33e888c7 fix typo 2025-03-20 13:11:18 +01:00
658fa7ff60 add TODO, reformat 2025-03-20 13:09:46 +01:00
ee70a0026d
restore env vars in dev shell 2025-03-20 13:06:39 +01:00
1caf95dde1
fix CI 2025-03-20 12:56:25 +01:00
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 (#257)
removing fediversity.eu from form options as its subdomains are running live services

Reviewed-on: Fediversity/Fediversity#257
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 #76.

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 #247 2025-03-17 14:11:58 +01:00
08d109cc82 Remove versions 2025-03-13 15:31:09 +01:00
e41f9c572a add basic service configuration (#236)
- test the form interaction for a fixed schema version
- also add a database migration missed in the last commit

Closes #73

Reviewed-on: Fediversity/Fediversity#236
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