# Issues migrating SVN repository from AWS EC2 to FreeBSD



## Richard Robertson (Aug 2, 2017)

I'm hoping I'm placing this in the right forum per the guidelines. 
I'm completely new to FreeNAS/FreeBSD, but not to operating systems and programming (30+ year systems programmer including embedded systems). I'm more familiar with Amazon and Ubuntu Linux though I am usually working in Windows (mostly) or OS X.

At this moment I have a FreeNAS server in my basement connected to the internet with a Google Fiber router (that's whole other mess that I won't go into here).

My company (in this case for "company" read "me") initially created our repository system on an Amazon EC2 server following the instructions in this article: http://northwaygames.com/setting-up-subversion-on-amazon-ec2-for-free/
Worked fine. And for an added bonus I added a nice web page with a dynamically generated catalog of our repositories with an editing system for text descriptions, etc. 
Later we went from the "free" version to a paid version (Someone else set that up - using /var/svn rather than /var/www/svn instead - I just shrugged and went with it). Unfortunately the volume of traffic we use internally has begun to make this cost-prohibitive for our tiny company (~$500.00 USD/mos!) 
So the guy who handled creating our "upgraded" repository created the jail for our new one on the server in my basement remotely - then gave it to me to finish it off (yes, I have more urgent and time-sensitive projects to deal with but there it is). 
I've:

Installed Apache 2.4
MariaDB 100 (I can upgrade later)
PHP 7.0
_Attempted _to install Subversion.. and then things have gone south. Yes, I know FreeBSD has "SVNLite" but I wanted to make sure I didn't have issues with an out-of-date version of SVN.
Previously our users could go "http://repos._ourdomain._com/repos/_reponame_" to access a repository. Now... not so much. (Yes, I've transferred the existing repositories to the new system without issue to /var/svn/repos) 

I've created virtual hosts with the old subdomains but have no clue where to point them.
I have no idea how to finish installing configuring subversion so it gets a repository from the expected path. 
Nor how to get the existing user access/password files to be used where appropriate.
I've even installed (hopefully) the most current version of WebSVN.
But the I find myself banging my head on such mysterious errors as:

```
httpd: Syntax error on line 545 of /usr/local/etc/apache24/httpd.conf: Syntax error on line 1 of /usr/local/etc/apache24/Includes/subversion.conf: Cannot load libexec/apache24/mod_dav_svn.so into server: /usr/local/libexec/apache24/mod_dav_svn.so: Undefined symbol "dav_register_provider"
```
My Google-fu has shown to be weak for this. I'm guessing there may be something I'm needing to compile or configure but it's not obvious in any way and I'm not in a position to spend weeks or months digging through documentation to figure this out.

Right now I see no flaws with FreeBSD as an OS beyond my own ignorance and I'm comfortable with the idea of learning it, but this is a time sensitive matter. Any help or guidance would be appreciated (of course if your instructions involve any of: rolling back to Apache 2.2, PHP 5.X, etc. please insert this guidance into your nether orifice).


----------



## Richard Robertson (Aug 2, 2017)

Update: Partially working.
Now I'm getting:

```
<D:error xmlns:D="DAV:" xmlns:m="[URL]http://apache.org/dav/xmlns[/URL]" xmlns:C="svn:">
<C:error/>
<m:human-readable errcode="13">Could not open the requested SVN filesystem</m:human-readable>
</D:error>
```
But at least I'm seeing this much.


----------



## SirDice (Aug 2, 2017)

A note regarding FreeNAS: PC-BSD, FreeNAS, NAS4Free, and all other FreeBSD Derivatives

The error you're getting seems to suggest these options aren't turned on on www/apache24:

```
DAV=on: WebDAV protocol handling. --enable-dav also enables mod_dav_fs
     DAV_FS=on: DAV provider for the filesystem. --enable-dav also enables mod_dav_fs
     DAV_LOCK=on: DAV provider for generic locking
```


```
<m:human-readable errcode="13">Could not open the requested SVN filesystem</m:human-readable>
```
That usually means either the SVN configuration isn't correct or the webserver isn't able to access and/or read the files. Apache usually runs on the www user account and needs to be able to access those files, if the files are there make sure the permissions are set correctly.


----------



## balanga (Aug 2, 2017)

Just a thought..... did you `pkg install mod_dav_svn`?


----------



## Richard Robertson (Aug 2, 2017)

balanga said:


> Just a thought..... did you `pkg install mod_dav_svn`?


Yep. One of the first things I did. I think I got the basic installation handled, just getting configuration files and setting right now.
Still I'm thanking you anyways. Someone else may need to know about that step in the future if they come across this thread.


----------



## Richard Robertson (Aug 2, 2017)

SirDice said:


> A note regarding FreeNAS: PC-BSD, FreeNAS, NAS4Free, and all other FreeBSD Derivatives
> 
> The error you're getting seems to suggest these options aren't turned on on www/apache24:
> 
> ...



Yep, I have Apache set for www. I even have it a member of the svn group, JIC.  I suspect I have DAV off. I know DAV is turned on in the httpd.config file, but not sure about the other two. Given the context I'm going to assume this is true and toggle all three of them.

Edit: Your link is broken.


----------



## Richard Robertson (Aug 2, 2017)

Proceeding to apply the suggested steps incrementally.

adding the DAV toggle to my httpd.conf file at this spot:

```
DocumentRoot "/var"
<Directory "/var">
    Dav On
    Options Indexes FollowSymLinks  
    AllowOverride None
    Require all granted
</Directory>
```

And restarting Apache (I'm running under su for this) I get this error message:

```
Performing sanity check on apache24 configuration:
AH00526: Syntax error on line 268 of /usr/local/etc/apache24/httpd.conf:
Unknown DAV provider: filesystem
```

The configuration for SVN is this:

```
<Location /repos>
   DAV svn
   SVNParentPath /var/svn/repos
    #Limit write permission to list of valid users.
    AuthType Basic
    AuthName "Authorization Realm"
    AuthUserFile /var/svn-auth/passwd
    AuthzSVNAccessFile  /var/svn-auth/access
   Require valid-user
</Location>
```

My virtual hosts are set up thusly:


```
<VirtualHost *:80>
    ServerName 127.0.0.1
    DocumentRoot /var/www/data/html
</VirtualHost>

<VirtualHost *:80>
    ServerName www.newdomain.com
    ServerAlias newdomain.com
    DocumentRoot "/var/www/data/html"
</VirtualHost>

<VirtualHost *:80>
    ServerName repos.newdomain.com
    DocumentRoot "/var/www/data/html"
</VirtualHost>

<VirtualHost *:80>
    ServerName svn.newdomain.com
    DocumentRoot "/var/www/data/html"
</VirtualHost>

<VirtualHost *:80>
    ServerName repos.olddomain.com
    DocumentRoot "/var/www/data/html"
</VirtualHost>

<VirtualHost *:80>
    ServerName svn.olddomain.com
    DocumentRoot "/var/www/data/html"
</VirtualHost>

<VirtualHost *:80>
    ServerName waypoint.newdomain.com
    DocumentRoot "/var/www/data/waypoint"
</VirtualHost>
```

Right now I'm doing these all within the httpd.conf file until I get things fully functional then I'll split things up into include files.


----------



## Richard Robertson (Aug 3, 2017)

SirDice said:


> A note regarding FreeNAS: PC-BSD, FreeNAS, NAS4Free, and all other FreeBSD Derivatives
> 
> The error you're getting seems to suggest these options aren't turned on on www/apache24:
> 
> ...


You fixed the link. But it's unclear to me if these settings are entered into a file that isn't documented on that link, are entered into httpd.config in that particular format, or in the format:

```
Key Value
```
that I've been using so far. 
I also see mention of an option formated "--Key value". Is that to be applied as an option during make? As often in these documents there is an assumption that the person reading it already knows key details despite this generally not a regular exercise for most people.
If it IS such an option during make, is it possible to run make again with that option enabled?


----------



## Richard Robertson (Aug 3, 2017)

Update. Not quite sure how this even happened. I'll check my script I made to transfer the repos in the first place, but all their permissions were set to 770... not the needed 775. 
Thanks for everyone's help.
I'm going to document my steps as soon as I get a break and hopefully provide it as a useful contribution to this project.


----------

