The Servala Self-Service Portal
Find a file
Tobias Brunner 15370f9739
All checks were successful
Build and Deploy Staging / build (push) Successful in 1m9s
Tests / test (push) Successful in 24s
Build and Deploy Staging / deploy (push) Successful in 7s
Merge pull request 'specify storage for static files' (#69) from staticfiles-storage into main
Reviewed-on: #69
2025-05-27 13:15:03 +00:00
.forgejo adapt renovate config to recommendations 2025-05-27 15:03:17 +02:00
deployment/kustomize Revert "configure django storages with env vars" 2025-05-27 11:25:39 +02:00
docker Add and document database cache 2025-03-26 15:40:33 +01:00
docs document models and admin 2025-04-15 10:36:08 +02:00
src specify storage for static files 2025-05-27 13:34:16 +02:00
.dockerignore dont include local sqlite file in docker build 2025-03-21 14:24:21 +01:00
.env.example Add and configure django-storages 2025-05-21 16:39:31 +02:00
.gitignore Add media and compiled static files to gitignore 2025-03-24 11:32:43 +01:00
.pre-commit-config.yaml add a pre-commit configuration 2025-03-07 09:21:48 +01:00
.python-version uv + Django[postgres] installation 2025-03-05 10:44:16 +01:00
Dockerfile add openssh client for staging env 2025-03-24 14:35:29 +01:00
LICENSE Initial commit 2025-03-03 15:26:47 +00:00
Makefile initial Antora boilerplate 2025-03-10 09:23:18 +01:00
playbook.yml correct url to codey instance 2025-04-04 17:07:43 +01:00
pyproject.toml Add and configure django-storages 2025-05-21 16:39:31 +02:00
README.md bump version 2025.04.14-0 -> 2025.04.14-1 2025-04-14 15:12:58 +02:00
renovate.json remove wrong secret ref 2025-05-27 15:11:51 +02:00
uv.lock Add and configure django-storages 2025-05-21 16:39:31 +02:00

Servala Portal

Servala Logo

The Servala Self-Service Portal

Latest release: 2025.04.14-1

Documentation

Available at https://docs.servala.com/.

The project documentation is written in AsciiDoc and built with Antora. It's automatically packaged and deployed by the CI/CD pipeline found in .forgejo/workflows/docs.yaml.

Paths:

  • docs/modules/ROOT/pages: Documentation pages
  • docs/modules/ROOT/assets/images: Images to be included in the documentation pages
  • docs/modules/ROOT/nav.adoc: Site navigation (new pages need to be added there)

Writing documentation is best done by running make docs-preview and connecting to the site at http://localhost:2020/. The browser add-on LiveReload - Web extension will help while editing with automated page reload in the browser.

Development setup

First, copy the .env.example file to .env and adjust the settings to your needs. Make sure to source the file before running any commands.

Then use uv to install the project and run its commands while youre developing:

uv sync --dev
uv run --env-file=.env src/manage.py migrate
uv run --env-file=.env src/manage.py createcachetable
uv run --env-file=.env src/manage.py runserver

This will start the development server on http://localhost:8000.

Configuration

Configuration happens using environment variables. See the available parameters in .env.example.

Code style and linting

Servala uses several linters / formatters to keep the project style consistent for you. Run them like this:

uv run black src/  # Code formatting; -c to just check
uv run isort src/  # Import ordering; -c to just check
uv run djlint src/ --reformat --format-js --format-css  # Format templates, JS and CSS, --check to just check
uv run flake8 src/  # Python linter

The repository features a pre-commit configuration which helps to properly format the source code before committing. It's recommended to install and use it.

Tests

Servala is tested via pytest. Run tests like this:

uv run --env-file=.env pytest

Docker

The project provides a Dockerfile which builds a production-ready container image. It uses Caddy to serve static files and connect to Gunicorn, the Python WSGI application server.

Building:

docker build -t local/servala-portal .

Running:

docker run --rm -ti -p 8080:8080 --name=servala-portal --rm --env-file .env local/servala-portal
docker exec -it servala-portal uv run src/manage.py createsuperuser

Then access it with http://localhost:8080/ and the Django admin with http://localhost:8080/admin

Deployment

Deployment files are in the deployment/kustomize folder and makes use of Kustomize to account for differences between the deployment stages. Stages are configured with overlays in deployment/kustomize/overlays/$environment.

Staging

The code is automatically built and deployed on a push to the main branch. See .forgejo/workflows/build-deploy-staging.yaml for the actual workflow.

Production

Building and deployment for production happens when a Git tag is pushed. See .forgejo/workflows/build-deploy-prod.yaml for the actual workflow.

Versioning

We're using CalVer as the versioning scheme. The tool bumpver helps us to automate the process.

To cut a new release run the following command to check what will happen:

uv run bumpver update -d

The run the following command to create a release:

uv run bumpver update

Maintenance and management commands

You can interface with the Django server and project by running commands like this:

uv run --env-file=.env src/manage.py COMMAND

Useful commands:

  • migrate: Make sure database migrations are applied.
  • showmigrations: Show current database migrations status. Good for debugging.
  • runserver: Run development server
  • clearsessions: Clear away expired user sessions. Recommended to run regularly, e.g. weekly or monthly (doesnt need to be frequent, but otherwise, the database is going to bloat eventually)
  • reencrypt_fields: Run after you changed your SERVALA_SECRET_KEY or SERVALA_SALT_KEY in order to use the new keys, and be able to retire the previous ones.
  • make_staff_user: Mark one or multiple users as staff users. Use --substring flag to e.g. match entire email domains.
  • make_superuser: Mark one given user (by email address) as superuser.