Fossil Forum

linux fossil server recommendation - non-systemd
Login

linux fossil server recommendation - non-systemd

linux fossil server recommendation - non-systemd

(1) By decuser on 2024-01-08 17:00:56 [link] [source]

OK. I give up on getting fossil to work using the following on my MX Linux installation, which is a SysVinit system:

update-rc.d fossil defaults

with this init script:

#!/bin/sh
exec 1>/var/log/fossil.log 2>&1

### BEGIN INIT INFO
# Provides:          fossil
# Required-Start: $local_fs $network $remote_fs $named $time
# Required-Stop: $local_fs $network $remote_fs $named
# Default-Start:     2 3 4 5
# Default-Stop:
# Short-Description: Fossil Service
# Description:       Controls the fossil service
### END INIT INFO

case "$1" in
start)
    exec /usr/bin/fossil server --errorlog fossil-scm.log --port 8080 --repolist /zfs/fossils &
    ;;
stop)
    killall -9 fossil 2> /dev/null
    ;;
esac

exit 0

It just isn't reliable and with seriously limited logging output from fossil, I can't figure out what's going on - I don't know why it's not staying up...

So, what's the recommended approach to install fossil on a system like MX Linux where the init system is decidedly not systemd?

On Mint, it worked, but I have a feeling that wasn't it staying up, but rather it being respawned by systemd, dunno exactly, don't care, just an observation. On FreeBSD, as I've mentioned before, it never goes down, there I was running it via xinit, if I remember correctly.

(2) By PF (peter) on 2024-01-08 18:11:57 in reply to 1 [link] [source]

I use following shell script(not service) on Void linux (no systemd) to start fossil server. I do start it manually but it keeps running till the restart of system (easily several weeks).

#!/bin/bash
cd /home/myuser/repos/
/usr/bin/fossil server -P 8089 --localauth --extroot /home/myuser/repos/myext --user myuser --repolist --files \* /home/myuser/repos/. &

(3) By Preben Guldberg (preben) on 2024-01-08 18:15:14 in reply to 1 [link] [source]

So, what's the recommended approach to install fossil on a system like MX Linux where the init system is decidedly not systemd?

Off hand, I'd say what you tried to do: Use the relevant infrastructure to start the service.

If your observation on other systems is that "the fossil service is consistently available", then in my view it's because either 1) the service never had to be started again or 2) the relevant infrastructure successfully determined that the service had to be restart and did so.

For your MX linux setup, you encounter a situation where the need to restart is present (but does not appear to happen, possibly because the infrastructure in place does not offer monitoring or do not know how to for this service).

So to understand why MX linux is not stable for you, you'd either need to teach the infrastructure to restart the service as needed - or figure out what causes the service to stop.

As for the cause, I'd still suggest monitoring if the fossil process is running in order to differentiate between events such as:

  1. Fossil stops after successfully handling a request, service is not running for a while and you start it. That is, the last handled request is successful (you don't notice any problems and assumes all is well), yet fossil stops.
  2. Fossil handles a request successfully, service continues running for a while, the service stops, a period of time lapses and you start it. That is, something appears to kill the fossil process.
  3. The service is running but fossil stops and fails to handle a request and you immediately restart it. That is, fossil crashes on some event, you detect an error condition and immediately restart the service.

Another thing to try: In tmux, screen or a terminal you know won't be disconnected, run "fossil ARGS ; date". If fossil crashes or is killed, the date command could let you know just when that occurred.

(4.1) By decuser on 2024-01-08 18:27:29 edited from 4.0 in reply to 3 [link] [source]

That's helpful. I didn't think of putting it up in a tmux session with date - nice. I'll combine y'all's suggestions and see if I can get some more insight.

(5) By Warren Young (wyoung) on 2024-01-08 19:05:04 in reply to 1 [source]

It just isn't reliable

My public Fossil server currently has a dozen instances of fossil server running, all of which have the same uptime as the server itself, 25 days at this point. It's only that short due to things like kernel and glibc updates.

Why 12 instances? Because each one appears at different points in the URL hierarchy, some under entirely different domains. I can't use --repolist mode for this, and I don't want to pay the overhead of CGI mode to get the flexibility back.

But speaking of CGI mode, that would be one solution to your problem. Each instance runs only long enough to answer the HTTP hit, then exits.

I don't know why it's not staying up...

I don't know, either; it's completely counter to my experience.

Indeed, for several years I didn't bother with running the server under systemd. After each reboot, I simply logged back in and ran a command that started the fossil server instances back up, knowing that they'd stay up indefinitely.

The only reason I switched to running them under systemd is that Podman can generate the unit files automatically, and I wanted to run it containerized, for security.

I know you said you didn't want to use containers, but it seems like an odd position for a FreeBSD fan to take, since jails were always such a huge selling point for FreeBSD before containers took off. I'd've thought y'all would go, "Yay, Linux has jails now. Let's go!"

(6.1) By decuser on 2024-01-08 23:16:06 edited from 6.0 in reply to 5 [link] [source]

Fair enough, Warren. It's good to know your experience. I'm ok with seeing how long it'll stay up in the foreground process running in a tmux session. If I can see when it dies/if it dies, then I can decide what to do. Up to now, it's been mysterious and unpredictable and I haven't been able to track it down, but I feel optimistic about this approach to troubleshooting.

(7.1) By decuser on 2024-01-09 00:00:04 edited from 7.0 in reply to 6.1 [link] [source]

Problem probably solved. I'm including the "solution" for posterity and in case I forget :).

sudo -s
apt install inetutils-inetd

vi /etc/services
#http-alt   8080/tcp    webcache    # WWW caching service
fossil 8080/tcp #fossil server

vi /etc/inetd.conf 
fossil stream tcp nowait.10000 root /usr/bin/fossil server --errorlog fossil-scm.log http --repolist /zfs/fossils

update-rc.d inetutils-inetd default

# start
/etc/init.d/inetutils-inetd start

# test via browsing to <HOST>:8080
reboot

# test again via browsing to <HOST>:8080

Now, I know why it never went down on FreeBSD, duh, it was only up long enough to service the request (thanks for the suggestion, Warren). This'll work.

(8) By Warren Young (wyoung) on 2024-01-08 23:59:46 in reply to 7.0 [link] [source]

Yes, socket activation is one of several methods for setting up a Fossil server, and yes, it has the same virtue as CGI: each HTTP hit gets served by a different PID.

(9) By decuser on 2024-01-09 00:02:48 in reply to 8 [link] [source]

Thanks for the link :). I found several different links, but not that one. I love fossil and have been using it now for several years for all of my repos, it's great. Now that I don't think it'll be crashing (or whatever it was doing) anymore, I'm a happy camper. Please don't think I'm griping about anything, just trying to get it to settle down!