diff --git a/docs/admin/01_install.rst b/docs/admin/01_install.rst index c84fbe3865f5bdc32394de59d03ef3a78e7a2fb5..7f8670bb30a5ba6a208e8721abf5cb2ded8c9263 100644 --- a/docs/admin/01_install.rst +++ b/docs/admin/01_install.rst @@ -7,7 +7,7 @@ From source In this section we will install AlekSIS with `uWSGI` and `nGINX` on debian bullseye. -0. Prerequisites:: +1. Prerequisites:: * Debian 11 @@ -15,14 +15,14 @@ bullseye. * Install system dependencies:: - $ apt install uwsgi uwsgi-plugin-python3 nginx-full python3.9 python3.9-dev libldap2-dev libsasl2-dev yarnpkg python3-virtualenv + $ apt install uwsgi uwsgi-plugin-python3 nginx-full python3.9 python3.9-dev libldap2-dev libsasl2-dev yarnpkg python3-virtualenv chromium redis-server * Create and activate virtual environment:: $ mkdir -p /srv/www/aleksis $ mkdir -p /srv/www/aleksis/data/{static,media} $ cd /srv/www/aleksis - $ virtualenv -p python3 --system-site-packages venv + $ python3 -m venv $ source /srv/www/aleksis/venv/bin/activate $ pip install poetry @@ -32,8 +32,8 @@ bullseye. $ sudo -u postgres createuser -l aleksis - $ sudo -u postgres createdb -O aleksis aleksis - * Configure uWSGI - .. code-block:: + * Configure uWSGI:: + $ editor /etc/uwsgi/apps-available/aleksis.ini [uwsgi] @@ -51,14 +51,15 @@ bullseye. $ ln -s /etc/uwsgi/apps-available/aleksis.ini /etc/uwsgi/apps-enabled/aleksis.ini $ service uwsgi restart + * Get SSL ssl certificate + * https://certbot.eff.org/instructions * Configure nGINX:: - .. code-block:: - $ editor /etc/nginx/sites-available/my.aleksis-instance.com + $ editor /etc/nginx/sites-available/aleksis.example.com server { listen 80; listen [::]:80; - server_name my.aleksis-instance.com my.aleksis-instance.com; + server_name aleksis.example.com; return 301 https://$server_name$request_uri; } @@ -67,11 +68,11 @@ bullseye. listen 443 ssl http2; listen [::]:443 ssl http2; - ssl_certificate /var/lib/dehydrated/certs/my.aleksis-instance.com/fullchain.pem; - ssl_certificate_key /var/lib/dehydrated/certs/my.aleksis-instance.com/privkey.pem; - ssl_trusted_certificate /var/lib/dehydrated/certs/my.aleksis-instance.com/chain.pem; + ssl_certificate /etc/letsencrypt/certs/aleksis.example.com/fullchain.pem; + ssl_certificate_key /etc/letsencrypt/certs/aleksis.example.com/privkey.pem; + ssl_trusted_certificate /etc/letsencrypt/certs/aleksis.example.com/chain.pem; - server_name my.aleksis-instance.com my.aleksis-instance.com; + server_name aleksis.example.com; access_log /var/log/nginx/access.log; @@ -88,11 +89,10 @@ bullseye. } } - $ ln -s /etc/nginx/sites-available/my.aleksis-instance.com /etc/nginx/sites-enabled/my.aleksis-instance.com + $ ln -s /etc/nginx/sites-available/aleksis.example.com /etc/nginx/sites-enabled/aleksis.example.com $ service nginx restart * Configure AlekSIS:: - .. code-block:: $ mkdir /etc/aleksis $ editor /etc/aleksis/aleksis.toml static = { root = "/srv/www/aleksis/data/static", url = "/static/" } @@ -100,7 +100,7 @@ bullseye. secret_key = "SomeRandomValue" [http] - allowed_hosts = ["my.aleksis-instance.com"] + allowed_hosts = ["aleksis.example.com"] [database] host = "localhost" @@ -108,35 +108,33 @@ bullseye. username = "aleksis" password = "SomeSecretPassword!1" -2. Clone git-Repository and checkout version:: +1. Clone git repository and checkout version:: $ cd /usr/src $ git clone https://edugit.org/AlekSIS/official/AlekSIS-Core $ cd AlekSIS-Core $ git checkout 2.0b -5. Install Dependencies and setup initially:: +1. Install dependencies and setup initially:: $ poetry install $ aleksis-admin yarn install $ aleksis-admin collectstatic $ aleksis-admin migrate -6. Restart uWSGI:: +1. Restart uWSGI:: $ service uwsgi restart Docker with `docker-compose` --------------------------- -0. Prerequisites:: +1. Prerequisites:: * System with docker and docker-compose installed 1. Run docker image:: - .. code-block:: - $ git clone https://edugit.org/AlekSIS/Official/AlekSIS $ docker-compose up -d diff --git a/docs/admin/04_celery_redis.rst b/docs/admin/04_celery_redis.rst deleted file mode 100644 index fe4061dd34a2aeb4e44005dd3ea38e6e93edbcaa..0000000000000000000000000000000000000000 --- a/docs/admin/04_celery_redis.rst +++ /dev/null @@ -1,46 +0,0 @@ -Asyncronous tasks with Celery -============================= - -Celery is able to run asyncronous tasks provided by AlekSIS, e.g. sending of notifications or backing up AlekSIS database and media. - -Celery and Celery beat worker ------------------------------ - -To run asyncronous Celery tasks, you will need a running Celery and Celery beat worker on your system. You can find instructions to run them via systemd in the `Celery docs`_ - -Enable celery in AlekSIS configuration --------------------------------------- - -To enable Celery in your AlekSIS instance, add the following to your ``/etc/aleksis/aleksis.toml``:: - - [default.celery] - enabled = true - -Celery with redis -================= - -Redis is a key-value database very similar to memecache. Redis provides natvie support for atomically querying and manipulating lists and sets. - -Install redis server --------------------- - -On Debian you just have to intall the ``redis-server`` package:: - - sudo apt install redis-server - -After you've installed the redis server, you should start it. If you're using systemd you can do this like this:: - - sudo service redis-server start - -For other operating systems please look into their package index. - -Enable redis in AlekSIS configuration -------------------------------------- - -To enable the Celery broker in your AlekSIS instance, add the following to your ``/etc/aleksis/aleksis.toml``:: - - [default.celery] - enabled = true - broker = true - -.. _Celery docs: https://docs.celeryproject.org/en/stable/userguide/daemonizing.html diff --git a/docs/admin/05_configuration_options.rst b/docs/admin/05_configuration_options.rst index 881e509df088faa0b020138155c8c2376b2bee8b..19321db371728406086e35e3a4d7dd1e6979f367 100644 --- a/docs/admin/05_configuration_options.rst +++ b/docs/admin/05_configuration_options.rst @@ -11,55 +11,52 @@ All settings which are required for running an AlekSIS instance are stored in yo Example configuration file:: # General config for static, media and secret key, required - [default] static = { root = "/srv/www/aleksis/data/static", url = "/static/" } media = { root = "/srv/www/aleksis/data/media", url = "/media/" } secret_key = "Xoc8eiwah3neehid2Xi3oomoh4laem" # Admin contat, optional - [default.contact] + [contact] admins = [["AlekSIS - Admins", "root@example.com"]] from = 'aleksis@example.com' # Allowed hosts, required - [default.http] + [http] allowed_hosts = ["localhost"] # Database for whole AlekSIS data, required - [default.database] + [database] host = "localhost" - engine = "django.db.backends.postgresql" name = "aleksis" username = "aleksis" password = "aleksis" # Maintenance mode and debug, optional - [default.maintenance] - statefile = '/var/cache/aleksis/maintenance_mode.txt' + [maintenance] debug = true # Two factor authentication with yubikey enabled, optional - [default.2fa] + [2fa] enabled = true yubikey = { enabled = true } # Authentication via LDAP, optional - [default.ldap] + [ldap] uri = "ldaps://ldap.myschool.edu" bind = { dn = "cn=reader,dc=myschool,dc=edu", password = "secret" } map = { first_name = "givenName", last_name = "sn", email = "mail" } - [default.ldap.users] + [ldap.users] search = { base = "ou=people,dc=myschool,dc=edu", filter = "(uid=%(user)s)" } - [default.ldap.groups] + [ldap.groups] search = { base = "ou=groups,dc=myschool,dc=edu" } type = "groupOfNames" # Users in group "admins" are superusers flags = { is_superuser = "cn=admins,ou=groups,dc=myschool,dc=edu" } # Search index, optional - [default.search] + [search] backend = "whoosh" index = "/srv/www/aleksis/data/whoosh_index" @@ -68,7 +65,4 @@ Configuration in frontend Everything that must not be configured before the AlekSIS instance fully starts can be configured in frontend, such as site title and logo. -You can find the configuration options in your AlekSIS instance under ``Admin → Configuration``. If you have not installed any additional apps, there the following options: - -.. automodule:: aleksis.core.preferences - :members: +You can find the configuration options in your AlekSIS instance under ``Admin → Configuration``. diff --git a/docs/conf.py b/docs/conf.py index 6f053e9f4013408dc4c2ebdae5fa9e3969a4da48..136f619aebbbcefc457b9e1d316c6aa70b670e7a 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -31,7 +31,7 @@ author = "AlekSIS team" # The short X.Y version version = "2.0" # The full version, including alpha/beta/rc tags -release = "2.0a3.dev0" +release = "2.0b0" # -- General configuration --------------------------------------------------- @@ -84,7 +84,7 @@ pygments_style = None # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. # -html_theme = "alabaster" +html_theme = "sphinx_materialdesign_theme" # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the diff --git a/docs/dev/05_extensible_models.rst b/docs/dev/05_extensible_models.rst index 1be12c0eae74ec8443ab20f2d6abf7047884f4f7..1e291b1a7d6c8d730020b755d891f5a2a19b99c5 100644 --- a/docs/dev/05_extensible_models.rst +++ b/docs/dev/05_extensible_models.rst @@ -7,13 +7,5 @@ apps models. If you want to make your apps models extensible, use the ``ExtensibleModel`` class as parent class of your models. -If you want to extend other apps extensible models, create a new file -``model_extensions.py``:: - - from django.utils.translation import gettext_lazy as _ - - from jsonstore import CharField - - from aleksis.core.models import Group - - Group.field(example=CharField(verbose_name=_("Example field"), blank=True)) +.. automodule:: aleksis.core.mixins + :members: diff --git a/docs/index.rst b/docs/index.rst index 11863e5e9bd4590693add06b465a73ca3152e14c..aded3b28d2e41186b0f871d0064627bc807a7a29 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -3,8 +3,8 @@ You can adapt this file completely to your liking, but it should at least contain the root `toctree` directive. -Welcome to AlekSIS’ documentation! -================================== +Welcome to AlekSIS-Core's documentation! +======================================== .. toctree:: :maxdepth: 2 diff --git a/poetry.lock b/poetry.lock index 95583fd255b979bb019a13d52186e8ec6f324d0d..61d9e7bf6c8b4a7830a843cec8e81c7322bbe7b6 100644 --- a/poetry.lock +++ b/poetry.lock @@ -8,7 +8,7 @@ python-versions = "*" [[package]] name = "aleksis-builddeps" -version = "3" +version = "4" description = "AlekSIS (School Information System) — Build/Dev dependencies for apps" category = "dev" optional = false @@ -27,7 +27,7 @@ flake8-docstrings = ">=1.5.0,<2.0.0" flake8-fixme = ">=1.1.1,<2.0.0" flake8-isort = ">=4.0.0,<5.0.0" flake8-mypy = ">=17.8.0,<18.0.0" -flake8-rst-docstrings = ">=0.1.0,<0.2.0" +flake8-rst-docstrings = ">=0.2.0,<0.3.0" freezegun = ">=1.1.0,<2.0.0" isort = ">=5.0.0,<6.0.0" pytest = ">=6.0,<7.0" @@ -39,6 +39,7 @@ safety = ">=1.8.5,<2.0.0" selenium = ">=3.141.0,<4.0.0" sphinx = ">=3.0,<4.0" sphinx-autodoc-typehints = ">=1.7,<2.0" +sphinx_materialdesign_theme = ">=0.1.11,<0.2.0" sphinxcontrib-django = ">=0.5.0,<0.6.0" [package.source] @@ -214,20 +215,20 @@ python-versions = "*" [[package]] name = "boto3" -version = "1.17.77" +version = "1.17.78" description = "The AWS SDK for Python" category = "main" optional = true python-versions = ">= 2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*" [package.dependencies] -botocore = ">=1.20.77,<1.21.0" +botocore = ">=1.20.78,<1.21.0" jmespath = ">=0.7.1,<1.0.0" s3transfer = ">=0.4.0,<0.5.0" [[package]] name = "botocore" -version = "1.20.77" +version = "1.20.78" description = "Low-level, data-driven core of boto 3." category = "main" optional = true @@ -1410,7 +1411,7 @@ flake8 = "*" [[package]] name = "flake8-rst-docstrings" -version = "0.1.2" +version = "0.2.3" description = "Python docstring reStructuredText (RST) validator" category = "dev" optional = false @@ -1418,7 +1419,6 @@ python-versions = ">=3.3" [package.dependencies] flake8 = ">=3.0.0" -pydocstyle = ">=3.0.0" pygments = "*" restructuredtext-lint = "*" @@ -2374,6 +2374,14 @@ Sphinx = ">=3.0" test = ["pytest (>=3.1.0)", "typing-extensions (>=3.5)", "sphobjinv (>=2.0)", "Sphinx (>=3.2.0)", "dataclasses"] type_comments = ["typed-ast (>=1.4.0)"] +[[package]] +name = "sphinx-materialdesign-theme" +version = "0.1.11" +description = "Sphinx Material Design Theme" +category = "dev" +optional = false +python-versions = "*" + [[package]] name = "sphinxcontrib-applehelp" version = "1.0.2" @@ -2671,8 +2679,7 @@ alabaster = [ {file = "alabaster-0.7.12.tar.gz", hash = "sha256:a661d72d58e6ea8a57f7a86e37d86716863ee5e92788398526d58b26a4e4dc02"}, ] aleksis-builddeps = [ - {file = "AlekSIS-Builddeps-3.tar.gz", hash = "sha256:04597e29a861e576d78adc068c9f1bf85450c81dc43cb1f7db0ed43e975b64a2"}, - {file = "AlekSIS_Builddeps-3-py3-none-any.whl", hash = "sha256:0de7fdf007afade836a6dcdbf47eb9fb702786572a8e511c6b6ae33ddce1dda6"}, + {file = "AlekSIS-Builddeps-4.tar.gz", hash = "sha256:aaaa22965228b9b9b7de812e3e7fa9cbfdbf8635bb22d6f3a201dc0cc6d8d307"}, ] amqp = [ {file = "amqp-5.0.6-py3-none-any.whl", hash = "sha256:493a2ac6788ce270a2f6a765b017299f60c1998f5a8617908ee9be082f7300fb"}, @@ -2736,12 +2743,12 @@ bleach = [ {file = "boolean.py-3.8.tar.gz", hash = "sha256:cc24e20f985d60cd4a3a5a1c0956dd12611159d32a75081dabd0c9ab981acaa4"}, ] boto3 = [ - {file = "boto3-1.17.77-py2.py3-none-any.whl", hash = "sha256:b434170484348b870e3624069ca577d38e52ace0229d0619d8368454bb66ad3b"}, - {file = "boto3-1.17.77.tar.gz", hash = "sha256:02835bcad77a5fda1fc376a824323779301ddf88f04a0ac16044d980f350c4a3"}, + {file = "boto3-1.17.78-py2.py3-none-any.whl", hash = "sha256:1a87855123df1f18081a5fb8c1abde28d0096a03f6f3ebb06bcfb77cdffdae5e"}, + {file = "boto3-1.17.78.tar.gz", hash = "sha256:2a5caee63d45fbdcc85e710c7f4146112f5d10b22fd0176643d2f2914cce54df"}, ] botocore = [ - {file = "botocore-1.20.77-py2.py3-none-any.whl", hash = "sha256:466ab5eac5e5735d573e83e84194585cac4e804d2b91b7bbe0351bcaff10df32"}, - {file = "botocore-1.20.77.tar.gz", hash = "sha256:b2a71043378687dc891997669830e8b61eaea656981059dbd4898825659df639"}, + {file = "botocore-1.20.78-py2.py3-none-any.whl", hash = "sha256:37105b9434d73f9c4d4960ee54c8eb129120f4c6681eb16edf483f03c5e2326d"}, + {file = "botocore-1.20.78.tar.gz", hash = "sha256:e74775f9e64e975787d76390fc5ac5aba875d726bb9ece3b7bd900205b430389"}, ] bs4 = [ {file = "bs4-0.0.1.tar.gz", hash = "sha256:36ecea1fd7cc5c0c6e4a1ff075df26d50da647b75376626cc186e2212886dd3a"}, @@ -3214,8 +3221,8 @@ flake8-polyfill = [ {file = "flake8_polyfill-1.0.2-py2.py3-none-any.whl", hash = "sha256:12be6a34ee3ab795b19ca73505e7b55826d5f6ad7230d31b18e106400169b9e9"}, ] flake8-rst-docstrings = [ - {file = "flake8-rst-docstrings-0.1.2.tar.gz", hash = "sha256:7d34d2175a0cd92aba0872ade74268b2f2c12582c7267d4a0e6ef1c32a828ce3"}, - {file = "flake8_rst_docstrings-0.1.2-py3-none-any.whl", hash = "sha256:73b5db2fd9d4d7c7e6b7767931730c4570e5a89f34a1501b837afb3b6d31537a"}, + {file = "flake8-rst-docstrings-0.2.3.tar.gz", hash = "sha256:3045794e1c8467fba33aaea5c246b8369efc9c44ef8b0b20199bb6df7a4bd47b"}, + {file = "flake8_rst_docstrings-0.2.3-py3-none-any.whl", hash = "sha256:565bbb391d7e4d0042924102221e9857ad72929cdd305b26501736ec22c1451a"}, ] freezegun = [ {file = "freezegun-1.1.0-py2.py3-none-any.whl", hash = "sha256:2ae695f7eb96c62529f03a038461afe3c692db3465e215355e1bb4b0ab408712"}, @@ -3822,6 +3829,9 @@ sphinx-autodoc-typehints = [ {file = "sphinx-autodoc-typehints-1.12.0.tar.gz", hash = "sha256:193617d9dbe0847281b1399d369e74e34cd959c82e02c7efde077fca908a9f52"}, {file = "sphinx_autodoc_typehints-1.12.0-py3-none-any.whl", hash = "sha256:5e81776ec422dd168d688ab60f034fccfafbcd94329e9537712c93003bddc04a"}, ] +sphinx-materialdesign-theme = [ + {file = "sphinx_materialdesign_theme-0.1.11.tar.gz", hash = "sha256:6e9dae4c6e5ba23c0657a94c1cf65f64be9c8bc1594a6fb41815f7daa3326aa9"}, +] sphinxcontrib-applehelp = [ {file = "sphinxcontrib-applehelp-1.0.2.tar.gz", hash = "sha256:a072735ec80e7675e3f432fcae8610ecf509c5f1869d17e2eecff44389cdbc58"}, {file = "sphinxcontrib_applehelp-1.0.2-py2.py3-none-any.whl", hash = "sha256:806111e5e962be97c29ec4c1e7fe277bfd19e9652fb1a4392105b43e01af885a"},