Mercurial > sci
diff man/sci.7 @ 66:5076be758687 0.1.0
misc: update before 0.1.0 release
author | David Demelier <markand@malikania.fr> |
---|---|
date | Sat, 20 Aug 2022 10:36:55 +0200 |
parents | 562372396019 |
children | 71cd8447e3a4 |
line wrap: on
line diff
--- a/man/sci.7 Thu Aug 18 20:21:33 2022 +0200 +++ b/man/sci.7 Sat Aug 20 10:36:55 2022 +0200 @@ -45,8 +45,9 @@ o ---- scictl / scid (HTTP) o - \\ - o ---- sciworkerd + | \\ + | o ---- sciworkerd + SQLite .Ed .Pp The @@ -68,7 +69,7 @@ and output their result. .\" ENTITIES .Sh ENTITIES -The process handle different kind of entities in the database. +The process handles different kind of entities in the database. .\" PROJECTS .Ss PROJECTS A project is a user description of what to be automated and tested. It has a @@ -131,13 +132,88 @@ require to perform requests. Use the .Cm api-get command to get that key. +.Pp +The +.Xr scid 8 +program isn't a daemon by itself but a CGI or FastCGI process which needs to be +coupled with a dedicated web server. For the example let's use nginx and the +.Xr kfcgi 8 +utility to spawn our FastCGI process. +.Pp +Configure the nginx server to include at least the following code snippet for a +specific virtual host (the +.Xr scid 8 +process explicitly requires its own virtual host). .Bd -literal -offset indent -$ scid -Or -$ scid -d /var/db/scid.db +server { + server_name sci.myhostname.fr; + 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 .Pp -Retrieve the stored key: +Now, start the process using +.Xr kfcgi 8 . +It is recommended though, that the process lives in a clean chroot but in the +example we will skip that because +.Xr scid 8 +cannot be built as static binary yet, you could as an alternative setup a +chroot where all required libraries are available in order to run +.Xr scid 8 +inside of it. +.Pp +We will assume that the webserver is running with +.Em www +user and group which is the default also used with +.Xr kfcgi 8 +utility. The webserver must have read/write access to the UNIX socket generated +with +.Xr kfcgi 8 . +.Pp +This command needs to be ran as root but it will drop privileges to +appropriate users and groups. See +.Xr kfcgi 8 +for more details. +.Bd -literal -offset indent +# kfcgi -p / -- scid -f +Or +# kfcgi -p / -u www -U www -- scid -f -d /path/to/sci.db -t /path/to/theme +Or if you have a functional chroot (scid path is relative to it) +# kfcgi -p /srv/sci -- /usr/bin/scid -f +.Ed +.Pp +Make sure that +.Xr scid 8 +get read/write access to the default database path if you're not using the +.Fl d +option. Also don't forget the +.Fl f +option which indicates the process to run as FastCGI rather than plain CGI. +.Pp +If the command succeeded, Retrieve the stored key: .Bd -literal -offset indent $ scid api-get 1234567890secretABCDEF @@ -181,8 +257,8 @@ script code remotely! .Bd -literal -offset indent $ sciworkerd -Or -$ sciworkerd -j2 +Or more secure alternative +# chroot /src/sci /usr/bin/sciworkerd -j2 .Ed .Pp Please make sure to read @@ -216,7 +292,12 @@ .Pp And after that, any .Xr sciworkerd 8 -instance will fetch the job, run it and send the result. +instance will fetch the job, run it and send the result. It is best used with +your SCM to add automatic job when pushing changes. +.Pp +Note: Jobs that are created before the registration of a worker won't be +executed as it would create a high number of jobs to be performed each time you +create a new worker. .\" SEE ALSO .Sh SEE ALSO .Xr scictl 8 ,