display web contents from svn repository

3 views
Skip to first unread message

Marco Asa

unread,
Apr 24, 2023, 7:20:05 AM4/24/23
to us...@subversion.apache.org
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?
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?

Thanks for your attention,
--
Asa Marco <marco...@gmail.com> 朝

Daniel Sahlberg

unread,
Apr 24, 2023, 9:28:20 AM4/24/23
to Marco Asa, us...@subversion.apache.org
Den mån 24 apr. 2023 kl 13:19 skrev Marco Asa <marco...@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

Marco Asa

unread,
Apr 24, 2023, 2:18:15 PM4/24/23
to Daniel Sahlberg, us...@subversion.apache.org
Hello Daniel,

thanks for the answer,

>
> 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.
>

Unfortunately this is not my case but I was not much optimistic on this point

> 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.

Nice, I was not aware of hooks and post-commit would work very nicely
for the pourpose. I still had to make it work in a convoluted way
since I deployed the svm server manager in an isolated container and
the post-commit hook could not access directly the checkout that i
need to update. Still, I could easily exploit the hook to write date
and revision number in a text file accessible to both the container
and the host; this file became my target to monitor with incron which
is now triggered only once per commit.

Thanks again,
--
Marco Asa

Daniel Sahlberg

unread,
Apr 24, 2023, 2:19:32 PM4/24/23
to Marco Asa, us...@subversion.apache.org
Den mån 24 apr. 2023 kl 20:16 skrev Marco Asa <marco...@gmail.com>:
Nice, I was not aware of hooks and post-commit would work very nicely
for the pourpose. I still had to make it work in a convoluted way
since I deployed the svm server manager in an isolated container and
the post-commit hook could not access directly the checkout that i
need to update. Still, I could easily exploit the hook to write date
and revision number in a text file accessible to both the container
and the host; this file became my target to monitor with incron which
is now triggered only once per commit.

Good to hear, thank you for reporting back on the mailing list!

Kind regards,
Daniel 
Reply all
Reply to author
Forward
0 new messages