help with FreeBSD, svn and Redmine

Added by Thomas Burgess over 9 years ago

I'm pretty new to Redmine, and Ruby on Rails. I've managed to get ruby on rails working with apache/passenger and i've manager to get svn installed and set up. Redmine is working but the thing i'm having trouble with is getting it set up in such a way where i can create projects/svn repos with redmine. I've only ever used svn from the user side before so i don't really have any experience managing it and setting it up. I've followed a guide here:

http://www.bsdguides.org/guides/freebsd/misc/subversion.php

to get svn working but i am having trouble getting redmine to create repos with ti. I can't find ANY guides for FreeBSD for this...so if someone could help i'd be hugely gratefull

Replies (23)

RE: help with FreeBSD, svn and Redmine - Added by Thomas Burgess over 9 years ago

I've gotten a little farther....

I think i did things somewhat backwards though....and i'm still pretty stuck.

I can't seem to get reposman.rb to work. I've set "enable WS for repository management" and i've set my key.

When i try to use reposman, i get this error:

unable to create /usr/home/svn/test : can't find group for root

Also, when i followed the guide to set up auth based on the mysql database and redmine, and when i created the svn repo manually, i was never able to ACTUALY log in....it would prompt me for a password but it never was able to authenticate.

here is a pastebin of the important part of my apache config:

http://pastebin.com/Z5vBEa5y

any help would be much appreciated

RE: help with FreeBSD, svn and Redmine - Added by Felix Schäfer over 9 years ago

  1. Concerning authenticating to the subversion repositories: did you try logging in the the collection (.../svn) or to an actual repository (.../svn/some_project)? You won't be able to log in to the collection, because the authentication handler can't sort out which projects/repositories you have the permission to see, so noone can authenticate at the collection level. Also make sure the repository has the same name as the identifier of the project you are trying to use as authentication source, i.e. .../svn/some_project will use the same users as the project with the identifier some_project. Finally, make sure you have a user with enough rights to view the repository.
  2. Please also paste the options you are using with reposman, but on first sight, I'd say you are trying to run it as root, and that ruby is not able to find a group for root, i.e. reposman can't find out what group the new repository should belong to (on filesystem permission level).

RE: help with FreeBSD, svn and Redmine - Added by Thomas Burgess over 9 years ago

Thanks so much for the reply :)

I tried authenticating with both ../svn and ../svn/project

I'm sure the problem is i'm just not CLEAR on how to set up the repos manually, and i can't get reposman to create them properly.....

you say i cna't log into the root.....well i think this is the problem....because when i go to ../svn i get the never ending authentication window but when i go to ...svn/project i get this:

Could not open the requested SVN filesystem

i think this means the project isn't set up proerly....when i created the svn repos i think i just used this command:

svnadmin create /usr/home/svn/

This is wrong isn't it?

as far as what command i used for reposman....

ruby reposman.rb --redmine myserver.com --svn-dir /usr/home/svn --owner www --url http://myserver.com/svn --verbose --key=xxxxxx

i think the problem is on multiple levels....i am totally new to trying to admin svn....i have no real understanding of how ruby on rails works (beyond the minor level of what i've picked up from gooogle), i've never used redmine before as an admin and i'm really unsure on how to set this up. Believe me, getting this far is somewhat amazing....i'm almost there...i just need to figure out how to make redmine ACTUALLY create repos....i think

Thanks again for the reponse.

RE: help with FreeBSD, svn and Redmine - Added by Thomas Burgess over 9 years ago

WOOOO, i've gotten farther!!!!!

ok, i just deleted the old svn and did this:

mkdir /usr/home/svn
svnadmin create /usr/home/svn/test
chmod -R www:www /usr/home/svn

now when i go to http://mysite.com/svn/test it shows revision 0

this is getting better =) so now i just need to figure out how to use reposman.rb

does this need to run as the user who owns redmine?

RE: help with FreeBSD, svn and Redmine - Added by Felix Schäfer over 9 years ago

The problems here aren't related to ROR, I think you are just skipping some steps in the process and have now to get back to correct them, but I'll try to help you understand the errors.

First, /usr/home/svn is a folder containing svn repositories and not an svn repository itself. You had that mixed up, because you told apache /usr/home/svn contained svn repositories but created a single svn repository in /usr/home/svn, but you seem to have figured all this out, just make sure you understand what happens.

So far so good, now let's try to see what reposman does. reposman is designed to run as root, but you can tell it what owner and group the repository it creates should have, in your case that would be ruby reposman.rb --owner www --group www (you can also run reposman as whatever other user you want that has write permission in /usr/home/svn and can change the owner/group of files to www:www, so technically you could also run reposman as user www). Then, there are the mandatory options: the directory under which to create the svn repositories, the URL to your redmine installation and the API key, which gives us ruby reposman.rb --owner www --group www --svn-dir=/usr/home/svn --redmine-host=http://yourhost.com/path_to_redmine --key=XXX. If you then also want reposman to configure the repository in the project for you, you need to tell redmine what URI to use for that. If both redmine and the subversion repositories are on the same server, you can use the file:// scheme, else use the http:// scheme, which in total adds up to ruby reposman.rb --owner www --group www --svn-dir=/usr/home/svn --redmine-host=http://yourhost.com/path_to_redmine --key=XXX --url="file:///usr/home/svn" (note that the link for the --url option needs to point to the "parent" folder in which the repositories are, so in your case file:///usr/home/svn or http://your_svn_host.com/svn).

Make sure you understand the options for reposman and try again, if it still doesn't work, append a --verbose to it and post the output here.

RE: help with FreeBSD, svn and Redmine - Added by Thomas Burgess over 9 years ago

AWESOME

the only problem was i wasn't using the --group switch!

as soon as i did that!

querying Redmine for projects...
retrieved 2 projects
treating project test
treating project test123
repository /usr/home/svn/test123 registered in Redmine with url http://mysite.com/svn/test123
repository /usr/home/svn/test123 created

Thanks so much!

so now, if i understand this right.....if i now want to create a project which has limited access, i just create a new project, mark it as non-public and it will create the svn repos for me.

Then, if i add users to this project, they will be able to check out/view the page when they provide credentials?

Thanks so much for working with me on this.

RE: help with FreeBSD, svn and Redmine - Added by Thomas Burgess over 9 years ago

another question:

if i later delete a project does reposman delete the repos as well? or do i need to manually do this?

RE: help with FreeBSD, svn and Redmine - Added by Felix Schäfer over 9 years ago

Reposman will only create repositories, never delete them, and will only create for all projects that don't already have a repository.

The permissions are managed from within redmine and have nothing to do with reposman, but yes, you can have a private project (i.e. only members of the project will see it) and give the members either read or read/write permission to the repository depending on their role, but I'll point you to RedmineRoles for that :-) (and make sure to test everything before going "live" with the system, I haven't proof-read your apache configuration for example).

RE: help with FreeBSD, svn and Redmine - Added by Thomas Burgess over 9 years ago

yes, this makes sense. Thanks so much, i'm pretty sure i've done everything else right. I'm pretty experienced with FreeBSD for example, i'm just new to Ruby on Rails and very new to svn. I'm very grateful for your help. Redmine is a very amazing project. The only question i have left is:

you said:

"Reposman will only create repositories, never delete them, and will only create for all projects that don't already have a repository."

Does this mean if i have a project currently hosted on, say, googlecode, and i want to also add this to my redmine page, if i create a new project for it and link the repo to the googlecode repo, reposman will know enough to not try to create a repo for it?

From your above statement i would assume this is true but i've been wrong before....

RE: help with FreeBSD, svn and Redmine - Added by Felix Schäfer over 9 years ago

reposman will only create repositories for projects that don't have one configured unless you force it too, so yes, you can link a redmine project to your googlecode repository (if you have reposman in a cron, you will have to be quicker than your cron, but you get the idea).

RE: help with FreeBSD, svn and Redmine - Added by Thomas Burgess over 9 years ago

can't you create a repo for the project as creation time?

(i thought i saw this)

RE: help with FreeBSD, svn and Redmine - Added by Felix Schäfer over 9 years ago

Just checked: you can say that it has to have the repository module, but you can't configure at creation time. Anyway, if you set the cron to run reposman only every 15 minutes or so, that leaves you plenty of time to get going, and if perchance reposman kicks in before you do, you can still just delete the automatic configuration entry and put your own in there.

RE: help with FreeBSD, svn and Redmine - Added by Thomas Burgess over 9 years ago

ok, yes.

Thanks so much for your help. I really appreciate you taking the time to answer my noobish questions.

Redmine is SO nice. For some reason it just looks so much more "clean" than other projects of it's kind.

RE: help with FreeBSD, svn and Redmine - Added by Thomas Burgess over 9 years ago

ok...i thought i had everything working....but for some reason when i unchecked the "public" option, it doesn't seem to be abel to create the repo....

i get this error:

querying Redmine for projects...
retrieved 2 projects
treating project test
treating project testprivate
unable to create /usr/home/svn/testprivate : "svnadmin create /usr/home/svn/testprivate" failed

RE: help with FreeBSD, svn and Redmine - Added by Thomas Burgess over 9 years ago

ok,....this is weird...if i run the script manually it works but it's not working from crontab.

What gives?

here is my crontab entry:

*/5 * * * * /usr/local/bin/ruby /usr/local/www/redmine/extra/svn/reposman.rb --redmine mysite.com --svn-dir /usr/home/svn --owner www --group www --url http://mysite.com/svn --verbose --key=xxxx >> /var/log/reposman.log

and here is the entries from the log:

treating project quotaspace
unable to create /usr/home/svn/quotaspace : "svnadmin create /usr/home/svn/quotaspace" failed
querying Redmine for projects...
retrieved 3 projects
treating project explorer
unable to create /usr/home/svn/explorer : "svnadmin create /usr/home/svn/explorer" failed
treating project quotaspace
unable to create /usr/home/svn/quotaspace : "svnadmin create /usr/home/svn/quotaspace" failed
treating project starter
unable to create /usr/home/svn/starter : "svnadmin create /usr/home/svn/starter" failed

is this due to enviormental details? do i need to write a script for the crontab which loads these instead?

RE: help with FreeBSD, svn and Redmine - Added by Thomas Burgess over 9 years ago

nevermind, i just found the answer (haven't tested yet)

--command=

RE: help with FreeBSD, svn and Redmine - Added by Felix Schäfer over 9 years ago

Well, that seems a little overkill, you might just need to add the directory your svn binaries reside in to the $PATH inside the cron file (cron has a very very very limited environment and doesn't even read /etc/profile.d on linux systems…).

RE: help with FreeBSD, svn and Redmine - Added by Thomas Burgess over 9 years ago

nah, i just needed to use the --command= option like this:

*/5 * * * * /usr/local/bin/ruby /usr/local/www/redmine/extra/svn/reposman.rb --redmine mysite.com --svn-dir /usr/home/svn --owner www --group www --url http://mysite.com/svn --verbose --key=xxxxxx --command="/usr/local/bin/svnadmin create" >> /var/log/reposman.log

the problem was that reposman couldn't find svnadmin.

this worked...now i have this in my log:

querying Redmine for projects...
retrieved 3 projects
treating project explorer
repository /usr/home/svn/explorer registered in Redmine with url http://mysite.com/svn/explorer
repository /usr/home/svn/explorer created
treating project quotaspace
repository /usr/home/svn/quotaspace registered in Redmine with url http://mysite.com/svn/quotaspace
repository /usr/home/svn/quotaspace created
treating project starter
repository /usr/home/svn/starter registered in Redmine with url http://mysite.com/svn/starter
repository /usr/home/svn/starter created
querying Redmine for projects...
retrieved 3 projects
treating project explorer
treating project quotaspace
treating project starter

RE: help with FreeBSD, svn and Redmine - Added by Thomas Burgess over 9 years ago

Thomas Burgess wrote:

nah, i just needed to use the --command= option like this:

*/5 * * * * /usr/local/bin/ruby /usr/local/www/redmine/extra/svn/reposman.rb --redmine mysite.com --svn-dir /usr/home/svn --owner www --group www --url http://mysite.com/svn --verbose --key=xxxxxx --command="/usr/local/bin/svnadmin create" >> /var/log/reposman.log

the problem was that reposman couldn't find svnadmin.

this worked...now i have this in my log:

querying Redmine for projects...
retrieved 3 projects
treating project explorer
repository /usr/home/svn/explorer registered in Redmine with url http://mysite.com/svn/explorer
repository /usr/home/svn/explorer created
treating project quotaspace
repository /usr/home/svn/quotaspace registered in Redmine with url http://mysite.com/svn/quotaspace
repository /usr/home/svn/quotaspace created
treating project starter
repository /usr/home/svn/starter registered in Redmine with url http://mysite.com/svn/starter
repository /usr/home/svn/starter created
querying Redmine for projects...
retrieved 3 projects
treating project explorer
treating project quotaspace
treating project starter

RE: help with FreeBSD, svn and Redmine - Added by Thomas Burgess over 9 years ago

darn it....i can't edit/delete from these forums?

is there any way you can edit my post to remove the actual url for me?

RE: help with FreeBSD, svn and Redmine - Added by Felix Schäfer over 9 years ago

Yes, cron couldn't find svnadmin, so adding the directory where svnadmin resides to $PATH would have been equally good ;-)

RE: help with FreeBSD, svn and Redmine - Added by Felix Schäfer over 9 years ago

Thomas Burgess wrote:

darn it....i can't edit/delete from these forums?

is there any way you can edit my post to remove the actual url for me?

Done, but it appears several more times in other posts in this thread in the command examples you posted… Should I edit those too?

RE: help with FreeBSD, svn and Redmine - Added by Thomas Burgess over 9 years ago

doh!

i see...i thought i removed them..oh well, it's not a big deal to be honest...

If you WANT to do it, it's cool, if it's a hassle, dont' sweat it, my own stupid fault for being too hasty

(1-23/23)