Share this blog
- Morfik Discussion Forums rules and guidelines
- MDA Release: The FacebookLike Package
- MDA Release: The Rating Package
- MDA Release: The HTML5 Video Package
- MDA Release: The Accordion Package
- April 2011 (1)
- January 2011 (4)
- December 2010 (2)
- November 2010 (3)
- October 2010 (5)
- September 2010 (3)
- August 2010 (4)
- July 2010 (5)
- June 2010 (4)
- May 2010 (5)
- April 2010 (4)
- March 2010 (8)
- February 2010 (17)
- January 2010 (20)
DNS and Morfik Deployment Automation Services (DAS)
Personally I feel most people using the internet don’t notice or appreciate the wonderful work of DNS (Domain Name System) servers. There is no reason really for them to think about it; they type an address on the browser and the website appears. Like a phone number, you dial the right number and the right person answers. That is fine until you offer an online service on the internet, you have your own domain name and somehow you need to use a DNS service. Since most Morfik users will be using Morfik DAS, sooner or later it will be essential to know a few things about DNS and how it relates to Morfik DAS.
The thing that prompted me to do this blog is that most users beta testing Morfik Auto-Deployment software on their own servers were surprised to see that the initial URL address for their XApps included “morfikspace.com”! What really caught my attention was when someone wrote to me and asked “Is this my server or a Morfik server”?
In this blog I will deal with this question and related issues in two distinct contexts.
- Domain Name Services inside Morfik DAS
- Modern features of Domain Name Services
Domain Name Services inside Morfik DAS
If you have tried Morfik’s Auto-Deployment software you would have noticed a wizard opening your new site in the default browser with an address like this:
You might be asking “Why morfikspace?” given that it is your own server?
There are a few different ways for running multiple applications on one server. You can use a different port for each application but then you would have the port number in your URL addresses. You can use a different IP address for each application but then there is a limited number of IP addresses which could be allocated to your server, plus you most likely will have to pay for them. The most effective way to host multiple applications on one server is through domain names and resolution by name. That means that when the web server receives a request, it looks at the domain name and passes the request to the right application.
Morfik DAS uses the ‘resolution by name’ technique to enable you to host multiple applications on your server. Since Morfik does not have access to your DNS service provider, when you initially auto-deploy your XApp Morfik has to use a generic domain name to install and configure your XApp on the target server. This temporary domain name is based on the morfikspace domain and has the following format:
Now we know why the initial URL is a morfikspace.com address but how do we add our own domain name to our XApp running on the server? It is an easy process involving two steps:
- You need to create/change the DNS entry for your domain name to point to the IP address of the server which hosts your application.
- In Morfik IDE add a secondary domain name to your running XApp.
- Open your project in Morfik IDE.
- Run the Deployment wizard.
- Login and go to the next page of the wizard.
- On the “Deployment Action” page of the wizard click the radio button “other” and from the dropdown box choose “Add/Remove Domain Names” and click the next button.
- Select your server/XApp on the next page and go to the next page.
- Click on the “Add” button on the next page and add ‘www.yourdomain.com’ and then click finish.
Repeat this process for any other domain name you want to add to your XApp.
Modern features of Domain Name Services
There are a number of features that modern providers of DNS services offer that could be interesting to Morfik DAS users. These include load balancing, monitoring and routing of traffic to a desired server.
There are many ways you can provide redundancy or load balancing to prevent downtime and provide a distributed access to your online services. The most basic (and generally most cost-effective) way to do this is to use the existing facility usually provided by most DNS service providers.
Imagine if we assign more than one IP address for a given domain name in our DNS entries.
In other words we are saying there are 3 servers serving the same domain. We also add a simple mechanism to tell the DNS to use a different IP for every query. This is effectively a simple form of load balancing. Add a monitoring system to this, so that if a server goes down the DNS removes that server IP while the server is down, and you have a global load balancer which can distribute the load between servers located in different parts of the world.
These days the information about an IP address can be traced to a lot finer resolution than a region. That means for any given IP address we can determine the country, the region and the city location of that IP address. Adding this intelligence to a DNS would provide a system for intelligent routing of traffic to different servers. And that is very powerful.
Imagine one of the above IP addresses for www.morfik.com was in the USA, another one was in the Netherlands and a third one was in Singapore. Using intelligent routing we could say to our DNS that if a DNS query came from the USA, Canada or anywhere in South America, then provide the IP address of the server in the USA. For any query from Europe provide the Netherlands server, and for queries from Asia present the IP address of the Singapore server.
These are the type of DNS services that big companies like Google use in order to provide faster access, redundancy and a distributed and robust system. Google has its own DNS infrastructure, but you don’t need to have the resources or financial strength of Google to be able to achieve this. There are companies like Edge Director or UltraDNS which provide similar services for small and medium size businesses.
Some useful tips
I can talk a lot more about DNS services, the type of records they keep or serve, how they help with controlling spam and blacklists or even the software update process. However, to keep this short I’ll stick to something which would be more useful to you.
When you add an entry to the DNS for your domain you can define a time-to-live (TTL) for each entry. This is a parameter defined in seconds which indicates to programs caching the entry how long the cache would be valid. After each DNS query resolution (Name resolved to IP) all DNS resolvers on the way, including your own computer, keep a copy of the result in their cache so they don’t have to retrieve the same information again before the TTL for that entry expires. Problems arise when we make a change to an entry, such as pointing www.mydomain.com, which is currently pointing to 126.96.36.199,to another IP address like 188.8.131.52. Depending on the TTL for www.mydomain.com it could take up to 24 hours before all DNS resolvers update their cache for this entry. This could obviously create problems as some of the DNS resolvers which had this entry in their cache would still resolve the address to the old IP address until they are all updated.
While you develop, deploy, test or debug a web application you may have to create and change DNS entries. If you think the address you need to reach is not resolving correctly you could use one of the utilities included with most versions of Windows, “nslookup.” (I’m sure it is a copy of the Linux command).
With this utility you can query any DNS resolver or an ANS to check the validity of a domain name entry. Nslookup has its own shell. If you type just nslookup at the command prompt you will enter the nslookup shell. Type “help” and it will show you which commands are available to use.
Without going through the shell, here are a couple of examples of how “nslookup” can be used:
C:\> nslookup google.com
(The above command would look for google.com in the default DNS resolver)
C:\> nslookup google.com ns3.google.com
(The above command looks for google.com in the google Authorative Name Server ns3.google.com)
If you need to test a domain name against a website or application without setting up a DNS entry for it, you can use the “hosts” file on your system as well as on the server. This is a very simple exercise. You can locate this file somewhere under the system folder. In my system this file is located at:
Open the “hosts” file with your notepad and create an entry of domain name, some space and the IP address of the server. You also have to do the same on the server but this time the IP address should be the local host “127.0.0.1”. For resolving an address your computer first looks at the “hosts” file.
Another point to be aware of is that there are some DNS service providers who provide SOAP-API access to their services. This means you can create and make changes to a domain entry programmatically therefore automating this process.
I mentioned earlier that your computer (OS) also caches DNS entries of domains you have accessed before. But how do you clear this cache if you have to? Rebooting can do the job but there is an easier way – at the command prompt simply type:
C:\> ipconfig /flashdns
Well that is all on DNS servers for the time being – I hope you found something useful in my blog.