Setting up fossil server on debian/nginx
(1) By smd (scottdoctor) on 2023-07-30 19:25:36 [link] [source]
I am setting up a new website that will have various fossil repositories for different projects we are doing at work. The server is a linode vps with a fresh install with the current versions of debian 12, nginx, php8.2, and mysql (mariadb). The website is working properly with a basic home page.
The website is solely for use by our engineering people. The front landing page has no links, so the user needs to know the folder to access fossil. This provides a layer of security against spiders and bots.
I downloaded the latest linux version of fossil and put it into a sub-folder of the website home page that will be the base folder for the various repositories. Each repositiory will have its own folder. We only have 3 engineers, but they are located on different pars of the planet, such is why I am setting up a special server for collaboration between us. I really, really, REALLY do not want to use git. So I told them I can set up fossil on this server so we can have some version control and normal vcs stuff.
Well, I created a new repository via SSH (using putty) to get things working. However, I am not successful in getting the UI to launch when I put the URL into my browser (firefox).
I want to be able to just put the URL for that folder into my browser and have the fossil UI launch showing the timeline. Alas I have not gotten it to work.
So starting from scratch with a newly created and open repository in a folder on the website, what do I add/modify/change... to debian, nginx,... to get fossil to launch the UI?
Note that I read through the help about setting up a two line bash file, but that did not do anything. What I need is a straight forward recipe, which includes exact locations and names of files to create/modify,... for a generic common server setup with debian and nginx.
(2) By Stephan Beal (stephan) on 2023-07-30 19:41:50 in reply to 1 [source]
... for a generic common server setup with debian and nginx.
Is nginx a hard requirement?
If not, i can offer some docs about how my own heavily-fossilized server is set up:
https://fossil.wanderinghorse.net/
see the "server setup docs" link around the middle of the page. It's also running on a linode slice, albeit with ubuntu, but that shouldn't materially change the instructions.
(3) By Andy Bradford (andybradford) on 2023-07-30 20:32:59 in reply to 1 [link] [source]
> So starting from scratch with a newly created and open repository in a > folder on the website, what do I add/modify/change... to debian, > nginx,... to get fossil to launch the UI? Have you read through: https://www.fossil-scm.org/home/doc/trunk/www/quickstart.wiki And in particular: https://www.fossil-scm.org/home/doc/trunk/www/quickstart.wiki#server Which eventually lands you here: https://www.fossil-scm.org/home/doc/trunk/www/server/#matrix There are numerous ways to setup a location for Fossil collaboration. My preferred method is just to use SSH and Unix permissions to govern access to the repositories. The setup is simple and builds upon previous SSH and shell knowledge. Once a user has cloned the repository, they don't need a centralized UI to view the timeline, they can just run "fossil ui" on their own local copy. This then simplifies what kind of content is available on any public facing websites, which can then simply be a list of repositories that are available and how to clone them. Andy
(4) By Daniel Dumitriu (danield) on 2023-07-30 22:28:31 in reply to 1 [link] [source]
You are aware of this, right?
(5) By smd (scottdoctor) on 2023-08-04 02:20:26 in reply to 4 [link] [source]
I had to step away from this task for a few days to do stuff to justify my paycheck. I am reading through
https://fossil-scm.org/home/doc/trunk/www/server/debian/nginx.md
and am stuck at the first step. My server is up and running and I get my home page in my browser which is in https with a letsencrypt certbot working correctly. The instructions state:
"On Debian and Ubuntu systems the primary user-level configuration file for nginx is /etc/nginx/sites-enabled/default. I recommend that this file contain only a list of include statements, one for each site that server hosts:"
However the folder /etc/nginx/sites-enabled does not exist. There is a folder
/etc/nginx/conf.d
that contains the server and rewrite stuff. I changed the name of my server in the following contents to example.net for security reasons, but this is what is in /etc/nginx/conf.d/example.net.conf
server {
server_name example.net www.example.net;
root /var/www/html/example.net;
index index.html index.php;
location / {
try_files $uri $uri/ =404;
}
location ~* \.php$ {
fastcgi_pass unix:/run/php/php8.2-fpm.sock;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
}
listen [::]:443 ssl ipv6only=on; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/example.net/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/example.net/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server { if ($host = example.net) { return 301 https://$host$request_uri; } # managed by Certbot
if ($host = www.example.net) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80 default_server;
listen [::]:80 default_server;
server_name example.net www.example.net;
return 404; # managed by Certbot
}
I am confuzzled as to what I am supposed to add/insert/change. If I do the changes in the instructions it will break my website. All I want is that the fossil UI launches when the web browser goes to the specified sub-folder on my website. Can someone explain what I am supposed to edit.
(6.1) By Warren Young (wyoung) on 2023-08-04 04:41:31 edited from 6.0 in reply to 5 [link] [source]
the folder /etc/nginx/sites-enabled does not exist.
I just installed a fresh Debian 12 system, then apt-installed nothing other than sudo
and nginx
:
$ ls -l /etc/nginx/
…
drwxr-xr-x 2 root root 4096 Aug 3 21:25 sites-enabled
…
I am confuzzled as to what I am supposed to add/insert/change
You have two major options: replace your configuration entirely with the one given, or learn enough about nginx that you can merge the two, yielding current behavior plus the new stuff you wish to add.
If it were me, and I considered the existing configuration "precious," I'd take the latter path and merge the "location /code {…
" block into your configuration somewhere. Don't forget the includes referenced from it.
Assuming you use my "local/code
" include as-given, you will then have to arrange to have your Fossil server start on boot and listen on 127.0.0.1:12345
, which then gets you into the other Fossil server docs. For a simple configuration, I'd take the systemd path, also linked from the nginx doc.
Please don't ask me to spoon-feed this to you. Demonstrate that you are reading the existing docs and attempting to follow them. I spent a lot of time writing them for the specific purpose of not repeating myself on the topic.
(7) By Martin Gagnon (mgagnon) on 2023-08-04 03:39:14 in reply to 5 [link] [source]
I guess something like this
location /code/ { include scgi_params; scgi_param SCRIPT_NAME "/code"; scgi_pass localhost:9000; }
need to be added for basic functionality. as described here.
(with an instance of "fossil server ... --scgi --port 9000 &
" that needs to be already running).
The example from this link mentioned in previous post is more complicated, but the essential part about fossil scgi is similar. Except that it use multiple files and use some "include
" statement like "include local/code;
".
I'm not familiar with nginx, but the way I understand it, with this example, a url like https://yoursite.com/code/*
will be passed to your fossil instance running on port 9000 using scgi protocol.
(8) By Warren Young (wyoung) on 2023-08-04 03:55:26 in reply to 7 [link] [source]
That doc justifies the includes. In the case of local/code
, it is "…because nginx refuses to inherit certain settings between nested location blocks." As you can see above that, the example has three such blocks, so it needs to reuse this include three times to avoid repeating the contents.
(9) By smd (scottdoctor) on 2023-08-04 12:08:27 in reply to 7 [link] [source]
Finally got the UI to launch.
added the location to /etc/nginx/conf.d/example.net.conf
server { server_name example.net www.example.net; root /var/www/html/example.net; index index.html index.php;
location / {
try_files $uri $uri/ =404;
}
location ~* \.php$ {
fastcgi_pass unix:/run/php/php8.2-fpm.sock;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
}
location /code/ {
include scgi_params;
scgi_param SCRIPT_NAME "/code";
scgi_pass localhost:9000;
}
listen [::]:443 ssl ipv6only=on; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/example.net/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/example.net/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server { if ($host = example.net) { return 301 https://$host$request_uri; } # managed by Certbot
if ($host = www.example.net) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80 default_server;
listen [::]:80 default_server;
server_name example.net www.example.net;
return 404; # managed by Certbot
}
The first time I tried the example.net/code url I got a 502 bad gateway. So I rebooted and still got the 502. Connected using Putty and issued the command.
fossil server ... --scgi --port 9000 &
Now the ui launches when I simply put the url into my browser.
Two questions.
I will be creating additional repositories for unrelated projects. Do I have to edit the example.net.conf file everytime I create a new repository which will be in a different folder?
How do I get the fossil server command to automatically executes when the server reboots?
(10.1) By Daniel Dumitriu (danield) on 2023-08-04 12:24:26 edited from 10.0 in reply to 9 [link] [source]
I will be creating additional repositories for unrelated projects. Do I have to edit the example.net.conf file everytime I create a new repository which will be in a different folder?
Read the docs for fossil server
. You might want to look for "REPOSITORY may also be a directory (aka folder) that contains one or more repositories with names ending [...]".
How do I get the fossil server command to automatically executes when the server reboots?
Read the docs for SCGI, especially the bottom part.
(11) By Warren Young (wyoung) on 2023-08-04 12:30:04 in reply to 9 [link] [source]
Do I have to edit the example.net.conf file everytime I create a new repository which will be in a different folder?
If you find that a terrible burden, use Fossil's --repolist
feature.
Personally, like having the freedom to attach new Fossil instances anywhere I like in the URL scheme, to put some under one DNS [sub]domain vs another, etc., but yes, that does require modifying the server configuration each time I add another public repo.
How do I get the fossil server command to automatically executes when the server reboots?
Quoting the systemd link I gave you above:
"The result is essentially the standalone server method coupled with an intelligent service manager that will start it automatically in the background on system boot…"