Linux, Lazarus, and Lots of scripting
A friend of mine runs a business selling a Windows application for a niche market. Of course he has a web site with lots of information and a way to download a trial of his software and then pay and register it. Since he's a technical person, likes writing code, likes to keep overhead low, and his needs are fairly simple, he wrote the registration program himself. He's most fluent in Delphi so it was natural to write the registration program in Delphi‐‐an old, but very functional version of Delphi, Delphi 2007.
So naturally he needed a Windows server and after a little research, decided it wouldn't be that hard to host it himself out of his house. With a static IP address and stable power source, he's had this setup for quite some time with very little trouble.
Well, since he already has a static address and server running, why not host his own web site as well? That's running under Linux. No problem, just add a second server and redirect the ports. (I actually don't know which came first, the web server or the registration server.)
With the business running well and support calls low, he and his wife want to do some traveling. An extended weekend isn't any problem. A week away with someone looking after the place is doable. But what if a server goes down? Will anyone else be able to get it back up? What is the cost of potentially losing a customer because they can't find the web site or register the software?
These questions have been eating at him for a while and he finally decided to move them to a remotely hosted server. But since neither his web site nor his registration program are that heavily used, it would be a waste of resources and money to rent two servers‐‐he should combine them into one. The web site needs to stay on Linux. The registration program, even though it's in Delphi, could be re-written to work under Linux using Free Pascal. And using Lazarus as the IDE, the environment would be familiar. Finally, the Firebird database has no problem moving across platforms.
After looking at several options for remotely hosted virtual servers, it was clear the new Linux server would be running CentOS. Moving the web site over was not going to be difficult, but setting up the database and development environment would take some research. Not being very familiar with commands on Linux, he asked if I could help. Together, we got a virtual machine running CentOS and started the process of figuring out everything needed to get things going.
The first thing installed was the Firebird database engine and TurboBird, a Linux-based database tool that allows manipulation and querying of Firebird databases. We soon ran into problems and so downloaded Lazarus and the source for TurboBird to compile it thinking it may be something specific to our install. This is where the fun began!
I don't remember all the problems we had, but there were missing links to libraries, indications of insufficient permissions, and other error messages, leaving us scratching our heads and wondering if we had bitten off more than we could chew. I told him I'd go into hiding for a couple of days and figure out what was wrong.
What I found is that we were using a 64-bit version of Linux and trying to get a 32-bit version of Firebird and TurboBird working. I've should've known to check this near the beginning of the process as I've run into this type of problem in the past trying to get Windows applications to talk to Oracle databases using the wrong driver, but this is a different OS with different software producing different errors‐‐it totally escaped me.
There were other little odd things here and there that needed tidying up. For example, the version of Firebird he is using with his application is a couple of versions behind the current one and it requires an older version of a standard C++ library that is not included by default on the latest CentOS. The service manager, xinetd, needed to be installed and started. And a link to the specific Firebird library needed to be made. These would not be issues on Windows platforms, so it was easy to get tripped up multiple times.
But the thing I love about Linux is that you can run a command line to accomplish just about anything. When I emerged from hiding after a couple of days, I had a bash script that uninstalled the wrong versions of the software, downloaded and installed the right versions, installed git, and downloaded the project I had started. All he had to do was type in a couple of passwords, load the project into the Lazarus IDE, and compile it.
When it was all done, it was very satisfying to run the script and watch the magic happen!