Results 1 to 6 of 6

Thread: Getting uberSVN to display site from branch

  1. #1

    Getting uberSVN to display site from branch

    Hello all,

    Very new to this so bear with me. I have made many searches and see that a lot of people disagree with this method but can be done. Let's assume that I can only do this option...

    We have 5 developers who all will work on different aspects of our site. These are stored in folders in 'branches'.
    The developers all use TortoiseSVN and 'Commit' their changes as and when they update something on the code.
    Now what I would like to do is display the site in a browser, for example. If Dev 1 works on folder 'Code A' and then commits, Dev 1 can then go to http://branch.codea.example.com. I then want Dev 2 to be able to work on 'Code B' and then be able to do the same and view http://branch.codea.example.com - I would like this to be instant.

    I have apache set up and can change the document root to anywhere. This is a totally separate server (running Ubuntu 10) from the main live site. The developers are normally all working on different parts of the site so being able to view the site from the branch folder is imperative, I have seen lots of references to 'svn update' in a post-commit file but so far, this doesn't work.

    One we are happy with the branch, I want to be able to make that a 'trunk' and export that to our staging server (again, is separate). Only then will we export to the new site.

    So to sum up, I would like to know:
    1) How to display the site directly from the repository (to test code changes)?
    2) How to export from a Trunk to a staging server (to test the whole site and bosses!)?
    3) Any code that I need in order to set this up (I have been looking and even been on the phone to uberSVN).

    Thank you for taking the time to read, I hope someone can help

    Aaron.

  2. #2
    Senior Member Site ModeratorSite Admin
    Join Date
    Mar 2011
    Location
    Chesterfield, UK
    Posts
    771
    Quote Originally Posted by AaronB View Post
    1) How to display the site directly from the repository (to test code changes)?
    2) How to export from a Trunk to a staging server (to test the whole site and bosses!)?
    3) Any code that I need in order to set this up (I have been looking and even been on the phone to uberSVN).

    Thank you for taking the time to read, I hope someone can help

    Aaron.
    You can't serve your site directly from the repository -- what you want is a continuous integration server, for example Jenkins. A continuous integration server would watch your repository and perform actions either when check-ins happen or periodically on a schedule. The actions you would normally have it perform are things like check-out from repository, build source (if necessary), deploy to a test environment, publish tarballs, or anything you want really.
    Mat Booth
    Software Engineer
    WANdisco, Inc.

    I joined the blog-o-web-o-sphere! Linux and Coding Blog

    How To Ask Smart Questions

  3. #3
    Hello Mat,

    Thank you so much for this. I have managed to get a lot further down the line now and it's all looking very good.

    I have one further question which is about Jenkins. In the same scenario as about, I would like the build to be run by Jenkins automatically. I know there is a schedule but this would leave a lot of build numbers and run each build in the branches folder.

    Is there a way (if so how) that upon Commit, the build in Jenkins is started automatically? Ideally I would like only the build to which has just has the files committed to, to build but if all the repositories run then so be it.

    Again, thank you for your hep and support.

  4. #4
    Senior Member Site ModeratorSite Admin
    Join Date
    Mar 2011
    Location
    Chesterfield, UK
    Posts
    771
    Sure, under the Build Triggers section, use the "poll SCM" option. Jenkins will monitor your source control and only build if something has changed. There is also no real limit to the number of build jobs you can configure so you can have a separate build job for each branch if you wish.
    Mat Booth
    Software Engineer
    WANdisco, Inc.

    I joined the blog-o-web-o-sphere! Linux and Coding Blog

    How To Ask Smart Questions

  5. #5
    Thank you very much for your help

  6. #6
    Sorry for a late reply to this, but we have a similar situation where we do our web development out of svn and what we ended up doing was editing the post-commit.bat located in the repository's hooks folder(ie C:\Repositories\nameofrepository\hooks\post-commit.bat).

    there is a section in there between START-CUSTOM-CODE and END-CUSTOM-CODE.

    In there we added the following:
    Code:
    SET CSCRIPT=C:\WINDOWS\system32\cscript.exe
    SET VBSCRIPT=C:\Repositories\post-commit-hook-jenkins.vbs
    
    "%CSCRIPT%" "%VBSCRIPT%" %REPOS% %REV%
    By adding the above we told it on commit to run the visual basic script, in the script it essentially just does a wget or an http request to a url on the ubersvn server which triggers the job almost instantly rather then polling for 1minute, ie the link would be:
    Code:
    http://www.yourserver.com.com:9890/jenkins/job/nameofjenkinsjobgoeshere/build?token=somelongstringofjibberishtoken
    Then in your jenkins job you can set it to activate to that token, and whenever that repository has a commit it will trigger the jenkins job instantly rather then waiting for the 1 minute poll. This helps speed up the process a bit.

    It would be awesome if we can just have an option in the repository to trigger a jenkins job on commit automatically *wink wink*.
    Last edited by tgardner; 12-27-2011 at 11:56 AM.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •