1<title>Fossil Self-Hosting Repositories</title>
2
3Fossil has self-hosted since 2007-07-21.  As of 2017-07-25
4there are three publicly accessible repositories for the Fossil source code:
5
6  1.  [https://fossil-scm.org/]
7  2.  [https://www2.fossil-scm.org/]
8  3.  [https://www3.fossil-scm.org/site.cgi]
9
10The canonical repository is (1).  Repositories (2) and (3) automatically
11stay in synchronization with (1) via a
12<a href="http://en.wikipedia.org/wiki/Cron">cron job</a> that invokes
13"fossil sync" at regular intervals.
14Repository (2) also publishes a
15[https://github.com/drhsqlite/fossil-mirror|GitHub mirror of Fossil]
16as a demonstration of [./mirrortogithub.md|how that can be done].
17
18Note that the two secondary repositories are more than just read-only mirrors.
19All three servers support full read/write capabilities.
20Changes (such as new tickets or wiki or check-ins) can be implemented
21on any of the three servers and those changes automatically propagate to the
22other two servers.
23
24Server (1) runs as a [./aboutcgi.wiki|CGI script] on a
25<a href="http://www.linode.com/">Linode 8192</a> located in Dallas, TX
26- on the same virtual machine that
27hosts <a href="http://www.sqlite.org/">SQLite</a> and over a
28dozen other smaller projects.  This demonstrates that Fossil can run on
29a low-power host processor.
30Multiple fossil-based projects can easily be hosted on the same machine,
31even if that machine is itself one of several dozen virtual machines on
32single physical box.  The CGI script that runs the canonical Fossil
33self-hosting repository is as follows:
34
35<blockquote><pre>
36#!/usr/bin/fossil
37repository: /fossil/fossil.fossil
38</pre></blockquote>
39
40Server (3) ran for 10 years as a CGI script on a shared hosting account at
41<a href="http://www.he.net/">Hurricane Electric</a> in Fremont, CA.
42This server demonstrated the ability of
43Fossil to run on an economical shared-host web account with no
44privileges beyond port 80 HTTP access and CGI.  It is not necessary
45to have a dedicated computer with administrator privileges to run Fossil.
46As far as we are aware,
47Fossil is the only full-featured configuration management system
48that can run in
49such a restricted environment.  The CGI script that ran on the
50Hurricane Electric server was the same as the CGI script shown above,
51except that the pathnames are modified to suit the environment:
52
53<blockquote><pre>
54#!/home/hwaci/bin/fossil
55repository: /home/hwaci/fossil/fossil.fossil
56</pre></blockquote>
57
58In recent years, virtual private servers have become a more flexible and
59less expensive hosting option compared to shared hosting accounts.
60So on 2017-07-25, server (3) was moved
61onto a $5/month "droplet" [https://en.wikipedia.org/wiki/Virtual_private_server|VPS]
62from [https://www.digitalocean.com|Digital Ocean]
63located in San Francisco.
64
65Server (3) is synchronized with the canonical server (1) by running
66a command similar to the following via cron:
67
68<blockquote><pre>
69/usr/local/bin/fossil all sync -u
70</pre></blockquote>
71
72Server (2) is a
73<a href="http://www.linode.com/">Linode 4096</a> located in Newark, NJ
74and set up just like the canonical server (1) with the addition of a
75cron job for synchronization.  The same cron job also runs the
76[/help?cmd=git|fossil git export] command after each sync in order to
77[./mirrortogithub.md#ex1|mirror all changes to GitHub].
78