Saturday, May 30, 2009

Host Your Own Website on Dynamic IP Address


Now you can host your website on own local machine with a Dynamic IP Address. I have hosted on my local machine and yes you can do too!!!

I am not just writing this blog for hosting your websites on your local machine with dynamic ip address but also you can configure your machine to host repositories of your code and other software’s like Trac, CruiseControl, Svn, etc. I Hope you know about these software’s... :)

This is helpful for those guys who want to start with small team working in different places …

First of all the required things you have to have are:

1.Desktop or Laptop where you want to host the applications with good configuration.

2.Broadband Connection … it will be work with your dial up too...for that god only can help you ;)

3.Off-course software’s that to be installed. I am demonstrating with Apache 2.2 to host your static web application, Svn for code repository, Cruise-Control for automating build process of your code base and Trac for code browse and bug management.

4.And for hosting then website you need to register yourself on

http://www.dyndns.com

(Just for connecting to your machine to DNS server).

First let see how to get the domain name registered on DynDns.com.

After registeration on DydnDNS ,follow these steps:

1. Login to website and go My Services.


2. And from there you click on "Add Hostname".



3. Add the hostname and the choose the domain name which will get suffix to your hostname.Like I choose hostname as “ideeksha” and the domain as “gotdns.com”.So you access your website as

http://ideeksha.gotdns.com/ .


4. DynDNS will detect your ip address ,so click on autp detect link which will fill your ip address field. Finally click on “Create Host ” button. This will lead you towards checkout of this service and as it is free service you will be charged “Zero” dollars. Happily do the checkout and activate the service.

5. After this you have to edit your host file. As I am on Windows XP machine ,you will find your host file in “C:\WINDOW\system32\drivers\etc” directory. Open your hosts file and add the highlighted entry and save the file.


192.168.1.2 is the ip address assigned to my machine by the router ,as the router is connected to my modem. So the ip address that you entered on DynDNS is modem ip address and to route the request from modem to your machine ,this is entry is needed.

Now time is come when you can install Apache or tomcat on your machine and hosts the application there. So install the Apache and put the application under your apache htdocs folder and mine is here “C:\Program Files\Apache Software Foundation\Apache2.2\htdocs”.

Start your apache and excess the website as http://ideeksha.gotdns.com/. And you can see your website hosted on your local machine with dynamic ip address.



And there is one mystery about who will update the ip address on DynDns for you updated ip address when you get new ipaddress from your ISP. This can be solved by two means ,you can install the DynDns Auto Update Client which automatically update your dns entry in DynDNS or yor modem may have the facilty to do the same. You can see both settings images below.

Last thing which is remaining is to integrate svn and trac with your apache so you can access them.

Install svn and trac with their default settings and change the httpd.conf file of apache with these settings:

<Location /svn/iDeekshaMailClient>

DAV svn

SVNPath C:/SVNREPO/iDeekshaMailClient

AuthType Basic

AuthName "Subversion iDeekshaMailClient repository"

AuthUserFile c:/etc/svn-auth-file

Require valid-user

</Location>

<LocationMatch "/Trac/[^/]+/login">

AuthType Basic

AuthName "Trac"

AuthUserFile C:/etc/svn-auth-file

Require valid-user

</LocationMatch>

<Location /Trac>

SetHandler mod_python

PythonInterpreter main_interpreter

PythonHandler trac.web.modpython_frontend

PythonOption TracEnvParentDir C:/TRACREPO

PythonOption TracUriRoot /Trac

</Location>

Now you can access your svn as http://ideeksha.gotdns.com/svn/iDeekshaMailClient and trac as http://ideeksha.gotdns.com/Trac/iDeekshaMailClient Integration of svn and trac in detail you get from googling :)

For svn installation and integration with apache (http://www.trajiklyhip.com/blog/index.cfm/2007/3/13/Part-2-Installing-Subversion-142-and-Integrating-Subversion-With-Apache)

For your cruise-control you have install Cruise-Control first and for that you have to register for different domain name like I have done .You have to do redirect as apache is running on 80 port and cruise control is running on 7070 port , so have to do port forwarding on your modem for 7070 for cruise control application.

So, this concludes with our integration of trac and svn with apache and running the cruise-control build on your code base .So now from any member of your team can take check out of your code and do code browsing using trac and off-course do the build on code base using cruise-control.

Happy Coding!!!

Cheers!

No comments :