1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-11-24 08:57:03 -05:00

remove no longer used doc

This commit is contained in:
Michael Jerger 2024-05-31 18:05:29 +02:00
parent 17e3f6c6f3
commit 98939c4745
4 changed files with 0 additions and 201 deletions

View file

@ -1,65 +0,0 @@
# 2024-03 Ui-Work for Sending Like Activities
You can find this post here: https://domaindrivenarchitecture.org/posts/2024-03-27-state-of-federation/
# 2024-02 Considerations on Mapping and Architectural decisions
This month we discussed how a federated Person should be mapped to a local FederatedUser representation. Having a reliable mapping will be very important to trace code- / issue- and other ownerships.
I am very glad about the constructive & good discussion and many cool inputs. If you are interested in the federation related architecture you can have a sneak preview here: https://codeberg.org/meissa/forgejo/src/branch/forgejo-federated-star/docs/unsure-where-to-put/federation-architecture.md
Next an final step on our way to "federated Stars" will be "UI star triggers a federated Like Activity (in case of mirrored repos?)" - stay tuned for next month step :-).
In case of interest find the current roadmap at: https://codeberg.org/forgejo/forgejo/pulls/1680
# 2024-01 Federated staring with Like Activity
We did the next step. We now use a plain Like Activity for expressing the Star action.
In addition we fixed some bugs, made error responses more meaningful, improved security by validating every input we get on federation & mitigate identified threats (SlowLories, Replay Attacks, Block by future StartTime).
DOS attacks we now mitigate in our k8s ingress. Find the code in our [PR for c4k-forgejo](https://repo.prod.meissa.de/meissa/c4k-forgejo/pulls/3).
At https://federated-repo.prod.meissa.de/me/star-me you can try out the current code the same way as described above with the following activity (maybe find an unused user by alternating the actors user-id).
``` json
{
"id": "https://federated-repo.prod.meissa.de/api/v1/activitypub/user-id/1/outbox/12",
"type": "Like",
"actor": "https://federated-repo.prod.meissa.de/api/v1/activitypub/user-id/12",
"object": "https://federated-repo.prod.meissa.de/api/v1/activitypub/repository-id/1",
"startTime": "2024-01-05T23:00:00-08:00"
}
```
Please consider to increment the `startTime` for each api-request - maybe use the current time is a good idea.
In case of interest find the current roadmap at: https://codeberg.org/forgejo/forgejo/pulls/1680
# 2023-12 Federated staring open for test
Hey, we ar on our way to implement federated stars. We created a test instance to show the new feature - an now you can test federation live :-)
1. **The repo** ready to receive your star is located at: https://federated-repo.prod.meissa.de/me/star-me
2. **Post a star activity** at: https://federated-repo.prod.meissa.de/api/swagger#/activitypub/activitypubRepository & press the `Try It Out`` button. The input can look like: ![star-via-api.png](star-via-api.png)
3. Put "1" in to the repo & add the following payload
``` json
{
"id": "https://federated-repo.prod.meissa.de/api/v1/activitypub/user-id/1/outbox/12",
"type": "Star",
"source": "forgejo",
"actor": "https://federated-repo.prod.meissa.de/api/v1/activitypub/user-id/14",
"object": "https://federated-repo.prod.meissa.de/api/v1/activitypub/repository-id/1"
}
```
4. As every user can only put one star, we created 12 users for your experiment on our instance `"actor": "https://federated-repo.prod.meissa.de/api/v1/activitypub/user-id/2-13",`. But if you are on a forgejo instance having active `activitypub/user-id` api you can insert also your foreign-instance-user-uri here.
5. Press execute & visit again the repo (https://federated-repo.prod.meissa.de/me/star-me) and enjoy your star :-) ![find-your-new-star](find-your-new-star.png)
At the moment we discuss threats arising by this feature. If you are interested we will be happy to get your 2 cents here: https://codeberg.org/forgejo/forgejo/issues/1854
# 2023-11 Activities on "federated star"
We are on the way to implement the feature "federated star / unstar" activity end to end. The goal is to convince the codeberg team to switch this feature on as soon as possible.
At the moment we are implementing the good path. We've reached "create user from response" (see sequence diagram at https://codeberg.org/meissa/forgejo/src/branch/forgejo-federated-star/docs/unsure-where-to-put/threat_analysis_star_activity.md) - so you can expect the first curl-experiment-announcement in near future.
In parallel we start the discussion which new threats might be introduced with this feature. If you are interested in hacking or security, feel welcome to contribute to the threat discussion at: https://codeberg.org/forgejo/forgejo/issues/1854.

View file

@ -1,136 +0,0 @@
# enable federation
copy the app.ini in this folder in custom/conf in the forgejo root directory.
Then change the paths in app.ini accordingly to you local environment.
```
; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; ;
; ; SQLite Configuration
; ;
DB_TYPE = sqlite3
; defaults to data/gitea.db
PATH = /home/jem/repo/opensource/forgejo/data/gitea.db
; Query timeout defaults to: 500
SQLITE_TIMEOUT =
; defaults to sqlite database default (often DELETE), can be used to enable WAL mode. https://www.sqlite.org/pragma.html#pragma_journal_mode
SQLITE_JOURNAL_MODE =
HOST =
NAME =
USER =
PASSWD =
SCHEMA =
SSL_MODE = disable
LOG_SQL = false
[federation]
ENABLED = true
```
# build
```bash
TAGS="sqlite" make build
```
If you need to regenerate the api:
```bash
TAGS="sqlite" make build generate-swagger
```
# apply on k8s
```bash
kubectl exec -it forgejo-.. -- /bin/bash
su git
cd /app/gitea/
```
# launch local
```bash
# cleanup
./gitea admin user delete --purge -id 8
./gitea admin user delete --purge -id 9
./gitea admin user delete --purge -id 10
# create a user
./gitea admin user create --username me --password me --email "buero@meissa.de" --admin
./gitea admin user create --username stargoose1 --random-password --email "stargoose1@meissa.de"
./gitea admin user create --username stargoose2 --random-password --email "stargoose2@meissa.de"
./gitea admin user create --username stargoose3 --random-password --email "stargoose3@meissa.de"
./gitea admin user create --username stargoose4 --random-password --email "stargoose4@meissa.de"
./gitea admin user create --username stargoose5 --random-password --email "stargoose5@meissa.de"
./gitea admin user create --username stargoose6 --random-password --email "stargoose6@meissa.de"
./gitea admin user create --username stargoose7 --random-password --email "stargoose7@meissa.de"
./gitea admin user create --username stargoose8 --random-password --email "stargoose8@meissa.de"
./gitea admin user create --username stargoose9 --random-password --email "stargoose9@meissa.de"
./gitea admin user create --username stargoose10 --random-password --email "stargoose10@meissa.de"
./gitea admin user create --username stargoose11 --random-password --email "stargoose11@meissa.de"
./gitea admin user create --username stargoose12 --random-password --email "stargoose12@meissa.de"
./gitea admin user list
# create a token
./gitea admin user generate-access-token -u me -t token --scopes write:activitypub,write:repository,write:user
# create a repo
```bash
curl -X 'POST' \
'http://localhost:3000/api/v1/user/repos?token=ReplaceThisWithYourGeneratedToken' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"auto_init": false,
"default_branch": "main",
"description": "none",
"gitignores": "none",
"issue_labels": "",
"license": "apache",
"name": "repo",
"private": true,
"readme": "This is a readme",
"template": false,
"trust_model": "default"
}'
```
# Datastructures handy for local tests
## Star activity
```json
{
"id": "http://localhost:3000/api/v1/activitypub/user-id/1/outbox/12345",
"type": "Like",
"actor": "https://federated-repo.prod.meissa.de/api/v1/activitypub/user-id/13",
"object": "http://localhost:3000/api/v1/activitypub/repository-id/2",
"startTime": "2014-12-31T23:00:00-08:00"
}
```
# sync base branch
``` bash
# setup a second repo for excosy implementation
git clone https://git.exozy.me/a/gitea.git exosy
# add remotes
git remote add forgejo git@codeberg.org:forgejo/forgejo.git
# rebase on top of forgejo/forge-development
git switch forgejo
git fetch forgejo
git pull
git push
git switch forgejo-federated-star
git merge forgejo
git push
```
# generate swagger api client
go run github.com/go-swagger/go-swagger/cmd/swagger@v0.30.5 generate client -f './templates/swagger/v1_json.tmpl' -c "modules/activitypub2" --operation 'activitypubPerson' --skip-models --existing-models 'github.com/go-ap/activitypub' --skip-validation
# Documentation for learn & reference

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 KiB