Den mån 24 apr. 2023 kl 13:19 skrev Marco Asa <marcoas...@gmail.com>:
> Hello, > > I set up a combined svn server / web server where the latter displays > contents taken directly from one of the repositories. It runs fine but > I would like to make it work a bit more efficiently. > > At the moment it works like this: > 1) Both the svn repository and one checkout of it in "/example" are > hosted on the same machine > 2) the svn repository folder is monitored for changes by an incron job > 3) when a file modification is made to the repository (by a commit for > instance), incron triggers svn update /example > 4) the webserver points to /example and displays /example/index.html > > My two questions are the following > a) can I avoid the checkout altogheter and save disk space? I.e.can I > configure the svn server so that I could take html pages and related > images directly from the HEAD revision? > If the SVN repository is available over http/https, then it should be possible to configure mod_rewrite so that any access to the web server is redirected to the Subversion server. For example, the Subversion projects front page is available directly from SVN here: https://svn.apache.org/repos/asf/subversion/site/publish/index.html (It looks like crap, since the page require the use of server side includes to render some part of the page including a lot of the page structure). I would assume serving the page this way would require a lot more CPU cycles compared to serving it directly from the file system so depending on your use case it might not be feasible. > b) If not, I would like to improve step 3). At the moment svn update > is called tens of times for each commit (any kind of modification > triggers it as I am looking at the whole folder). What would be a good > file to monitor with incron in the repository that will always be > modified by a new commit? > Even if you find such a file, there is always a risk a future version of Subversion accesses the repository differently making this a fragile solution. It is probably better to look at a post-commit repository hook, see the SVN book [1]. The hook should trigger only once and only after completion of commits. I assume (although I never investigated) that the Subversion website is handled this way - on updates we just commit to https://svn.apache.org/repos/asf/subversion/site/publish/ and it appears within a moment on https://subversion.apache.org/. I hope it works out for you! Kind regards, Daniel Sahlberg [1] https://svnbook.red-bean.com/en/1.7/svn.ref.reposhooks.post-commit.html > Thanks for your attention, > -- > Asa Marco <marcoas...@gmail.com> 朝 >