forked from fediversity/fediversity
Compare commits
6 commits
73c9c884d7
...
fc586273dc
Author | SHA1 | Date | |
---|---|---|---|
fc586273dc | |||
647d89798e | |||
65782c65ba | |||
857e1b12f5 | |||
6513150abd | |||
a3365eb508 |
11 changed files with 171 additions and 22 deletions
111
README.md
111
README.md
|
@ -4,7 +4,116 @@ This repository contains all the code and code-related files having to do with
|
||||||
[the Fediversity project](https://fediversity.eu/), with the notable exception
|
[the Fediversity project](https://fediversity.eu/), with the notable exception
|
||||||
of [NixOps4 that is hosted on GitHub](https://github.com/nixops4/nixops4).
|
of [NixOps4 that is hosted on GitHub](https://github.com/nixops4/nixops4).
|
||||||
|
|
||||||
## Content of this repository
|
## Goals
|
||||||
|
|
||||||
|
Decentralise the operational responsibility for social media.
|
||||||
|
Enable a more robust market of hosting providers, by making it easy to migrate operations and data to different providers.
|
||||||
|
|
||||||
|
Note that Fediversity is not about self-hosting.
|
||||||
|
There already exist solutions for self-hosting, but they're not suitable for what we're trying to do.
|
||||||
|
The ones we're aware of require substantial technical knowledge and time commitment by operators, especially for scaling to thousands of users.
|
||||||
|
Not everyone has the expertise and time to run their own server.
|
||||||
|
|
||||||
|
## Actors
|
||||||
|
|
||||||
|
- Fediversity project team
|
||||||
|
|
||||||
|
The group working on this repository.
|
||||||
|
We are creating the deployment workflows and service configurations.
|
||||||
|
|
||||||
|
The project partners for Fediversity are:
|
||||||
|
- [NLnet Foundation](https://nlnet.nl/)
|
||||||
|
- Open Internet Discourse Foundation
|
||||||
|
- [NORDUnet](https://nordu.net/)
|
||||||
|
- [Tweag](https://www.tweag.io/)
|
||||||
|
|
||||||
|
Refer to [fediversity.eu](https://fediversity.eu) for more details about the project.
|
||||||
|
|
||||||
|
- Hosting provider
|
||||||
|
|
||||||
|
They provide and maintain the physical infrastructure, and run the software in this repository, through which operators interact with their deployments.
|
||||||
|
Hosting providers are technical administrators for these deployments, ensuring availability and appropriate performance.
|
||||||
|
|
||||||
|
We target small- to medium-scale hosting providers with 20+ physical machines.
|
||||||
|
|
||||||
|
- Operator
|
||||||
|
|
||||||
|
They select the applications they want to run (Mastodon, Pixelfed, Matrix, etc.).
|
||||||
|
They don't need to own hardware or deal with operations.
|
||||||
|
Operators administer their services in a non-technical fashion, e.g. as moderators.
|
||||||
|
They pay the hosting provider for registering a domain name, maintaining physical resources, and monitoring deployments.
|
||||||
|
|
||||||
|
Initially, Fediversity is targeted at organisations, such as universities.
|
||||||
|
|
||||||
|
- User
|
||||||
|
|
||||||
|
They are individuals that are not necessarily affiliated with any organisation.
|
||||||
|
They register an account on services (e.g. Mastodon) run by the operators, and e.g. post content.
|
||||||
|
Users don’t need to administrate anything.
|
||||||
|
|
||||||
|
Given initial operators will be universities, users would be staff or students.
|
||||||
|
|
||||||
|
## Glossary
|
||||||
|
|
||||||
|
- [Fediverse](https://en.wikipedia.org/wiki/Fediverse)
|
||||||
|
|
||||||
|
A collection of social networking services that can communicate with each other using a common protocol.
|
||||||
|
|
||||||
|
- Service
|
||||||
|
|
||||||
|
A Fediverse application run by the hosting provider for an operator.
|
||||||
|
|
||||||
|
- Configuration
|
||||||
|
|
||||||
|
A collection of settings for a machine running NixOS.
|
||||||
|
|
||||||
|
> Example: Configurations are deployed to VMs.
|
||||||
|
|
||||||
|
- Provision
|
||||||
|
|
||||||
|
Make a resource, such as a virtual machine, available for use.
|
||||||
|
|
||||||
|
> Example: We use [Proxmox](https://www.proxmox.com) to provision VMs for services run by operators.
|
||||||
|
|
||||||
|
- Deploy
|
||||||
|
|
||||||
|
Put software, such as services, onto computers.
|
||||||
|
The software includes technical configuration that links software components.
|
||||||
|
Most user-facing configuration remains untouched by the deployment process.
|
||||||
|
|
||||||
|
> Example: NixOps4 is used to deploy [Pixelfed](https://pixelfed.org).
|
||||||
|
|
||||||
|
- Migrate
|
||||||
|
|
||||||
|
Move service configurations and user data to a different hosting provider.
|
||||||
|
|
||||||
|
- [NixOps4](https://github.com/nixops4/nixops4)
|
||||||
|
|
||||||
|
A tool for deploying and managing resources through the Nix language.
|
||||||
|
NixOps4 development is supported by the Fediversity project
|
||||||
|
|
||||||
|
- Resource
|
||||||
|
|
||||||
|
A [resource for NixOps4](https://nixops.dev/manual/development/concept/resource.html) is any external entity that can be declared with NixOps4 expressions and manipulated with NixOps4, such as a virtual machine, an active NixOS configuration, a DNS entry, or customer database.
|
||||||
|
|
||||||
|
- Resource provider
|
||||||
|
|
||||||
|
A resource provider for NixOps4 is an executable that communicates between a resource and NixOps4 using a standardised protocol, allowing [CRUD operations](https://en.wikipedia.org/wiki/Create,_read,_update_and_delete) on the resources to be performed by NixOps4.
|
||||||
|
Refer to the [NixOps4 manual](https://nixops.dev/manual/development/resource-provider/index.html) for details.
|
||||||
|
|
||||||
|
> Example: We need a resource provider for obtaining deployment secrets from a database.
|
||||||
|
|
||||||
|
## Development
|
||||||
|
|
||||||
|
All the code made for this project is freely licenced under [EUPL](https://en.m.wikipedia.org/wiki/European_Union_Public_Licence).
|
||||||
|
This means, anyone can use the work here to learn from it or change it according to their needs.
|
||||||
|
You can even read up on [development proceedings](https://git.fediversity.eu/Fediversity/meta).
|
||||||
|
|
||||||
|
Contact the project team if you have questions or suggestions, or if you're interested in using Fediversity software for your operations:
|
||||||
|
- E-mail: <mailto:contact@fediversity.eu>
|
||||||
|
- Mastodon: <https://mastodon.fediversity.eu/@fediversity>
|
||||||
|
|
||||||
|
### Content of this repository
|
||||||
|
|
||||||
Most of the directories in this repository have their own README going into more
|
Most of the directories in this repository have their own README going into more
|
||||||
details as to what they are for. As an overview:
|
details as to what they are for. As an overview:
|
||||||
|
|
|
@ -27,20 +27,31 @@ The Fediversity Panel is a web service for managing Fediversity deployments with
|
||||||
manage
|
manage
|
||||||
```
|
```
|
||||||
|
|
||||||
- Run the server locally
|
- With a fresh database, run:
|
||||||
|
|
||||||
|
```
|
||||||
|
manage migrate
|
||||||
|
```
|
||||||
|
|
||||||
|
- Run the server locally:
|
||||||
|
|
||||||
```shell-session
|
```shell-session
|
||||||
manage runserver
|
manage runserver
|
||||||
```
|
```
|
||||||
|
|
||||||
- Whenever you add a field in the database schema, run:
|
- Create an admin user:
|
||||||
|
|
||||||
```console
|
```shell-session
|
||||||
|
manage createsuperuser
|
||||||
|
```
|
||||||
|
|
||||||
|
and log in at <http://localhost:8000/admin>.
|
||||||
|
|
||||||
|
- After changing the database schema, add migrations and apply them:
|
||||||
|
|
||||||
|
```shell-session
|
||||||
manage makemigrations
|
manage makemigrations
|
||||||
```
|
|
||||||
|
|
||||||
Then before starting the server again, run:
|
|
||||||
|
|
||||||
```
|
|
||||||
manage migrate
|
manage migrate
|
||||||
```
|
```
|
||||||
|
|
||||||
|
- Use the [Django Debug Toolbar](https://github.com/django-commons/django-debug-toolbar) for troubleshooting in the browser
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
{
|
{
|
||||||
lib,
|
lib,
|
||||||
buildPythonPackage,
|
buildPythonPackage,
|
||||||
|
dj-database-url,
|
||||||
|
django-compressor,
|
||||||
|
django-debug-toolbar,
|
||||||
|
django-libsass,
|
||||||
|
django_4,
|
||||||
setuptools,
|
setuptools,
|
||||||
sqlite,
|
sqlite,
|
||||||
django_4,
|
|
||||||
django-compressor,
|
|
||||||
django-libsass,
|
|
||||||
dj-database-url,
|
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
src =
|
src =
|
||||||
|
@ -42,11 +43,12 @@ buildPythonPackage {
|
||||||
'';
|
'';
|
||||||
|
|
||||||
propagatedBuildInputs = [
|
propagatedBuildInputs = [
|
||||||
setuptools
|
|
||||||
django_4
|
|
||||||
django-compressor
|
|
||||||
django-libsass
|
|
||||||
dj-database-url
|
dj-database-url
|
||||||
|
django-compressor
|
||||||
|
django-debug-toolbar
|
||||||
|
django-libsass
|
||||||
|
django_4
|
||||||
|
setuptools
|
||||||
sqlite
|
sqlite
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -58,10 +58,13 @@ INSTALLED_APPS = [
|
||||||
'django.contrib.sessions',
|
'django.contrib.sessions',
|
||||||
'django.contrib.messages',
|
'django.contrib.messages',
|
||||||
'django.contrib.staticfiles',
|
'django.contrib.staticfiles',
|
||||||
|
'debug_toolbar',
|
||||||
'compressor',
|
'compressor',
|
||||||
]
|
]
|
||||||
|
|
||||||
MIDDLEWARE = [
|
MIDDLEWARE = [
|
||||||
|
# https://django-debug-toolbar.readthedocs.io/en/latest/installation.html#add-the-middleware
|
||||||
|
'debug_toolbar.middleware.DebugToolbarMiddleware',
|
||||||
'django.middleware.security.SecurityMiddleware',
|
'django.middleware.security.SecurityMiddleware',
|
||||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||||
'django.middleware.common.CommonMiddleware',
|
'django.middleware.common.CommonMiddleware',
|
||||||
|
@ -71,6 +74,12 @@ MIDDLEWARE = [
|
||||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# https://django-debug-toolbar.readthedocs.io/en/latest/installation.html#configure-internal-ips
|
||||||
|
INTERNAL_IPS = [
|
||||||
|
"127.0.0.1",
|
||||||
|
"[::1]",
|
||||||
|
]
|
||||||
|
|
||||||
ROOT_URLCONF = 'panel.urls'
|
ROOT_URLCONF = 'panel.urls'
|
||||||
|
|
||||||
TEMPLATES = [
|
TEMPLATES = [
|
||||||
|
|
|
@ -16,10 +16,11 @@
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<header>
|
<header>
|
||||||
|
{% load custom_tags %}
|
||||||
{% if user.is_authenticated %}
|
{% if user.is_authenticated %}
|
||||||
<p>Welcome, {{ user.username }}! <a href="{% url 'logout' %}?next={{ request.path }}">Logout</a></p>
|
<p>Welcome, {{ user.username }}! <a href="{% auth_url 'logout' %}">Logout</a></p>
|
||||||
{% else %}
|
{% else %}
|
||||||
<p><a href="{% url 'login' %}?next={{ request.path }}">Login</a></p>
|
<p><a href="{% auth_url 'login' %}">Login</a></p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</header>
|
</header>
|
||||||
{% block navigation %}
|
{% block navigation %}
|
||||||
|
|
0
panel/src/panel/templatetags/__init__.py
Normal file
0
panel/src/panel/templatetags/__init__.py
Normal file
16
panel/src/panel/templatetags/custom_tags.py
Normal file
16
panel/src/panel/templatetags/custom_tags.py
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
from django import template
|
||||||
|
from django.urls import reverse
|
||||||
|
from urllib.parse import urlencode
|
||||||
|
|
||||||
|
register = template.Library()
|
||||||
|
|
||||||
|
@register.simple_tag(takes_context=True)
|
||||||
|
def auth_url(context, action):
|
||||||
|
"""Generate login/logout URL with current path as redirect."""
|
||||||
|
request = context['request']
|
||||||
|
view = context.get('view')
|
||||||
|
redirect_field_name = getattr(view, 'redirect_field_name', 'next')
|
||||||
|
|
||||||
|
base_url = reverse(action)
|
||||||
|
query_params = {redirect_field_name: request.path}
|
||||||
|
return f"{base_url}?{urlencode(query_params)}"
|
|
@ -20,8 +20,9 @@ from panel import views
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path('admin/', admin.site.urls),
|
path('admin/', admin.site.urls),
|
||||||
|
path("debug/", include("debug_toolbar.urls")),
|
||||||
path('', views.Index.as_view(), name='index'),
|
path('', views.Index.as_view(), name='index'),
|
||||||
path("", include("django.contrib.auth.urls")),
|
path("", include("django.contrib.auth.urls")),
|
||||||
path("account/", views.AccountDetail.as_view(), name='accountdetail')
|
path("account/", views.AccountDetail.as_view(), name='account_detail'),
|
||||||
path("services/", views.ServiceList.as_view(), name='service_list'),
|
path("services/", views.ServiceList.as_view(), name='service_list'),
|
||||||
]
|
]
|
||||||
|
|
|
@ -8,7 +8,7 @@ class Index(TemplateView):
|
||||||
|
|
||||||
class AccountDetail(LoginRequiredMixin, DetailView):
|
class AccountDetail(LoginRequiredMixin, DetailView):
|
||||||
model = User
|
model = User
|
||||||
template_name = 'accountdetail.html'
|
template_name = 'account_detail.html'
|
||||||
def get_object(self):
|
def get_object(self):
|
||||||
return self.request.user
|
return self.request.user
|
||||||
|
|
||||||
|
|
|
@ -97,7 +97,7 @@ nix build .#checks.<system>.<test>.driverInteractive
|
||||||
- Tutorial for setting up better logging: https://krisztianfekete.org/self-hosting-mastodon-on-nixos-a-proof-of-concept/
|
- Tutorial for setting up better logging: https://krisztianfekete.org/self-hosting-mastodon-on-nixos-a-proof-of-concept/
|
||||||
- Setting up mastodon development environment: https://docs.joinmastodon.org/dev/setup/
|
- Setting up mastodon development environment: https://docs.joinmastodon.org/dev/setup/
|
||||||
|
|
||||||
- Tutorial for PeerTube that doesn't use `createLocally`: https://nixos.wiki/wiki/PeerTube
|
- Tutorial for PeerTube that doesn't use `createLocally`: https://wiki.nixos.org/wiki/PeerTube
|
||||||
|
|
||||||
- garage settings for specific apps: https://garagehq.deuxfleurs.fr/documentation/connect/apps/
|
- garage settings for specific apps: https://garagehq.deuxfleurs.fr/documentation/connect/apps/
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue