Rails Deployment 101 Part 1: Setting up DNS
In this article, we’ll go over setting up your deployment machine with a public IP address and a domain name. You’ll want to do this if you plan to use your machine to host a website that the public can view.
Public IP
First you’ll need to make sure you have access to a public IP address for your server. Your ISP will have to provide you with this as part of your service agreement. Your ISP can tell you exactly how to map each public IP address to one of your computers. One common method is using the router software, as shown below.
![]()
For our ISP, we map a computer to an IP with this software and set the computer to use DHCP. The router assigns this IP to the correct computer each time it requests an IP address. Keep in mind you’ll have to restart your computer’s network services before the changes take effect.
Turn off Firewalls
The next step is to turn off ALL of your firewalls. Actually, you’ll only want to open the ports that you want to be publically accessible, but for now, we’ll open up everything. In Windows, this means the windows firewall located in the control panel. In addition, if you use an Internet security product like Norton Internet Security, turn the firewall off.
![]()
In SUSE Linux, this is located in your YAST manager > Security > Firewall.
Checkpoint: Access your IP
At this point, you should be able to access your computer from another computer outside your network using the public IP address. Open up a DOS prompt and type “ping 67.167.164.92″, substituting your IP address. If you see the following, you’re doing good.
Otherwise, try
- restarting the computer
- restarting the router
- checking for more firewalls
Setting up DNS
We’ll use GoDaddy for this example, but there are many companies who provide DNS services. First, purchase your domain name from a site like GoDaddy. Then, using their DNS Manager interface, enter the IP address of the computer you’re mapping to. The @ record points to the domain in question. You can add subdomains for free. For example, to add DNS for demos.jupiterit.com, we add a record to this table, call it demos, and assign the IP address to one of our servers.
![]()
This IP address / domain name pairing will now be recognized anywhere (after a short delay). After a few hours, this DNS entry should propagate to the rest of the internet. Test it in DOS by now pinging the domain name, “ping mydomain.com”.
If you’re wondering why GoDaddy even needs to be used at all, they are the ones who can make your DNS pairing public to the Internet. Even if you do your own hosting, which presumably you are, you need GoDaddy to provide this valuable service (its pretty cheap, around $10 per year).
DOS network debugging tools
nslookup is another useful debugging command for DOS. It looks up the DNS entry for a name.
ipconfig /all tells you information about your local network and IP address.
portqry.exe is a useful program you can download from the microsoft site: http://support.microsoft.com/kb/310099. It lets you troubleshoot network issues by trying to ping specific ports. For example, portqry -n myserver.com -p tcp -r 8000:8100 will scan all ports from 8000 to 8100 on your server, telling you which are open, and which are not. “ping” itself only “pings” port 80 by default.
January 23rd, 2008 at 4:12 am
[…] Next: Rails Deployment 101 Part 1: Setting up DNS […]