fossil self hosting
Now that you have (and are using) fossil, what else can you do? Have it host its own repositories, of course! But why?
- fossil can clone over http/https, so this is one way to make your repository available to other machines you may use. Of course, you could allow others to access your repository this way as well.
- http/https is generally easier for hosting purposes than other methods, such as leveraging ssh. Yes, fossil is smart enough to use an ssh://[email protected]/path/to/repository.fossil url as well. And you may want that for yourself for security purposes. But if you plan to share with others, you would be forced to deal with user accounts and passwords and …
- Because it is cool. This may well be the most important reason. :)
So now that you are a believer, you should get started. You can of course run it by hand, or start it any number of ways. Both ubuntu and centos have swallowed the kool-aid and run systemd. Definitely not my favorite thing in the world. But for this reason, let’s create a systemd service to start and manage the fossil service - and then just pretend we did something much better.
mkdir -p /data/fossils cat > /etc/systemd/system/fossil-repo.service <<! [Unit] Description=fossil repository After=network.target [Service] Type=simple ExecStart=/usr/local/bin/fossil server --repolist --port 8181 --localhost --baseurl=https://`hostname -f`/ --skin bootstrap /data/fossils [Install] WantedBy=multi-user.target ! systemctl enable fossil-repo systemctl start fossil-repo
It is important to note that for skin purposes (what the cool kids say when referring to the css and images used by the pages) you will need to specify the proper fully qualified url if you plan to front the service by a proxy at some given path off of root and/or change the protocol. I did the latter. You may be able to get by with localhost and http and no path here, if you are good enough at configuring your front-end proxy.
Speaking of the proxy … Check out how simple it is to configure the caddy proxy; the following is the complete contents of Caddyfile:
that.host.name proxy / http://localhost:8181/
Not ony does that work, but it also configures and provides https automatically. It even handles cert generation by itself - all for free.