This repository has been archived on 2021-03-22. You can view files and clone it, but cannot push or open issues or pull requests.
backend/README.adoc

120 lines
4.1 KiB
Plaintext
Raw Normal View History

2020-06-29 03:01:30 +02:00
= fediblock-backend
:showtitle:
:toc: preamble
:project: fediblock-backend
2020-06-29 06:13:38 +02:00
:uri-base: https://schlomp.space/FediBlock/backend
2020-06-29 03:01:30 +02:00
:uri-branch-main: {uri-base}/src/branch/main
:uri-gcc: https://gcc.gnu.org/
:uri-clang: https://clang.llvm.org/
:uri-cmake: https://cmake.org/
:uri-catch: https://github.com/catchorg/Catch2
:uri-dpkg: https://packages.qa.debian.org/dpkg
:uri-rpm-build: http://www.rpm.org
:uri-clang-tidy: https://clang.llvm.org/extra/clang-tidy/
2020-06-29 06:35:19 +02:00
:uri-cgicc: https://www.gnu.org/software/cgicc/
:uri-nlohmann-json: https://nlohmann.github.io/json/
2020-07-01 03:51:00 +02:00
:uri-libgit2: https://libgit2.org/
2020-07-02 02:15:30 +02:00
:uri-libcurl: https://curl.haxx.se/libcurl/
2020-06-29 03:01:30 +02:00
*{project}* turns form data into JSON and opens a pull request on
2020-07-04 03:10:08 +02:00
link:https://schlomp.space/FediBlock/data[FediBlock/data]. Also included are
tools to generate a HTML list and (soon) an RSS generator.
2020-06-29 03:01:30 +02:00
2020-07-01 12:07:38 +02:00
== Usage
.nginx config
[source,nginx]
--------------------------------------------------------------------------------
# […]
2020-07-14 18:03:22 +02:00
expires 2h;
2020-07-01 12:07:38 +02:00
location /add {
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/run/cgi-fcgiwrap.socket-1;
fastcgi_param SCRIPT_FILENAME /usr/bin/fediblock-backend;
fastcgi_param HOME "/var/lib/nginx"; # When I didn't set it, HOME was /root.
}
2020-07-14 18:03:22 +02:00
location /rss {
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/run/cgi-fcgiwrap.socket-1;
fastcgi_param SCRIPT_FILENAME /usr/bin/fediblock-gen_rss;
fastcgi_param HOME "/var/lib/nginx";
}
2020-07-01 12:07:38 +02:00
--------------------------------------------------------------------------------
.Generate SSH key
[source,shell]
--------------------------------------------------------------------------------
sudo -u nginx ssh-keygen -t ed25519 -f ~nginx/.local/share/fediblock-backend/ssh_id
--------------------------------------------------------------------------------
Don't forget to add the key to the data repo.
2020-07-02 11:30:34 +02:00
Generate an access token and save it in
2020-07-14 18:03:22 +02:00
`~nginx/.local/share/fediblock-backend/gitea_access_token`.
2020-07-02 11:30:34 +02:00
=== Generate HTML blocklist
After compiling, run `src/generators/gen_html` in your build dir. The
screenshots will be copied into the target directory and the output will be the
HTML file.
.Example: Generate the HTML blocklist in `~/blocklist/`
[source,shell]
--------------------------------------------------------------------------------
./src/generators/gen_html ~/blocklist > ~/blocklist/index.html
--------------------------------------------------------------------------------
Existing screenshots will not be overwritten.
2020-06-29 03:01:30 +02:00
== Install
=== From source
==== Dependencies
* Tested OS: Linux
* C\++ compiler with C++17 support (tested: link:{uri-gcc}[GCC] 7/8/9/10,
link:{uri-clang}[clang] 6/7/10)
* link:{uri-cmake}[CMake] (at least: 3.10)
2020-06-29 06:48:22 +02:00
* link:{uri-cgicc}[cgicc] (tested: 3.2)
2020-06-29 09:09:37 +02:00
* link:{uri-nlohmann-json}[nlohmann-json] (tested: 3.7 / 2.1)
* link:{uri-libgit2}[libgit2] with SSH support (tested: 1.0 / 0.26)
2020-07-02 02:15:30 +02:00
* link:{uri-libcurl}[libcurl] (at least: 7.56)
2020-06-29 03:01:30 +02:00
* Optional
2020-06-29 09:09:37 +02:00
** Tests: link:{uri-catch}[Catch] (tested: 2.5 / 1.10)
2020-06-29 03:01:30 +02:00
** DEB package: link:{uri-dpkg}[dpkg] (tested: 1.19)
** RPM package: link:{uri-rpm-build}[rpm-build] (tested: 4.11)
==== Get sourcecode
[source,shell]
--------------------------------------------------------------------------------
2020-06-29 06:56:56 +02:00
git clone https://schlomp.space/FediBlock/backend.git
2020-06-29 03:01:30 +02:00
--------------------------------------------------------------------------------
==== Compile
[source,shell]
--------------------------------------------------------------------------------
mkdir -p build && cd build
cmake ..
cmake --build . -- --jobs=$(nproc --ignore=1)
--------------------------------------------------------------------------------
.CMake options:
* `-DCMAKE_BUILD_TYPE=Debug` for a debug build.
* `-DWITH_TESTS=YES` if you want to compile the tests.
* `-DWITH_CLANG-TIDY=YES` to check the sourcecode with
link:{uri-clang-tidy}[clang-tidy] while compiling.
* One of:
** `-DWITH_DEB=YES` if you want to be able to generate a deb-package.
** `-DWITH_RPM=YES` if you want to be able to generate an rpm-package.
To create a deb or rpm package, run `make package` after compiling.
include::{uri-base}/raw/branch/main/CONTRIBUTING.adoc[]