Rackspace offers Cloud Servers, which are virtual servers of various sizes. The smallest server of all costs 1p an hour, which is less than £7.50 per month.
As an experiment, we took an existing Linux-based Cardbox Server and tried moving it onto a Rackspace Cloud Server.
1. Server setup
It is necessary to sign up with Rackspace. The exact procedure depends on whether you are already a customer of theirs, and it may change from time to time, so I shan’t reproduce it here.
Once we had signed up, we opened the Rackspace Cloud control panel, went to the Cloud Servers page, and pressed the “Add Server” button.
A list of operating systems appeared. We chose CentOS 6.0, which is a close relation of Red Hat Enterprise Linux.
On the next page, we specified a server with 10GB of disk and 256MB of RAM, and gave it the name “tiny-server”.
A message then popped up giving us the Root/Administrator password for this server, which was tiny-serverHMrtG7w6. (We have changed the password since then).
The Server Details window then appeared, showing that Rackspace were building the server. It took 4 minutes to build the server, after which its status was shown as “Active”. From this moment, it was costing us 1p an hour.
The IP address of the new server, 22.214.171.124, was shown in the Server Details page. We added this to our DNS records under the name ‘tiny.cardbox.net’.
We then connected to the server via SSH:
and used the ‘passwd’ command to change the password.
2. System setup
The ‘cardbox-shared’ program requires some additional components – ‘shared libraries’ – which are not included in Rackspace’s setup.
We ran the following command:
yum install glibc.i686
By default, the cloud server does not accept connections on TCP port 3105, which the Cardbox clients use to connect to the Cardbox Server. To allow connections on this port, we ran the following two commands:
iptables -I INPUT -m tcp -p tcp --dport 3105 -j ACCEPT
service iptables save
Setting up a user
The Cardbox Server should not run as ‘root’, so we set up a new user called ‘server':
We then switched to this user:
We also created a couple of directories, because we knew we would need them later, to store the Cardbox database files:
3. Copying files from the existing server
We logged in to our existing Linux server, moved to its ‘server’ directory and copied the Cardbox Server program across, together with its licence and configuration files:
scp -p cardbox-shared licence.ini server.ini email@example.com:.
Copying the database files
In our particular case, the database files we wanted to copy were in a directory called ‘databases/samples’. This is why we created a ‘databases/samples’ directory earlier.
Still on our existing server, we copied the database files across:
scp -p databases/samples/* firstname.lastname@example.org:databases/samples
We then disconnected from our existing server.
4. Editing the configuration files
We now returned to the new server, where we were logged in as the user ‘server’.
The ‘licence.ini’ file contains the licence for the Cardbox Server. Because this was only a temporary experiment, we left the file unchanged. Note, however, that your Cardbox Server licence only entitles you to run one copy of the Cardbox Server, so if you are planning to run two separate servers, you need two separate licences.
The ‘server.ini’ file contains all the other Cardbox Server settings. We edited ours to remove the section on automatic backup (we didn’t want to back up files to the same Amazon S3 bucket from two different places) and to remove references to the database files we hadn’t copied across.
We entered the command:
and the Cardbox Server started. It displayed some startup messages, including the crucial one:
Server is now listening (socket 4) for generic connections on address 0.0.0.0:3105
The Cardbox Server was now running.
Going to Cardbox on a Windows PC, we did File > Open > Server, typed ‘tiny.cardbox.net’ into the Server box, pressed the View button, and were shown the list of available databases:
We tried opening a database and doing a few searches. Everything looked OK, so we closed the databases we had opened, and closed Cardbox itself.
Back in our ‘server’ session, we pressed Ctrl+C to halt the server. The test was over.
It was now time to make the server permanently available. We entered the command
and the Cardbox Server started. No messages appeared, because they were now all being written to the ‘cardbox.log’ file. We verified that the startup messages were OK with the command
7. The end
There was nothing more to be done, so we closed our ‘ssh’ connection to the new server. Anyone on the Internet could now connect to the new Cardbox Server at ‘tiny.cardbox.net’ and view and search the databases on it.
Although this is the smallest server size that Rackspace support, there are still 8GB of disk space available.
The only ports open to the outside world are port 22 for SSH connections and port 3105 for Cardbox itself. There is no web server and no email on this machine.
Rackspace can back up the cloud server’s entire hard disk to their own Cloud Files service. This can be done by pressing a button in their Cloud Servers control panel, or you can select an option for regular automatic backup.
The backup of the initial setup, as described here, took up 466GB of Cloud Files space. Keeping it in Cloud Files will cost just over 5p a month.
In addition, it is possible to configure the Cardbox Server to back up its own database files regularly and automatically to your Amazon S3 account.
We do both.
In the configuration we’ve described, the Cardbox Server does not start automatically when the server itself starts. So if the server has to be rebooted for any reason, we would need to start the Cardbox Server by hand, as described in step 6. A future blog post will describe how to make the Cardbox Server start automatically.