You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Szymon Bakowski <sz...@bakowski.net> on 2008/01/14 14:51:40 UTC

SVN and web development

Hello guys,

First post here :D

I was using SVN for quite some time now and must admin that this is an
excellent product.

What I was recently contemplating on, is how to make some things
automatic in regards to enterprise development process and would like
to share my thoughts with you. I went through the archive but haven't
found many interesting posts on that matter. In particular, I am
interested in opinions as to how syncing process from svn server
should be carried out towards live web servers.

First of all, let me share two interesting links in this matter:

http://subversionee.blogspot.com/
http://www.sitepoint.com/blogs/2006/02/07/using-svn-for-web-development/

After reading above and some personal experience, I've compiled a
following list of ideas as  to syncing to live servers problems:

* making a directory on a web server a "working copy" and then just
updating it to particular tag (tag in this context would mean a
snapshot of a trunk considered as release)

* making a checkout or update to /tmp directory and then sync it to
the destination htdocs

* use "svn export" as a post-commit hook after creating new tag (as
earlier, that would mean to create a new release and trigger live
servers update)

I was wondering what would be your thoughts on this matter.

Regards

Szymon Bakowski

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

Re: SVN and web development

Posted by Ryan Schmidt <su...@ryandesign.com>.
On Jan 14, 2008, at 13:43, Les Mikesell wrote:

> Shawn Talbert wrote:
>
>> I kinda like a hybrid version of the ones you mention:
>> 1. use svn update (to efficiently update) to some staging area on  
>> the web server
>> 2. svn export that to the real web folder (this avoids polluting  
>> with svn metadata).
>
> You can also use rsync with the -C (or --cvs-exclude) option to  
> copy from a staging workspace to the production destination(s).   
> This originally was intended for cvs metadata but also skips .svn/  
> contents.  Rsync has the advantages of using less bandwidth for  
> remote copies and copying in under a temporary name and renaming to  
> the original when the transfer is complete so the running  
> application does not see partial files.


The version we used is roughly:

1. svn switch an existing working copy to a new release tag, so the  
update from the repository is efficient
2. svn export the working copy to a new directory, named for the tag
3. delete the symlink "current"
4. recreate the symlink "current" to point at the latest exported  
directory

Deleting and recreating the symlink is of course very quick, so  
switching from one version of the site to the next is fast and,  
importantly, consistent. If your web server points directly at your  
working copy, then during the time that your update is running (which  
could be awhile if your network is slow or if there are many  
changes), your web site is in an inconsistent state (partly updated,  
partly not updated) which sounds like a bad idea to me. Also, an  
update can and sometimes does fail in the middle, leaving your web  
site in that inconsistent state. Better to prepare the new version in  
a new directory, and only when it's completely ready, point the web  
server at it (by redirecting a symlink).

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

Re: SVN and web development

Posted by Les Mikesell <le...@gmail.com>.
Shawn Talbert wrote:
> I kinda like a hybrid version of the ones you mention:
> 
> 1. use svn update (to efficiently update) to some staging area on the web server
> 2. svn export that to the real web folder (this avoids polluting with svn metadata).

You can also use rsync with the -C (or --cvs-exclude) option to copy 
from a staging workspace to the production destination(s).  This 
originally was intended for cvs metadata but also skips .svn/ contents. 
  Rsync has the advantages of using less bandwidth for remote copies and 
copying in under a temporary name and renaming to the original when the 
transfer is complete so the running application does not see partial files.

-- 
   Les Mikesell
     lesmikesell@gmail.com



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

RE: SVN and web development

Posted by Shawn Talbert <st...@exploreconsulting.com>.
I kinda like a hybrid version of the ones you mention:

1. use svn update (to efficiently update) to some staging area on the web server
2. svn export that to the real web folder (this avoids polluting with svn metadata).

-----Original Message-----
From: itsimonb@gmail.com [mailto:itsimonb@gmail.com] On Behalf Of Szymon Bakowski
Sent: Monday, January 14, 2008 6:52 AM
To: users@subversion.tigris.org
Subject: SVN and web development

Hello guys,

First post here :D

I was using SVN for quite some time now and must admin that this is an
excellent product.

What I was recently contemplating on, is how to make some things
automatic in regards to enterprise development process and would like
to share my thoughts with you. I went through the archive but haven't
found many interesting posts on that matter. In particular, I am
interested in opinions as to how syncing process from svn server
should be carried out towards live web servers.

First of all, let me share two interesting links in this matter:

http://subversionee.blogspot.com/
http://www.sitepoint.com/blogs/2006/02/07/using-svn-for-web-development/

After reading above and some personal experience, I've compiled a
following list of ideas as  to syncing to live servers problems:

* making a directory on a web server a "working copy" and then just
updating it to particular tag (tag in this context would mean a
snapshot of a trunk considered as release)

* making a checkout or update to /tmp directory and then sync it to
the destination htdocs

* use "svn export" as a post-commit hook after creating new tag (as
earlier, that would mean to create a new release and trigger live
servers update)

I was wondering what would be your thoughts on this matter.

Regards

Szymon Bakowski

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

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


Re: SVN and web development

Posted by Szymon Bakowski <sz...@bakowski.net>.
On 15/01/2008, John Peacock <jo...@havurah-software.org> wrote:
> Szymon Bakowski wrote:
> > Still, any comments and suggestions more then welcomed.
>
> The way I designed SVN::Notify::Mirror was:
>
> 1) a single post-commit script handles multiple different operations, based on a
> regex match of the path(s) in the commit;
>
> 2) operationally, I have a test server which always keeps in sync with trunk;
>
> 3) the production web server sync to a project tag which matches a specific
> regex (in my case RELEASE-YYYYMMDDSEQ) using switch;
>
> 4) the production server is located on a remote DMZ and has no direct access to
> the Subversion server, so all traffic is tunneled over SSH;
>
> 5) SVN::Notify::Mirror also supports using rsync as an update method (if the
> presence of metadata offends you).
>
> I actually use SVN::Notify::Config (which I didn't originally author, but which
> I maintain now) so that the post-commit script is a YAML data file (this is a
> machine readable, yet human editable format that encapsulates all basic Perl
> types).  From the POD:
>
>          #!/usr/bin/perl -MSVN::Notify::Config=$0
>          --- #YAML:1.0
>          '':
>            PATH: "/usr/bin:/usr/local/bin"
>          'path/in/repository':
>            handler: Mirror
>            minimal: 1
>            to: "/path/to/www/htdocs"
>          'some/other/path/in/repository':
>            handler: Mirror
>            to: "/path/to/remote/www/htdocs"
>          'some/project/tags':
>            handler: Mirror
>            to: "/path/to/another/dir"
>            tag-regex: "TRUNK-"
>
> That's the entire post-commit script!  That corresponds to an hash of hashes...
>
> HTH
>
> John

Thank you for that John. I do appreciate your input and will most
certainly go through it.

Just found one more link that may be of interest to users in a theory
department:

http://svn.collab.net/repos/svn/trunk/doc/user/svn-best-practices.html

Kind regards

Szymon Bakowski

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

Re: SVN and web development

Posted by John Peacock <jo...@havurah-software.org>.
Szymon Bakowski wrote:
> Still, any comments and suggestions more then welcomed.

The way I designed SVN::Notify::Mirror was:

1) a single post-commit script handles multiple different operations, based on a
regex match of the path(s) in the commit;

2) operationally, I have a test server which always keeps in sync with trunk;

3) the production web server sync to a project tag which matches a specific
regex (in my case RELEASE-YYYYMMDDSEQ) using switch;

4) the production server is located on a remote DMZ and has no direct access to
the Subversion server, so all traffic is tunneled over SSH;

5) SVN::Notify::Mirror also supports using rsync as an update method (if the
presence of metadata offends you).

I actually use SVN::Notify::Config (which I didn't originally author, but which
I maintain now) so that the post-commit script is a YAML data file (this is a
machine readable, yet human editable format that encapsulates all basic Perl
types).  From the POD:

         #!/usr/bin/perl -MSVN::Notify::Config=$0
         --- #YAML:1.0
         '':
           PATH: "/usr/bin:/usr/local/bin"
         'path/in/repository':
           handler: Mirror
           minimal: 1
           to: "/path/to/www/htdocs"
         'some/other/path/in/repository':
           handler: Mirror
           to: "/path/to/remote/www/htdocs"
         'some/project/tags':
           handler: Mirror
           to: "/path/to/another/dir"
           tag-regex: "TRUNK-"

That's the entire post-commit script!  That corresponds to an hash of hashes...

HTH

John

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

Re: SVN and web development

Posted by Szymon Bakowski <sz...@bakowski.net>.
On 14/01/2008, John Peacock <jo...@havurah-software.org> wrote:
> Szymon Bakowski wrote:
> > What I was recently contemplating on, is how to make some things
> > automatic in regards to enterprise development process and would like
> > to share my thoughts with you. I went through the archive but haven't
> > found many interesting posts on that matter. In particular, I am
> > interested in opinions as to how syncing process from svn server
> > should be carried out towards live web servers.
>
> Apparently, you didn't see my *many* postings on the topic.  Check out
> SVN::Notify::Mirror:
>
>         http://search.cpan.org/search?query=SVN::Notify::Mirror
>
> To quote from the POD:
>
> > Keep a directory in sync with a portion of a Subversion repository.
> > Typically used to keep a development web server in sync with the
> > changes made to the repository. This directory can either be on the
> > same box as the repository itself, or it can be remote (via SSH
> > connection).
>
> I wrote this module specifically to manage distributed web development...
>
> John
>

Thanks John. Yes indeed, this matter had been raised before. Maybe I
used wrong search phrase. Sorry about that. Lets treat it as a thread
refresh. Below, please find other threads from this group in regards
to the subject:

http://subversion.tigris.org/servlets/SearchList?list=users&searchText=web+development&defaultField=subject&Search=Search

Still, any comments and suggestions more then welcomed.

Cheers
Szymon

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

Re: SVN and web development

Posted by John Peacock <jo...@havurah-software.org>.
Szymon Bakowski wrote:
> What I was recently contemplating on, is how to make some things
> automatic in regards to enterprise development process and would like
> to share my thoughts with you. I went through the archive but haven't
> found many interesting posts on that matter. In particular, I am
> interested in opinions as to how syncing process from svn server
> should be carried out towards live web servers.

Apparently, you didn't see my *many* postings on the topic.  Check out 
SVN::Notify::Mirror:

	http://search.cpan.org/search?query=SVN::Notify::Mirror

To quote from the POD:

> Keep a directory in sync with a portion of a Subversion repository.
> Typically used to keep a development web server in sync with the
> changes made to the repository. This directory can either be on the
> same box as the repository itself, or it can be remote (via SSH
> connection).

I wrote this module specifically to manage distributed web development...

John

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