Create a Multi-repository Fossil SCM Server

In order to create a multi-repository Fossil SCM server on Ubuntu 16.04 environment, three steps are needed.

Step 1: install Stunnel and Fossil SCM

sudo apt update

sudo apt install stunnel4 -y

sudo apt install fossil

Edit /etc/environment file and add the following setup to allow only the https connections:

HTTPS=on

Edit /etc/default/stunnel4 file and modified the ENABLED value from 0 to 1 to get stunnel service running when the computer startup:

ENABLED=1

Step 2: Stunnel setup

Change directory to /etc/stunnel/ and use the following command to generate localhost.key and localhost.crt files.

sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout localhost.key -out localhost.crt

edit stunnel.conf configuration file under /etc/stunnel/ as follows:

[https]
accept = your_IPv4_ip:443
accept = :::443
cert = /etc/stunnel/localhost.crt
key = /etc/stunnel/localhost.key
exec = /usr/bin/fossil
execargs = /usr/bin/fossil http /home/user/repository/ --https --nojail --notfound default

which means the IPv4 and IPv6 requests are both accepted under port 443. And /home/user/repository/ is used to store the Fossil SCM repo files. The default repo file is /home/user/repository/default.fossil

The setting of "--notfound default" means if the repository file is not specified, connection URL is default which is a relative directory associated with the server main URL.

Step 3: create Fossil SCM repositories

Change directory to /home/user/repository and use "fossil init default.fossil" command to create the default repository. If more repository is needed, also use "fossil init other.fossil" to create other.fossil repository under /home/user/repository.

After the setup use "/etc/init.d/stunnel4 restart" command to restart the Stunnel service.

Use https://site-url:443/ to connect to default.fossil and use https://site-url:443/other to connect to other.fossil.