view man/sciwebd.8.in @ 32:081e1c258e64

misc: update copyright years
author David Demelier <markand@malikania.fr>
date Thu, 04 Aug 2022 14:59:33 +0200
parents 67348ec46425
children
line wrap: on
line source

.\"
.\" Copyright (c) 2021-2022 David Demelier <markand@malikania.fr>
.\"
.\" Permission to use, copy, modify, and/or distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd June 30, 2021-2022
.Dt SCIWEBD 8
.Os
.\" NAME
.Sh NAME
.Nm sciwebd
.Nd CGI/FastCGI interface for sci
.\" SYNOPSIS
.Sh SYNOPSIS
.Nm
.Op Fl f
.Op Fl s Ar socket-file
.Op Fl t Ar theme
.\" DESCRIPTION
.Sh DESCRIPTION
The
.Nm
daemon is a
.Xr kcgi 3
based application to expose an HTTP interface for user statistics and a JSON API
for
.Xr sciworkerd 8
daemons. It requires a HTTP server running as proxy to handle
requests into it. See below for example of configuration.
.Pp
It is part of the
.Xr sci 7
continuous integration framework.
.Pp
The following options are available:
.Bl -tag -width "-s path"
.It Fl f
Runs as a FastCGI daemon.
.It Fl s Ar path
Connect to the UNIX local socket specified by
.Ar path .
.It Fl t Ar theme
Use
.Ar theme
as directory path for HTML pages.
.El
.\" CONFIGURATION
.Sh CONFIGURATION
The recommended way to use
.Nm
is to deploy using FastCGI. You can use the
.Xr kfcgi 8
helper to spawn the process for you.
.Pp
Example:
.Bd -literal -offset Ds
kfcgi -p /var/www/sci -- scid -f -d sci.db -t siimple
.Ed
.Pp
Note: kfcgi chroot to the directory given, you must either statically link
scid at build time or deploy all required libraries. Also, themes directory
will need to be available in the chroot directory. In the above example, this
will effectively create a database
.Pa /var/www/sci/sci.db
and use the theme
.Pa /var/www/sci/siimple .
.Pp
Then, simply copy the desired theme into the directory.
.Bd -literal -offset Ds
cp -R @SHAREDIR@/sci/themes/siimple /var/www/sci
.Ed
.Pp
As an
.Em insecure
alternative, you can chroot to
.Pa /
to avoid static-linking and copying themes, using:
.Bd -literal -offset Ds
kfcgi -p / -- scid -f \e
	-d /var/www/sci/sci.db \e
	-t @SHAREDIR@/sci/themes/siimple
.Ed
.Pp
Both kfcgi invocations will create
.Pa /var/www/run/http.sock
with current user and group. Configure the web server to talk to that socket
and make sure it has appropriate file permissions otherwise see
.Fl u
option in
.Nm kfcgi .
See also the
.Xr kfcgi 8
manual for more information.
.Pp
Next, configure the web server.
.Pp
Warning: at this moment,
.Nm
requires its own virtual host and can
.Em not
use a url.
.\" Server: nginx
.Ss Server: nginx
The nginx web server requires several parameters to run
.Nm .
.Bd -literal
server {
	server_name sci.example.org;
	listen 80;

	location / {
		fastcgi_param QUERY_STRING      query_string;
		fastcgi_param REQUEST_METHOD    $request_method;
		fastcgi_param CONTENT_TYPE      $content_type;
		fastcgi_param CONTENT_LENGTH    $content_length;
		fastcgi_param SCRIPT_FILENAME   $document_root$fastcgi_script_name;
		fastcgi_param SCRIPT_NAME       $fastcgi_script_name;
		fastcgi_param PATH_INFO         $document_uri;
		fastcgi_param PATH_TRANSLATED   $document_root$fastcgi_path_info;
		fastcgi_param REQUEST_URI       $request_uri;
		fastcgi_param DOCUMENT_URI      $document_uri;
		fastcgi_param DOCUMENT_ROOT     $document_root;
		fastcgi_param SERVER_PROTOCOL   $server_protocol;
		fastcgi_param GATEWAY_INTERFACE CGI/1.1;
		fastcgi_param SERVER_SOFTWARE   nginx/$nginx_version;
		fastcgi_param REMOTE_ADDR       $remote_addr;
		fastcgi_param REMOTE_PORT       $remote_port;
		fastcgi_param SERVER_ADDR       $server_addr;
		fastcgi_param SERVER_PORT       $server_port;
		fastcgi_param SERVER_NAME       $server_name;
		fastcgi_param HTTPS             $https;
		fastcgi_pass unix:/var/www/run/httpd.sock;
	}
}
.Ed
.\" SEE ALSO
.Sh SEE ALSO
.Xr sci 7 ,
.Xr scictl 8 ,
.Xr scid 8 ,
.Xr sciworkerd 8