Vercingetorix Technologies

The Discussion Delegate

Answers to the Ultimate Questions about the Web, Mobile and Vercingetorix

Rackspace vs Prgmr

This post was created on January 5th, 2012 by Sudhanshu and has 0 comments. It has been filed under , , , ,

We have been working on a couple of our own applications, and since they do involve a server side components as well, we decided to spend some time to understand which service should we go ahead with.

I have been been a big fan of Slicehost for years, and when they got acquired by Rackspace, we decided to move there as well. Not to say that we haven’t spent time with other services. We suggest Linode to a lot of our clients, so we have done decent amount of work with that as well. However, Prgmr and Rackspace are two of my favorites and I wanted to find out which one of them works better.

We deviced a simple test. Since we were going to run the site on a really low end box with Apache and PHP (no nginx for now), we decided to put up two really small servers, configure Apache, and track the average response time that we were getting.

It looks a little over 2 hours to come out with the results and here is what we saw

Blue is RackspaceCloud and Red is Prgmr.com

In this screenshot, we have we have reduced the scale of the Y-axis to 5 seconds. As you can see Prgmr.com was slightly slower, but must more consistent.

You can see here that Rackspace almost forgets to respond at times

Another point to note is that the Prgmr.com server has 256MB of RAM while the Rackspace server has 512MB of RAM. So on the whole, if you’re looking for a small VPS to help start your website, I would suggest moving ahead with Prgmr.com.

Popularity: 2%

Augmented Reality App for Zomato

This post was created on December 28th, 2011 by Sudhanshu and has 4 comments. It has been filed under , ,

It is only once in a while that an interesting company comes up here in India AND they give you an API to play around. This is why we jumped with joy when we saw that Zomato had come out with a really cool API. Sadly, due to a huge influx of client projects, we were never able to spend any time on it.

Earlier this month, we decided to build something with the Zomato API; and since we were going to pitch for an augmented reality project in February, we thought it would be a good idea to build an app which shows you a world filled with restaurants and if you should go there or not.

I shouted on Twitter on the 16th saying that we were going to do a one day app, but once we started, we realized that we really couldn’t do justice to it if we were going to spend just a couple of days on it. Unlike big companies, we just needed a quick chai break to convince everybody that this had to be done, and we decided to spend a good two weeks on it.

Things have been moving as quickly as possible and I am now in a position to showcase some of the designs that we have created, which are currently being integrated. (Eventually, it will include things as described in zomato’s terms of service.)

So, here are the initial mockups. We look forward to get some interesting comments!

Popularity: 2%

Here’s to the crazy ones

This post was created on October 18th, 2011 by Sudhanshu and has 1 comment. It has been filed under

Here’s to the crazy ones. The misfits. The rebels. The troublemakers. The round pegs in the square holes.

The ones who see things differently. They’re not fond of rules. And they have no respect for the status quo. You can quote them, disagree with them, glorify or vilify them.

About the only thing you can’t do is ignore them. Because they change things. They invent. They imagine. They heal. They explore. They create. They inspire. They push the human race forward.

Maybe they have to be crazy.

How else can you stare at an empty canvas and see a work of art? Or sit in silence and hear a song that’s never been written? Or gaze at a red planet and see a laboratory on wheels?

While some see them as the crazy ones, we see genius. Because the people who are crazy enough to think they can change the world, are the ones who do.

Popularity: 3%

iPhone : How to URL encode a string

This post was created on August 28th, 2011 by Sudhanshu and has 0 comments. It has been filed under , ,

You would expect that stringByAddingPercentEscapesUsingEncoding would easily encode your strings, but since Apple devs usually spend time on more convoluted problems, this still doesn’t work, even after the fifth major iteration of the SDK.

So, if you need to URL encode a string, here is what you have to do

NSString *encoded = (NSString *)CFURLCreateStringByAddingPercentEscapes(
            NULL,
            (CFStringRef)unencodedString,
            NULL,
            (CFStringRef)@"!*'();:@&=+$,/?%#[]",
            kCFStringEncodingUTF8
);

Popularity: 5%

How to setup your new VPS Ubuntu server

This post was created on August 26th, 2011 by Sudhanshu and has 18 comments. It has been filed under , , ,

Every time you purchase a new Linux VPS, you need to go ahead and set it up for use. Even though we manage to do one server a month, we always seem to forget one thing or the other. So we decided to write down the things that we do. I thought it would be a good thing to share it with everybody as well, so that we could get a few comments about what we’re doing wrong, and people who do it the first time can probably pick up a few things from here.

If you haven’t purchased a server yet, I would suggest you go read The Guide to VPS Servers first.

I have a fascination with Ubuntu and I think it’s the easiest to work with, so I’m going to go ahead and assume that you’re working on the same too.

Okay, now that you have a server, let’s start setting it up.

# Update Ubuntu to get the latest packages
$ aptitude update
$ aptitude safe-upgrade
$ aptitude install htop
$ locale-gen en_US.UTF-8
$ update-locale LANG=en_US.UTF-8

# Set the hostname
$ vi /etc/hostname
Here you need add your hostname, for example vxtindia.com

# Add the admin group and user
$ adduser admin
$ visudo
You need to add the following here
%admin ALL=(ALL) ALL

# Add the other users
$ adduser admin2
$ usermod -a G admin admin2
$ adduser deploy
$ adduser deploy2
$ usermod -a -G deploy deploy2
It's also a good idea to add this for each user
$ vi .bashrc
and the add the following at the end of the file
- PS1='\[\033[0;35m\]\u@\h\[\033[0;33m\] \w\[\033[00m\]: '

# Install Git (if you don’t use it, please start now)
aptitude install git-core

# Edit SSH Config to make it more secure
$ vi /etc/ssh/sshd_config
Once inside, make sure that the following values match
Port 8888
Protocol 2
UseDNS no
Once you're done run the command below

$ /etc/init.d/ssh reload

# Install Apache2
$ aptitude install apache2
$ vi /etc/apache2/apache2.conf
Once inside, make sure the following values are set
KeepAliveTimeout 5
Timeout 30
MaxKeepAliveRequests 400

$ vi /etc/apache2/conf.d/servername.conf
Set the following here
ServerName vxtindia.com

$ vi /etc/apache2/conf.d/security
Set the following here
ServerTokens Minimal
ServerSignature Off

$ apache2ctl restart
$ aptitude install lynx

# Install MYSQL
$ aptitude install mysql-server mysql-client

# Install phpmyadmin
$ aptitude install phpmyadmin

# Install PHP
$ aptitude install php5 php5-json php5-cli php5-mysql php5-dev php5-curl php5-gd php5-imagick php5-mcrypt php5-memcache php5-mhash php5-pspell php5-snmp php5-sqlite php5-xmlrpc php5-xsl
$ apache2ctl restart

# Install postfix
$ aptitude install postfix telnet mailutils
Set/Choose the following options here
Internet Site
System Mail Name = vxtindia.com
Note: postfix log files are at /var/log/mail.info, /var/log/mail.warn, /var/log/mail.err, /var/log/mail.log
Note: postfix config files are at /etc/postfix

$ vi /etc/postfix/main.cf
Set the hostname here
myhostname = vxtindia.com

$ vi /etc/mailname
Set it again here
vxtindia.com

$ postfix reload
$ vi /etc/aliases
Note: save it to external email where server can report abuse
postmaster: abuse@vxtindia-external.com
Note: Change reverse DNS by going to https://www.linode.com/members/linode/rdns.cfm
vxtindia.com

# Install Munin (Master)
$ aptitude install munin munin-node
$ vi /etc/munin/munin.conf
It should like the following
dbdir /var/lib/munin
htmldir /var/cache/munin/www
logdir /var/log/munin
rundir /var/run/munin
contact.vxtindia.command mail -s "Munin notification" server@vxtindia.com
[vxtindia.com]
    address 127.0.0.1
    use_node_name yes

$ chown -R munin /var/cache/munin/www/
$ vi /etc/munin/munin-node.conf
Set the following
host 127.0.0.1

$ service munin-node restart
Note: You can also use /etc/init.d/munin-node restart
$ vi /etc/apache2/sites-enabled/000-default
Here you set the following
Alias /munin /var/cache/munin/www
<Directory /var/cache/munin/www>
    Options FollowSymLinks
    AllowOverride AuthConfig
    Order allow,deny
    Allow from all
</Directory>

$ apache2ctl restart
$ vi /var/cache/munin/www/.htaccess
Make sure the following are there
AuthUserFile /var/cache/munin/.htpasswd
AuthGroupFile /dev/null
AuthName "Munin"
AuthType Basic
 
<Limit GET>
    require valid-user
</Limit>

$ cd /var/cache/munin
$ htpasswd -c .htpasswd admin

# Install Munin (Slave)
$ aptitude install munin-node
$ vi /etc/munin/munin-node.conf
Add the following
allow ^72\.14\.190\.63$
host 69.164.194.243

$ vi /etc/iptables.up.rules
Add the following
# Munin
-I INPUT -p tcp --dport 4949 -m state --state NEW,ESTABLISHED -j ACCEPT
-I OUTPUT -p tcp --dport 4949 -m state --state ESTABLISHED -j ACCEPT

$ iptables-restore < /etc/iptables.up.rules
$ /etc/init.d/munin-node restart
 
Note: Add details to the master
$vi /etc/munin/munin.conf
[a1.88things.com]
    address 69.164.194.243
    user_node_name yes

$ vi /etc/iptables.up.rules
-I OUTPUT -p tcp --dport 4949 -m state --state NEW,ESTABLISHED -j ACCEPT
-I INPUT -p tcp --dport 4949 -m state --state ESTABLISHED -j ACCEPT

$ iptables-restore < /etc/iptables.up.rules
$ /etc/init.d/munin-node restart

# Install Munin Plugins
$ aptitude install libwww-perl
$ munin-node-configure --suggest
$ ln -s /usr/share/munin/plugins/apache_accesses /etc/munin/plugins/apache_accesses
$ ln -s /usr/share/munin/plugins/apache_processes /etc/munin/plugins/apache_processes
$ ln -s /usr/share/munin/plugins/apache_volume /etc/munin/plugins/apache_volume
$ ln -s /usr/share/munin/plugins/ip_ /etc/munin/plugins/ip_

# Setting up IPtables
$ iptables -F
Add this
$ vi /etc/iptables.up.rules
*filter
 
# Allows all loopback (lo0) traffic and drop all traffic to 127/8 that doesn't use lo0
-A INPUT -i lo -j ACCEPT
-A INPUT ! -i lo -d 127.0.0.0/8 -j REJECT
 
# Accepts all established inbound connections
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
 
# Allows all outbound traffic
# You can modify this to only allow certain traffic
-A OUTPUT -j ACCEPT
 
# Allows HTTP and HTTPS connections from anywhere (the normal ports for websites)
-A INPUT -p tcp --dport 80 -j ACCEPT
-A INPUT -p tcp --dport 443 -j ACCEPT
 
# Allows SSH connections
#
# THE -dport NUMBER IS THE SAME ONE YOU SET UP IN THE SSHD_CONFIG FILE
#
-A INPUT -p tcp -m state --state NEW --dport 8888 -j ACCEPT
 
# Allow ping
-A INPUT -p icmp -m icmp --icmp-type 8 -j ACCEPT
 
# log iptables denied calls
-A INPUT -m limit --limit 5/min -j LOG --log-prefix "iptables denied: " --log-level 7
 
# Reject all other inbound - default deny unless explicitly allowed policy
-A INPUT -j REJECT
-A FORWARD -j REJECT
 
COMMIT

$ iptables-restore < /etc/iptables.up.rules
$ vi /etc/network/if-pre-up.d/iptables
Add this to the file
#!/bin/sh
/sbin/iptables-restore < /etc/iptables.up.rules

$ chmod +x /etc/network/if-pre-up.d/iptables
$ /etc/init.d/ssh restart

# Install Fail2ban
$ aptitude install fail2ban
$ cd /etc/fail2ban/
$ cp jail.conf jail.local
$ vi jail.local
Add this
destemail = someaddress@vxtindia.com
mta = mail

$ service fail2ban restart

This constitutes your basic server setup. There are a ton of more things that you can do, but for setting up a development server, this should be more than enough.

If you are still curious, here are a few more things you should have a look at
1. LogRotate (Part 1, Part 2)
2. VirtualHosts (Part 1, Part 2)
3. WordPress Backup (1, 2, 3, 4, 5, 6)
4. Hosting Git (1, 2, 3, 4)

Do you have more things that you do, please let me know in the comments.

Popularity: 32%

The ultimate VPS purchasing guide

This post was created on August 26th, 2011 by Sudhanshu and has 3 comments. It has been filed under , ,

If you’re planning to start a web application, the first thing that you need is to setup your own server. Usually people start with shared hosting, which sucks if you’re trying to run anything more than a wordpress site. A dedicated server is expensive, and can range between $200 – $9000/month. The best thing to start out with is a VPS or a Virtual Private Server. It gives you completely flexibility since you are root and the price is between a shared hosting and a dedicated server.

If you decide that you do need a VPS server, there are a ton of things to look out for. Though as with all things, the internet is full of how to do it. As far as I see, there are 5 hosting companies that I get servers in. I’ll run you through each of them, and maybe it will help you decide which one is the right fit for you.

So here we go:

1. Slicehost
This used to be my first choice, though I’m not too sure after it was purchased by Rackspace. I have a feeling that they’ll be moving all their customers to Rackspace Cloud sooner or later. This is also slightly expensive, but in terms of the UI of their admin and the Knowledge base, these guys are the best.

2. Rackspace Cloud
This service is by Rackspace and started after they acquired Slicehost. It’s cheaper than Slicehost in the sense that the price that you see is only for the server and not for the bandwidth (Slicehost’s plans include both the server and the bandwidth). A simple calculation shows that if your bandwidth usage is less than 72GB/month, Rackspace Cloud would be the cheaper alternative. Our server runs on this too. Their admin UI is picked up from Slicehost and does almost all of the things that Slicehost does, but it’s a lot uglier and slower.

3. Linode
This is also a really cool provider. It’s cheaper than Slicehost and recently we have moved almost all our clients here. They have an Extensive knowledge based and the support is also top-class. If I compare the support, I’m not sure which is better Slicehost or Linode. Also, since Linode is cheaper as well, we have started recommending this.

4. Prgmr
This is a site which assumes you’re smart. Since you’re already here reading this post on our blog, I assume you’re pretty smart as well. If you are the no-frills kind of a person looking for super cheap and reliable VPS hosting, this is the place for you. Interestingly, there is no admin UI here, you directly connect via SSH and do whatever it is you want to do. It is also significantly cheaper than the other options here. I own a couple of servers here as well.

5. Amazon EC2
This is undoubtedly the most popular one out there, but what most people don’t realize is that it’s really a cheaper alternative if you’re used to buying $1000/month dedicated servers. When compared to the other VPS services, this is massively expensive.

Conclusion

While we are on this topic, you should read this post from uggedel.com. It provides a great comparison between the most popular services and based on it you can decide what do you want to purchase.

Finally, one last link worth sharing is LowEndBox.com. If you’re looking for a cheap server, this is just the place to find one. The reviews are really good and no matter how often you work with servers, you’ll always pick up a few things here.

In Conclusion, no matter what your budget, no matter what your requirements, you will always find something that is just right for you. All you have to do, is know what you want, and you shall get it.

Do let me know if you have any questions, or if you know any better services that we should try out.

Image via zunami

Popularity: 8%

Visualizing Git

This post was created on November 24th, 2010 by Sudhanshu and has 2 comments. It has been filed under , , ,

We have always been big fans for Github, but recently decided to move from github to hosting them ourselves. The only reason was that we have a lot of projects going on and because of that github started getting a little too expensive for us. So we decided to start hosting repositories ourselves.

When you migrate from github, the first thing that hits you is that the UI is no more there. You can see who is committing what or what new changes were added to each project. So, I decided to write a small Generatrix based application to fetch the git information and show it on the website. The result turned out to be quite okay. Our interfaces aren’t as advanced as github, but the more time we spend on it, the better it’ll get I guess (ofcourse, the people at github will add even more features and so on).

Here are a few screenshots, do let us know what do you think.

Popularity: 6%

Upgrades to Generatrix

This post was created on November 24th, 2010 by Sudhanshu and has 0 comments. It has been filed under , , , , , ,

Generatrix is our PHP5 stack for building web based applications. We have been working on it for quite some time and over 20 websites have been built on top of it already. Yet, there are always new things which need to be added to ensure that it’s up to date with the latest happenings in the web world.

Changes made to Generatrix

1. Facebook Connect has been integrated (link)
2. For applications which run via subdomains, controller has a function to get your subdomain value. (link)
3. Added components to allow controller to use ready made classes (link)
4. Added support for Google Fonts (link)
5. Pull CDN support – MaxCDN (link)
6. Included TypeConverter from http://github.com/milesj/php-type_converter (link)
7. Changed head to support mobile website (link)
8. Added urlencode and urldecode to javascript (link)
9. Works on windows as well (link)

If you haven’t already, do try it out. You can download the latest version here.

Popularity: 5%

Custom URLs for WordPress plugins

This post was created on May 25th, 2010 by Adhip and has 0 comments. It has been filed

WordPress is great at handling URLs and making them ‘pretty’ with custom permalinks. You can use almost any kind of URL structure for your website using the ‘Custom Permalinks’ tags. However, this fails in case you want to have permalinks that a plug-in should recognize and redirects you to the WordPress 404 page.

For example, if you have a page called calendar accessible via http://my-website.com/calendar which is essentially a page that is generated via a custom template or a shortcode, a URL like http://my-website.com/calendar/2010/march will lead to to a 404 page. The easiest solution to avoid this is to have a URL like http://my-website.com/calendar/?year=2010&month=march which given the rest of your website will look plain ugly.

We can however use the WP_Rewrite class and extend the set of rules that WordPress processes to ensure that our rule is processed like we want it.

We recently used this for one of our websites which you can view here Australian Shephard Dog Breed or Beagle Dog Breed

Popularity: 8%

Tracking online status

This post was created on April 29th, 2010 by Sudhanshu and has 0 comments. It has been filed under , ,

This is not about tracking your status on the plethora of social networking sites, rather about checking up if our internet connection is still active!

We have been using a data connection from Reliance for quite some time, but the connection keeps failing quite frequently during summers. We wrote a script on our local servers to keep connecting us to the ISP’s servers whenever they log us out, so we thought of using that information to create a Online Status Tracker for our office. Here is what it looks like:

Not only does this provide a status, it also gives us an update on what is the latest status if the connection is being initiated, or if their login page isn’t loading (which happens quite frequently).

Having an undying internet connection would be really cool, but till Reliance decides to get that in place, all we can do is enjoy our little tools.


Popularity: 8%