Showing posts with label passwd. Show all posts
Showing posts with label passwd. Show all posts

Thursday, February 27, 2014

Configure WanDiscoSubversion 1.8.8 with Apache2-Part1

Hi All,
 
For long time we developers/leads will just start coding by checking-out the folder structure from any URL given b either client or by our architect. But when I worked in my first company I had a chance to setup the Subversion Server and create user account to check-out and check-in code. I am just sharing the knowledge to you. Please just follow the below process. 
I installed the same in Window 8 machine with JDK 7.
WanDisco Subversion1.8.8 come with Apache2, so we don't need to install it separately.
 
 

How to Install and Setup SVN Repository

1.Download and Install WANDiscoSubversion1.8.8 from https://www.wandisco.com/subversion/download
                - Installing will ask : Choose Subversion 1.8.8 Server
                - Destination Folder : C:\Program Files (x86)\WANdisco\Subversion
                - Host : localhost Port :7070
                - Choose :Install as windows Service
                - Repository Directory : D:\Bala\myrepository
This is the location where your are going to save code, so probably the space should be more in real time).
                - Repository Location Prefix : /svn
- Click Install - Completed. Here it installs the Subversion along with the Apache Http. So we dont need to setup the Apache again.
- Next Choose all check boxes. So it will be installed as Windows System Service. So you don't need to start manually at each machine bootup.
2. Also Install TortoiseSVN Client from https://www.wandisco.com/subversion/download

Now create the repositories

- Create Folder inside the "myrepository": "core_java_samples", "spring_samples", "hibernate_samples"
- RighClick inside the folder "core_java_samples", there you can see two items in the menu "SVN Checkout" and "Tortoise SVN".
                - Choose "Tortoise SVN", and Click sub-menu item "Create Repository here".
                - You can see a popup saying that "Repository Created".
                - Also click on the "Create folder structure" button in the popup.
To have Subversion and maintain code we need truck, branch and tag, those files will be created.
                - It will show message "Folder Structure Created".
                - http://localhost:7070/svn/core_java_samples/ - Now the repository is ready.
                - Follow the same steps inside : "spring_samples", "hibernate_samples".
So http://localhost:7070/svn/apring_samples/ and http://localhost:7070/svn/hibernate_samples/  -Now the 3 repository is ready.
4. Now verify them by accessing :
                http://localhost:7070/svn/spring_samples/                        
                http://localhost:7070/svn/core_java_samples/
                http://localhost:7070/svn/hiernate_samples/
5. Also verify whether the trunk,branch and tag structure. There you can see the branch, trunk and tag.
                http://localhost:7070/svn/hiernate_samples/branchs
                http://localhost:7070/svn/hiernate_samples/tags
                http://localhost:7070/svn/hiernate_samples/trunk
 

Setting Access Configuration for the WandiscoSubversion1.8.8

 
WanDiscoSubversion 1.8.8. Installs the Apache2 along with it. So it is not required to install it separately need. Please confirm once again whether it is installed properly by looking into the Installed location.
Open the location:
"C:/ProgramFiles/WanDisco/Subversion"
If you able to see the Apache2, then it is OK. Now we can proceed to configure access control.
"C:/ProgramFiles/WanDisco/Subversion/Apache2"
AuthFile Creation
1. Go to the Apache2 home directory ""C:/ProgramFiles/WanDisco/Subversion/Apache2".
2. Go to the Apache bin directory : cd C:/ProgramFiles/WanDisco/Subversion/Apache2/bin
3. Then you need to run htpasswd.exe - This will create the users and password.
4. htpasswd.exe -c -m balaji mypassword
5. You will see the response like : balaji=Wweomd215m51m29dks538.
6. Copy the above response and paste into a notepad. Save the file in the name "passwd.htpasswd" (C:\Users\test\Desktop\). This is the Authentication file will be referred by Apache2.
Configuring Repository
7. Now we need to configure the repository to be secured so, please open the the Open the file "Apache2/conf/subversion.conf".
Find the Line like "

 
8. Modify the Block like this :

 

<VirtualHost *:7070>

 KeepAlive On

 <Location /svn>

  DAV svn

  SVNParentPath "D:\Bala\myrepository"

  RedirectMatch ^(/svn)$ $1/

  AuthType Basic

  AuthName "Subversion Repo"

  AuthUserFile "C:\Users\test\Desktop\passwd.htpasswd"

  #AuthzSVNAccessFile /home/scm/svn.authz

 Require valid-user

 #Order allow,deny

 #Allow from all

  SVNAutoversioning on

 </Location>

 # Enable Subversion logging

CustomLog logs/subversion.log combined
</VirtualHost>
7. Now Restart the Service : Control Panel--System and Security--Services--Wandisco Subversion--Re-Start. 
Now Your Repository is Secured !
Now if you check the URLs -all will require the username and password. Please enter the balaji and mypassword.
http://localhost:7070/svn/spring_samples/
http://localhost:7070/svn/core_java_samples/
http://localhost:7070/svn/hibernate_samples/
Now the SVN Repository is secured with authentication.
 
OK Lets Enjoy the Subversion with Check-outs and Check-in.
Hope this is helpful to you. Please send your feedback to Balaji.Mathu@Gmail.Com. 
 

Configuration Management

 

Trunk

Trunk is the main base code of development, originating from the start of the project until the present.

Branch

Branch is a copy of code derived from trunk at certain point that is used for applying major changes to the code while preserving the integrity of the code in the trunk. If the major changes are completed according to plan, branch code will be merged back into the trunk.

Tag

Tag is a point in time on the trunk or a branch that you wish to preserve. The two main reasons for preservation would be that either this is a major release of the software, whether alpha, beta, RC or RTM, or this is the most stable point of the software before major revisions on the trunk were applied.

SCM Maintenance

So once you base code/folder structure is created in trunk, then you need to create branch from trunk. Then all developers in your team will check-out from this branch and check-in the code.Once you completed your coding phase and confirm there will be no changes, give release for deployment, then merge the code into trunk and tag it from trunk.Tags or branches will not occupy the same memory space of the code,instead occupies only the changes from trunk. So will take few bytes of memory only.
If you need to start another iteration of changes in code, you need to cut the code again from trunk. And same process to be followed.
In the point of Releasing RC 1.00 - SVN structure will be like.
Ø  trunk/ - development version, soon to be 1.1
Ø  branches/1.0 - upcoming 1.0.1 release
Ø  tags/1.0.0 - 1.0.0 release version
In the point of Releasing RC 1.0.1 - SVN structure will be like.
Ø  trunk/ - development version, soon to be 1.1
Ø  branches/1.0 - upcoming 1.0.2 release
Ø  tags/1.0.0 - 1.0.0 release version
Ø  tags/1.0.1 - 1.0.1 release version
In the point of Releasing RC 1.0.2 - SVN structure will be like.
Ø  trunk/ - development version, soon to be 1.1
Ø  branches/1.0 - upcoming 1.0.3 release
Ø  tags/1.0.0 - 1.0.0 release version
Ø  tags/1.0.1 - 1.0.1 release version
Ø  tags/1.0.2 - 1.0.2 release version

Best way of SVN management

Create a private branch before coding started. Start check-in on branch. When coding is complete, manager reviews all private branch changes and merges them to /trunk.
Pros: /trunk is guaranteed to be extremely stable at all times.
Cons: Possibly creating more merge conflicts. Requires users to do lots of extra merging.
 
Next : In the next post I will give the same kind of steps to install Jenkins/Hudson and start Continuous Integration.