]> git.mxchange.org Git - fba.git/blob - docs/README.md
Continued:
[fba.git] / docs / README.md
1 # Fedi block API
2
3 Used to see which instances block yours.
4
5 ## software used:
6
7 - python 3.9/3.11
8 - distribution's own:
9  - python3-fastapi (and all dependencies)
10  - python3-jinja2
11  - python3-aiofiles needs to be installed unter Python 3.9
12
13 ## Installation
14
15 Create role-based user:
16
17 ```bash
18 sudo useradd --home-dir=/opt/fedi-block-api --comment "Fedi Block API" --user-group --create-home fba
19 sudo mkdir -p /opt/fedi-block-api
20 sudo chown -R fba:fba /opt/fedi-block-api
21 ```
22
23 Install software:
24
25 ```bash
26 # Change to role-based user 'fba'
27 sudo -Hu fba su -
28
29 # Clone code
30 git clone git://git.mxchange.org/fba.git
31
32 # Change to fba:
33 cd fba
34
35 # You MUST create a virtual environment:
36 python3 -m venv --system-site-packages venv
37
38 # Add this to your ~/.bashrc file
39 source "${HOME}/fba/venv/bin/activate"
40
41 # Install all requirements
42 pip3 install -r requirements.txt
43
44 # Create blocks.db
45 cp blocks_empty.db blocks.db
46
47 # Create configuration file
48 cp config.defaults.json config.json
49 ```
50
51 Run commands, they should not fail!
52
53 ```bash
54 # Run commands, they should not fail!
55 ./fba.py fetch_instances --domain=mastodon.social # try a bunch of large servers here
56 ```
57
58 ### Alter configuration file
59 You maybe wish to change the configuration file, e.g. log_level is set to "info" which is the default but invates privacy of your users, but your choice:
60
61 ```
62     "critical"
63     "error"
64     "warning"
65     "info"
66     "debug"
67     "trace"
68 ```
69
70 ### Fetch blocklists locally (WIP)
71 To save yourself bandwidth and codeberg, too, you want to clone the blocklists from some folks:
72
73 ```
74 git clone https://codeberg.org/oliphant/blocklists.git blocklists/oliphant/
75 ```
76
77 WIP notice: This feature is not implemented yet.
78
79 ### Install the services
80
81 ```bash
82 sudo cp services/* /etc/systemd/system
83 ```
84
85 ### start the services
86
87 ```bash
88 systemctl enable --now fetch_blocks
89 systemctl enable --now fedi_block_api
90 ```
91
92 ## Try it out
93
94 https://fba.ryona.agency/ uses an older code than this one. So it doesn't reflect this code here. My FBA sub-domain is currently password-protected as I still need to fix some performance issues with large blocking lists.
95
96 ## Maintenance
97
98 Run these SQL queries from time to time. They always should return zero.
99
100 ```sql
101 SELECT COUNT(blocked) AS cnt FROM blocks LEFT JOIN instances ON blocks.blocked = instances.domain OR blocks.blocker = instances.domain WHERE domain IS NULL LIMIT 1;
102 SELECT COUNT(domain) AS cnt FROM instances WHERE nodeinfo_url IS NOT NULL AND software IS NULL LIMIT 1;
103 ```
104 ## License
105
106 [AGPLv3](https://gnu.org)