Add documentation

Signed-off-by: Sam Therapy <sam@samtherapy.net>

FossilOrigin-Name: ab203f0e353419045687c2cc1db7879369db0fe3accdcc0f8a43ab926b8940f0
This commit is contained in:
Sam Therapy 2022-03-18 18:39:26 +00:00
parent 74339555f3
commit 53bfbe94a5
4 changed files with 89 additions and 1 deletions

40
INSTALL.md Normal file
View file

@ -0,0 +1,40 @@
# Installing Treebird
## Compiling
You need the following libraries / packages:
- libcurl
- Debian: `libcurl4-gnutls-dev`
- libcjson
- Debian: `libcjson-dev`
- Arch: `cjson`
- libpcre3
- Debian: `libpcre3-dev`
First, edit `config.h` to your instance's liking.
`make` will clone the library, and compile both it and the project.
`make update` should be run after updating, as it ensures both the library and the project are up to date.
## Deploying
After running `make`, Treebird's files will be in the `dist/` directory. _Copy_, ***DO NOT MOVE***, **everything but treebird.cgi** of this folder to your web server. Copy `treebird.cgi` to another directory of your choosing.
- The example static files will be in `/var/www/treebird/`, with `treebird.cgi` in `/usr/local/bin/treebird.cgi`.
### Using NGINX (and uWSGI) to serve Treebird
Treebird can be served over nginx by using a CGI server such as uwsgi.
#### nginx
An example nginx configuration is available in [treebird.nginx.conf](./treebird.nginx.conf).
* Make sure to change `example.com` to your instance's domain.
* Make sure to change the `root` to wherever the static files are being stored
#### uWSGI
uWSGI can be installed on debian with just `sudo apt isntall uwsgi`.
An example configuration is available in [treebird.uwsgi.ini](./treebird.uwsgi.ini). This should be copied to `/etc/uwsgi/apps-enabled/treebird.ini` on debian (and potentially other) systems.
##### Note: the uwsgi configuration file is currently very basic.

View file

@ -14,5 +14,8 @@ No.
## Credits
Please view the `CREDITS` file.
Please view the [`CREDITS`](./CREDITS) file.
## Installing
See [INSTALL.md](./INSTALL.md)

38
treebird.nginx.conf Normal file
View file

@ -0,0 +1,38 @@
server {
root /var/www/treebird;
server_name treebird.example.com;
location @treebird {
include uwsgi_params;
uwsgi_modifier1 9;
uwsgi_pass unix:///run/uwsgi/treebird.sock;
}
location / {
root /var/www/treebird;
try_files $uri @treebird;
}
listen [::]:443 ssl; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/treebird.example.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/treebird.example.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
if ($host = treebird.example.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
listen [::]:80;
server_name treebird.example.com;
return 404; # managed by Certbot
}

7
treebird.uwsgi.ini Normal file
View file

@ -0,0 +1,7 @@
[uwsgi]
master = true
plugins = cgi
socket = /run/uwsgi/%n.sock
uid = www-data
gid = www-data
cgi = /usr/local/bin/treebird.cgi