Hideki A. Ikeda (HidekiAI) [池田英紀] ["Tony" Ikeda] –  BLog

Serving SVN repositories

by HidekiAI on Mar.21, 2010, under Technology Opinions

The other day, I was researching on an options to have SVN repository and Apache on a separated host. In one forum, the admin even bluntly responded to a user who had this issue with a simple “there’s no correct way” and a “you shouldn’t even be trying it”.  This is one of the reasons why I really hate those holier-than-thou-RTFM admins, but we’ll leave that to another day’s rant and move on to the web-log instead…

The real issue in my opinion, is the fact that there’s a bit of confusion on the user side who do not realize the combinations of ways you can serve SVN.  Here’s a matrix in hopes to clarify things.  Assumptions made here are:

  • Repository directory is located at “/var/svn/myrepos
  • The machine hosting it is “myserver”
  • Domain name is “mydomain.tld” (note that even if accessing locally, my example will use domain name for clarifications)

 

Server type Service to run Examples
svn based svnserve svn list svn://myserver.mydomain.tld/myproject
file based none (possibly samba if mounting it on another host) svn list file:///var/svn/myrepos/myproject
WebDAV based Apache + DAV modules svn list https://myserver.mydomain.tld/vhostname/myrepos
ssh based sshd svn list svn+ssh:///myserver.mydomain.tld/var/svn/myrepos/myproject

Note: In sshd mode, it spawns svnserve upon connection, so you must make sure that you have svnserve working.

So the key part to realize is that when you’re running in WebDAV mode, it is the Apache modules that becomes the front-end proxy to allow the clients to access the repositories.  This is the reasons why the repositories are to be located on the same host as the Apache, simple as that.

The next issue to point out is why would one want to use http and/or https rather than sshd, svnserve or even samba.  In my opinion, file-based is out of the question as a “server”, so we’ll look at the 3 services (yes, I know about inetd, but I don’t think it’s supported on Windows, so I am not considering it – although my servers are Gentoo).

Whether you’re serving for your laptop and desktop in the LAN or serving for your colleagues and groups, it’s about serving to other host machines (otherwise, you’d be using file based and/or git), and the question is whether you want to punch a hole in the router firewall for port 22 (sshd), 80/443 (http/https) or 3690 (svnserve).

It should also be an issue of whether you want to manage the accounting (sshd=PAM, svnserve=text-file-password or SASL, http=htpasswd-based-text-file) as well as security (https=ssl, svnserve=SASL, sshd=PAM).  In my opinions, the decisions should be made on how one would want to manage passwords.  I personally like PAM, and my sshd is hooked in to PAM in which it queries LDAP.  So my choice is to go with “svn+ssh://URL” method.  Only caveat to ssh method is that it constantly asks for password (and you cannot do annonymous read-only, why I’d want to, I don’t know) but that’s OK since my repository is on my dev-box and from the dev-box, I do “file://” anyways.  From other boxes (such as my laptop or work) I only need to checkout/update to read-only and I rarely edit so it’s usually a one-time deal…

In any case, once you comprehend and understand its functions, I’m sure one can make better decisions as to how the repositories are to be serviced.  For me, I’ve decided to just have a cron job that runs daily and copies the repositories from my dev-box to my external SSHd server.  This way, I have a back up of my repository in case my dev-box harddrive crashes…  Alternatively, I could have done the same on my Apache server box box, but I went with ssh because that way, both internally and externally, I’ll be using svn+ssh so I won’t get confused. *grin*

Note: After I was satisfied with self-educating all this crazy mess, I’ve switched to git.  What makes sense is that having it as distributed repositories.  And I can push to the web version if and only if I like to.  I can also have a cron job that would pull from my dev-box if I care to (but I think I would prefer to push from my dev-box only when I am satisfied and besides, because it is distributed it means that if I need to pull on my laptop, I can pull directly from my dev-box too).  But the choices are more flexible.  If you have got to the similar issue and are reading my blog, my recommendations are to switch to git and/or mercurial.  Search on YouTube for Linus Torvald’s presentations on git, or read Joel Spolsky’s (final) blog on mercurial.  For git, read http://book.git-scm.com/4_setting_up_a_public_repository.html and you can see how easy it is to set-up!  P/S: On Windows, use msysGit rather than Cygwin version of git.

Related posts

Leave a Comment :, , , more...

Most productive with 8+ hours of sleep…

by HidekiAI on Sep.16, 2009, under Technology Opinions

I just saw a very interesting survey at www.CodeProject.com.  It was/is interesting to me because I used to keep track of daily logs and journals to determine why I felt so unproductive (to me, as a programmer, productivity is based on getting my tasks done on time).

Here’s the snapshot of the survey:

When do you do your best coding?

Survey period: 31 Aug 2009 to 7 Sep 2009

Are you a night owl? An early riser? Or does 9-5 work for you?
Choose the periods in which you feel you code best.

Option Votes

%

6am – 9am

284

18.39

284 votes, 18.39%
9am – 12pm

615

39.83

615 votes, 39.83%
12pm – 3pm

256

16.58

256 votes, 16.58%
3pm – 6pm

381

24.68

381 votes, 24.68%
6pm – 9pm

350

22.67

350 votes, 22.67%
9pm – 12am

430

27.85

430 votes, 27.85%
12am – 3am

302

19.56

302 votes, 19.56%
3am – 6am

118

7.64

118 votes, 7.64%
Responses

1544

1544 votes
This is a multiple choice question. Totals may not add up to 100%

From: http://www.codeproject.com/script/Surveys/Results.aspx?srvid=953

Notice that the highest productivity for most are at 0900-1200 hrs.  When I did contracting for a while working from home, I realized that when I woke up at 0700 hrs and began straight to work, I was able to solve problems and issues much more efficiently and quicker in the mornings.

So based on that pattern, I began to make sure that any issues which involved more analytical and thinking process were reserved for the mornings or put off until the next day if needed, and anything that was more mechanical were scheduled after 1200 (noon).

I dislike mornings, I prefer to sleep in until 0800 or later on weekends.  So I’m not really a morning person, or to say that I am productive in the early mornings.  I believe it is more about having a good rest and stepping away from the problems for period of time is what makes me productive.

This is why I never pull an all-nighters (if I can help it) because if I cannot solve the problems due to my “big muscle” (our brain) being tired, it’s just unproductive and inefficient in the long run.

I’ve made dumb coding-mistakes in the past due to lack of sleep.  The one that I remember most well and use as my example is the one about multiplying an integer by 8 by using a loop for it (in Assembly Language, I think it was on Zilog Z80).  Yes, if I was wide awake (or even half awake), I would have just left-shifted the register (the integer value) by 3 and be done with it…  The next day when I saw that code, I was in horror…

Unfortunately, I did not learn any lesson back then, I was young and I always assumed putting more hours into it in single sittings meant working hard at it.  I did not realize that it was important to work smarter, not harder…

Related posts

Leave a Comment :, more...

FireHOL + Ubuntu + gpconv|pwconv

by HidekiAI on Aug.30, 2009, under Technology Opinions

Have you ever ran into an issue like this:

--------------------------------------------------------------------------------
ERROR   : # 1.
WHAT    : A runtime command failed to execute (returned error 2).
SOURCE  : line 16 of /etc/firehol/firehol.conf
COMMAND : /sbin/iptables -t filter -A in_interface1_syslog_s7 -p udp --sport syslog --dport 514 -m state --state NEW\,ESTABLISHED -j ACCEPT
OUTPUT  :                                                                                                                                
 
iptables v1.3.8: invalid port/service `syslog' specified
Try `iptables -h' or 'iptables --help' for more information.

You’d get similar errors for “ftp”, “ftp-data”, and I’d imagine other random ones.  You probably won’t see it if you have “START_FIREHOL=YES” not set (or commented out) in your firehol.conf file either…

Contrary to the beliefs that it is a problem with FireHOL or older bash, it’s actually (at least for me) a permission issue…

A simple test might be to do “whoami” and you might see this:

root@localhost ~ # whoami
whoami: cannot find name for user ID 0

I seem to get this whenever I run nscd daemon and have my ldap configured incorrectly.

In any case, try the following:

root@localhost ~ # grpconv
root@localhost ~ # pwconv

Now try restarting FireHOL again (or try “whoami”).  If that works, a possible “temporary” fix until you resolve it is to run a cron hourly of grpconv & pwconv (and of course disable other services such as nscd – at least for me).

Related posts

Leave a Comment :, , , , more...

Google AdSense

Google Analytics

Google AdSense Search

Categories