Fossil SCM

Assorted updates surrounding my fslsrv wrapper: * Reflected improvements from the tangentsoft.com version into this simpler alternative. Although we don't generally recommend use of this script any more, preferring systemd to get autostart on boot and autorestart on crash, www/server/any/none.md still refers to this script, and it feels like a regression to remove it. If someone is interested in simple-as-possible SCGI service, fslsrv is a fit companion. * Removed direct reference to fslsrv from www/server/debian/service.md since the indirect reference via the SCGI doc suffices. * The full-strength nginx doc now refers to both of these fslsrv variants in a handwavy way, since it's outside the scope of that doc to care how you get your background SCGI servers running.

wyoung 2022-10-07 22:15 trunk
Commit 1cbcb38cc9b6de0aaaee4aff08a3ea90a2fe2744de47a213ac4a46b81492bac5
+18 -12
--- tools/fslsrv
+++ tools/fslsrv
@@ -1,10 +1,11 @@
11
#!/bin/bash
2
-BASEPORT=12345
32
FOSSIL=fossil
3
+PGARGS="-P 1"
44
OLDPID=`pgrep -P 1 fossil`
5
-PGARGS="-P 1"
5
+SITE=https://example.com
6
+PORT=12345
67
78
if [ "$1" = "-f" ] ; then PGARGS= ; shift ; fi
89
910
if [ -n "$OLDPID" ]
1011
then
@@ -37,17 +38,22 @@
3738
FOSSIL=./fossil
3839
fi
3940
4041
function start_one() {
4142
bn=$1
42
- port=$(($BASEPORT + $2))
43
- url="$3"
44
- if [ -n "$url" ] ; then baseurl="--baseurl $url" ; fi
45
-
46
- $FOSSIL server --localhost --port $port --scgi $baseurl \
47
- --errorlog ~/log/fossil/$bn-errors.log \
48
- ~/museum/$bn.fossil > ~/log/fossil/$bn-stdout.log &
49
- echo Fossil server running for $bn, PID $!, port $port.
43
+ ln="$2"
44
+
45
+ $FOSSIL server $extra \
46
+ --scgi \
47
+ --localhost \
48
+ --port $PORT \
49
+ --jsmode bundled \
50
+ --baseurl ${SITE}/$bn \
51
+ --errorlog ~/log/fossil/$bn-errors.log \
52
+ ~/museum/$bn.fossil > ~/log/fossil/$bn-stdout.log &
53
+ echo Started $ln Fossil server, port $PORT, PID $!.
54
+ PORT=$(($PORT + 1))
5055
}
5156
52
-start_one example 0 https://example.com/code
53
-start_one foo 1 # https://foo.net
57
+start_one first "First Project"
58
+start_one second "Second Project"
59
+start_one third "Third Project"
5460
--- tools/fslsrv
+++ tools/fslsrv
@@ -1,10 +1,11 @@
1 #!/bin/bash
2 BASEPORT=12345
3 FOSSIL=fossil
 
4 OLDPID=`pgrep -P 1 fossil`
5 PGARGS="-P 1"
 
6
7 if [ "$1" = "-f" ] ; then PGARGS= ; shift ; fi
8
9 if [ -n "$OLDPID" ]
10 then
@@ -37,17 +38,22 @@
37 FOSSIL=./fossil
38 fi
39
40 function start_one() {
41 bn=$1
42 port=$(($BASEPORT + $2))
43 url="$3"
44 if [ -n "$url" ] ; then baseurl="--baseurl $url" ; fi
45
46 $FOSSIL server --localhost --port $port --scgi $baseurl \
47 --errorlog ~/log/fossil/$bn-errors.log \
48 ~/museum/$bn.fossil > ~/log/fossil/$bn-stdout.log &
49 echo Fossil server running for $bn, PID $!, port $port.
 
 
 
 
50 }
51
52 start_one example 0 https://example.com/code
53 start_one foo 1 # https://foo.net
 
54
--- tools/fslsrv
+++ tools/fslsrv
@@ -1,10 +1,11 @@
1 #!/bin/bash
 
2 FOSSIL=fossil
3 PGARGS="-P 1"
4 OLDPID=`pgrep -P 1 fossil`
5 SITE=https://example.com
6 PORT=12345
7
8 if [ "$1" = "-f" ] ; then PGARGS= ; shift ; fi
9
10 if [ -n "$OLDPID" ]
11 then
@@ -37,17 +38,22 @@
38 FOSSIL=./fossil
39 fi
40
41 function start_one() {
42 bn=$1
43 ln="$2"
44
45 $FOSSIL server $extra \
46 --scgi \
47 --localhost \
48 --port $PORT \
49 --jsmode bundled \
50 --baseurl ${SITE}/$bn \
51 --errorlog ~/log/fossil/$bn-errors.log \
52 ~/museum/$bn.fossil > ~/log/fossil/$bn-stdout.log &
53 echo Started $ln Fossil server, port $PORT, PID $!.
54 PORT=$(($PORT + 1))
55 }
56
57 start_one first "First Project"
58 start_one second "Second Project"
59 start_one third "Third Project"
60
--- www/server/debian/nginx.md
+++ www/server/debian/nginx.md
@@ -109,18 +109,22 @@
109109
110110
111111
## <a id="scgi"></a>Running Fossil in SCGI Mode
112112
113113
For the following nginx configuration to work, it needs to contact a
114
-Fossil instance speaking the SCGI protocol. There are [many ways](../)
115
-to set that up. For Debian type systems, we recommend
116
-following [our systemd system service guide](service.md).
114
+background Fossil instance speaking the SCGI protocol. There are
115
+[many ways](../) to set that up, such as [with `systemd`](./service.md)
116
+on mainstream Linux distros. Another way is to [containerize][ctz] your
117
+repository servers, then use the [`fslsrv` wrapper for Podman][fspm] to
118
+generate `systemd` units for use by the front-end proxy.
117119
118
-There are other ways to arrange for Fossil to run as a service backing
119
-nginx, but however you do it, you need to match up the TCP port numbers between it
120
+However you do it, you need to match up the TCP port numbers between it
120121
and those in the nginx configuration below.
121122
123
+[ctz]: ../../containers.md
124
+[fspm]: https://tangentsoft.com/fossil/dir/bin
125
+
122126
123127
## <a id="config"></a>Configuration
124128
125129
On Debian and Ubuntu systems the primary user-level configuration file
126130
for nginx is `/etc/nginx/sites-enabled/default`. I recommend that this
127131
--- www/server/debian/nginx.md
+++ www/server/debian/nginx.md
@@ -109,18 +109,22 @@
109
110
111 ## <a id="scgi"></a>Running Fossil in SCGI Mode
112
113 For the following nginx configuration to work, it needs to contact a
114 Fossil instance speaking the SCGI protocol. There are [many ways](../)
115 to set that up. For Debian type systems, we recommend
116 following [our systemd system service guide](service.md).
 
 
117
118 There are other ways to arrange for Fossil to run as a service backing
119 nginx, but however you do it, you need to match up the TCP port numbers between it
120 and those in the nginx configuration below.
121
 
 
 
122
123 ## <a id="config"></a>Configuration
124
125 On Debian and Ubuntu systems the primary user-level configuration file
126 for nginx is `/etc/nginx/sites-enabled/default`. I recommend that this
127
--- www/server/debian/nginx.md
+++ www/server/debian/nginx.md
@@ -109,18 +109,22 @@
109
110
111 ## <a id="scgi"></a>Running Fossil in SCGI Mode
112
113 For the following nginx configuration to work, it needs to contact a
114 background Fossil instance speaking the SCGI protocol. There are
115 [many ways](../) to set that up, such as [with `systemd`](./service.md)
116 on mainstream Linux distros. Another way is to [containerize][ctz] your
117 repository servers, then use the [`fslsrv` wrapper for Podman][fspm] to
118 generate `systemd` units for use by the front-end proxy.
119
120 However you do it, you need to match up the TCP port numbers between it
 
121 and those in the nginx configuration below.
122
123 [ctz]: ../../containers.md
124 [fspm]: https://tangentsoft.com/fossil/dir/bin
125
126
127 ## <a id="config"></a>Configuration
128
129 On Debian and Ubuntu systems the primary user-level configuration file
130 for nginx is `/etc/nginx/sites-enabled/default`. I recommend that this
131
--- www/server/debian/service.md
+++ www/server/debian/service.md
@@ -51,14 +51,15 @@
5151
We’ve told `systemd` that we want automatic service restarts with
5252
back-off logic, making this much more robust than the by-hand launches
5353
of `fossil` in the platform-independent Fossil server instructions. The
5454
service will stay up until we explicitly tell it to shut down.
5555
56
-A simple and useful modification to the above scheme is to add the
57
-`--scgi` and `--localhost` flags to the `ExecStart` line to replace the
58
-use of `fslsrv` in [the generic SCGI instructions](../any/scgi.md),
59
-giving a much more robust configuration.
56
+This scheme couples well with [the generic SCGI instructions][scgi] as
57
+it requires a way to run the underlying repository server in the
58
+background. Given that its service port is then proxied by SCGI, it
59
+follows that it doesn’t need to run as a system service. A user service
60
+works perfectly well for this.
6061
6162
Because we’ve set this up as a user service, the commands you give to
6263
manipulate the service vary somewhat from the sort you’re more likely to
6364
find online:
6465
@@ -83,10 +84,12 @@
8384
8485
$ sudo loginctl enable-linger $USER
8586
8687
You can paste the command just like that into your terminal, since
8788
`$USER` will expand to your login name.
89
+
90
+[scgi]: ../any/scgi.md
8891
8992
9093
9194
### System Service Alternative
9295
9396
--- www/server/debian/service.md
+++ www/server/debian/service.md
@@ -51,14 +51,15 @@
51 We’ve told `systemd` that we want automatic service restarts with
52 back-off logic, making this much more robust than the by-hand launches
53 of `fossil` in the platform-independent Fossil server instructions. The
54 service will stay up until we explicitly tell it to shut down.
55
56 A simple and useful modification to the above scheme is to add the
57 `--scgi` and `--localhost` flags to the `ExecStart` line to replace the
58 use of `fslsrv` in [the generic SCGI instructions](../any/scgi.md),
59 giving a much more robust configuration.
 
60
61 Because we’ve set this up as a user service, the commands you give to
62 manipulate the service vary somewhat from the sort you’re more likely to
63 find online:
64
@@ -83,10 +84,12 @@
83
84 $ sudo loginctl enable-linger $USER
85
86 You can paste the command just like that into your terminal, since
87 `$USER` will expand to your login name.
 
 
88
89
90
91 ### System Service Alternative
92
93
--- www/server/debian/service.md
+++ www/server/debian/service.md
@@ -51,14 +51,15 @@
51 We’ve told `systemd` that we want automatic service restarts with
52 back-off logic, making this much more robust than the by-hand launches
53 of `fossil` in the platform-independent Fossil server instructions. The
54 service will stay up until we explicitly tell it to shut down.
55
56 This scheme couples well with [the generic SCGI instructions][scgi] as
57 it requires a way to run the underlying repository server in the
58 background. Given that its service port is then proxied by SCGI, it
59 follows that it doesn’t need to run as a system service. A user service
60 works perfectly well for this.
61
62 Because we’ve set this up as a user service, the commands you give to
63 manipulate the service vary somewhat from the sort you’re more likely to
64 find online:
65
@@ -83,10 +84,12 @@
84
85 $ sudo loginctl enable-linger $USER
86
87 You can paste the command just like that into your terminal, since
88 `$USER` will expand to your login name.
89
90 [scgi]: ../any/scgi.md
91
92
93
94 ### System Service Alternative
95
96

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button