You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Matthew Joyce <MJ...@ccia.unsw.edu.au> on 2006/11/08 06:05:48 UTC

Using SVN to version configuration files.

Hi,

First post, so hello to all.


I have a couple of Debian Linux machines, which I use to run Nagios, a
network monitoring application.
The config for Nagios is text based, typically a collection of text
files.
The files can be a bit fiddly, so generally I TAR up[ the whole folder
before making significant changes.

I was thinking perhaps SVN might be useful here; make some changes test
them and commit them.  Nice to be able to roll back should things not
work out.

I've installed SVN from Debian Sarge's apt repository, svn v1.1.4-2.
I'm not sure I fully understand how SVN works in practice, this is what
I have done :

Made a repository folder
	/usr/local/svn/nagios

Create a SVN repository
	svnadmin create /usr/local/svn/nagios/

Imported my live Nagios config
	svn import /usr/local/nagios/etc file:///usr/local/svn/nagios


What would be intuitive for me, would be to carry on and edit my config
files, test them, be happy with them.
Then, commit the changes I've made to SVN as a new version of the files.

What I'm not clear on is, the files in /usr/local/nagios, are they my
nagios config files, or are they SVNs version of the most recent files ?
Rather, is it ok to edit these files, or should I 'checkout' a copy of
these files to work on and then commit them, back to the live system ?

If I need to check them out, then it's going to be difficult to test
them, as they won't be in the right place (for nagios).

Or do I move all the config files to start with, import them, and then
use checkout to put them in their natural operating location.
I have two Nagios machines, would I then checkout the committed config
to the alternate device ?

Well, I hope I've articulated what I'm trying to achieve, well enough
for someone to offer useful advice.

Thanks


Matthew Joyce
02 9382 0051 | IT Manager | Children's Cancer Institute Australia for
Medical Research

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org


Re: Using SVN to version configuration files.

Posted by Mark <ma...@mitsein.net>.
Looking into your actual svn repository, you won't actually find your
files.  svn stores them in its own format.  So yes, you'll have to
check them out to see them.

For what you are describing, you'd likely be better off just using
RCS.  Create an RCS directory in your /etc/nagios directory, check
them all in, then you can use RCS to control changes.

co -l services.cfg
vi services.cfg
ci -u -m'added a service' services.cfg

On 11/7/06, Matthew Joyce <MJ...@ccia.unsw.edu.au> wrote:
>
> Hi,
>
> First post, so hello to all.
>
>
> I have a couple of Debian Linux machines, which I use to run Nagios, a
> network monitoring application.
> The config for Nagios is text based, typically a collection of text
> files.
> The files can be a bit fiddly, so generally I TAR up[ the whole folder
> before making significant changes.
>
> I was thinking perhaps SVN might be useful here; make some changes test
> them and commit them.  Nice to be able to roll back should things not
> work out.
>
> I've installed SVN from Debian Sarge's apt repository, svn v1.1.4-2.
> I'm not sure I fully understand how SVN works in practice, this is what
> I have done :
>
> Made a repository folder
>         /usr/local/svn/nagios
>
> Create a SVN repository
>         svnadmin create /usr/local/svn/nagios/
>
> Imported my live Nagios config
>         svn import /usr/local/nagios/etc file:///usr/local/svn/nagios
>
>
> What would be intuitive for me, would be to carry on and edit my config
> files, test them, be happy with them.
> Then, commit the changes I've made to SVN as a new version of the files.
>
> What I'm not clear on is, the files in /usr/local/nagios, are they my
> nagios config files, or are they SVNs version of the most recent files ?
> Rather, is it ok to edit these files, or should I 'checkout' a copy of
> these files to work on and then commit them, back to the live system ?
>
> If I need to check them out, then it's going to be difficult to test
> them, as they won't be in the right place (for nagios).
>
> Or do I move all the config files to start with, import them, and then
> use checkout to put them in their natural operating location.
> I have two Nagios machines, would I then checkout the committed config
> to the alternate device ?
>
> Well, I hope I've articulated what I'm trying to achieve, well enough
> for someone to offer useful advice.
>
> Thanks
>
>
> Matthew Joyce
> 02 9382 0051 | IT Manager | Children's Cancer Institute Australia for
> Medical Research
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: users-help@subversion.tigris.org
>
>


-- 
Mark
"Blessed is he who finds happiness in his own foolishness, for he will
always be happy."

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Using SVN to version configuration files.

Posted by Ryan Schmidt <su...@ryandesign.com>.
On Nov 8, 2006, at 00:05, Matthew Joyce wrote:

> I'm not sure I fully understand how SVN works in practice, this is  
> what
> I have done :
>
> Made a repository folder
> 	/usr/local/svn/nagios
>
> Create a SVN repository
> 	svnadmin create /usr/local/svn/nagios/
>
> Imported my live Nagios config
> 	svn import /usr/local/nagios/etc file:///usr/local/svn/nagios
>
>
> What would be intuitive for me, would be to carry on and edit my  
> config
> files, test them, be happy with them.
> Then, commit the changes I've made to SVN as a new version of the  
> files.

If that's what you wanted, then an "in-place import" would have  
suited you well:

http://subversion.tigris.org/faq.html#in-place-import

If you haven't already made lots of changes to what's in the  
repository, then you could just blow it away ("rm -rf /usr/local/svn/ 
nagios") and recreate it and do an in-place import.


> What I'm not clear on is, the files in /usr/local/nagios, are they my
> nagios config files, or are they SVNs version of the most recent  
> files ?

Subversion does not change any files that you import using "svn  
import". What's in /usr/local/nagios now is exactly what was there  
before you thought about Subversion.

> Rather, is it ok to edit these files, or should I 'checkout' a copy of
> these files to work on and then commit them, back to the live system ?

You can edit the files, but you won't be getting the changes back to  
Subversion from there. For that, you need to make the changes in a  
working copy. You can either "svn checkout" a new working copy  
somewhere else, or move the current /usr/local/nagios out of the way  
("mv /usr/local/nagios /usr/local/nagios-old") and check out the  
working copy there. Or, to avoid that, use the in-place import in the  
first place.


> If I need to check them out, then it's going to be difficult to test
> them, as they won't be in the right place (for nagios).
>
> Or do I move all the config files to start with, import them, and then
> use checkout to put them in their natural operating location.
> I have two Nagios machines, would I then checkout the committed config
> to the alternate device ?




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org