Site icon Embarcadero RAD Studio, Delphi, & C++Builder Blogs

How-To: Deploy The Production Version of RAD Server to Linux

radserver interbase linux

[See the full index of articles for more information]

In this post, we’ll walk you through setting up RAD Server on Linux and deploying your project into production. It was written by Eli M.

What is RAD Server?

RAD Server makes it fast and easy to build flexible back-end servers for your multi-tier Delphi or C++Builder application solution. Developers can choose from a number of built-in REST APIs or create their own custom APIs. RAD Server integrates with FireDAC giving you access to a wide variety of databases. The RAD Server Database is powered by InterBase for its backend and built-in API storage. If you have not already done so you will need to install InterBase on your RAD Studio machine to be able to run RAD Server locally.

There are six steps to deploy your RAD Server projects on Linux:

  1. Test Your Project With EMSDevServer
  2. Installing InterBase Which Powers RAD Server on Linux
  3. Run EMS Dev Server on Linux
  4. Deploy RAD Server
  5. Test RAD Server Installation
  6. RAD Server Installation Command Summary

Let’s look at each of these steps.

Test Your Project with EMSDevServer

Once you create a RAD Server project in RAD Studio, you will be able to compile the project and make your API available via the EMSDevServer. EMSDevServer is a standalone web server that comes with RAD Studio which can host your RAD Server APIs during development. EMSDevServer runs on both Windows and Linux. When you compile your RAD Server project for Win32 or Win64 it will automatically launch EMSDevServer with your endpoints available via localhost on port 8080 by default.

Installing InterBase Which Powers RAD Server on Linux

The RAD Server Database (powered by InterBase) will need to be installed and you can do this by installing InterBase on the Linux machine. Note: The RAD Server license does not allow you to use InterBase as a general-purpose database for storing application data, but only the specific data needed by RAD Server plus custom JSON-based data. Instructions for installing InterBase on Linux are available in the documentation under InterBase Quick Start: Part I – Installing InterBase for Linux and Installation, Registration, and Licensing Information. If you do not have unzip installed on your linux machine you can install it with this Linux command:

[crayon-673fd9919d616350663313/]

Once you have the InterBase ZIP file on your Linux machine, you can unpackage it with this Linux command:

[crayon-673fd9919d61e893819483/]

Change to the new InterBase directory and run this Linux command:

[crayon-673fd9919d620821216840/]

This will install InterBase for a 64bit environment from the command line. You can keep all of the default options during installation.

For a RAD Server production environment, you do not add a normal InterBase license. Instead you will need to install your RAD Server license into InterBase to be able to run RAD Server in production through Apache. You can add your RAD Server license to InterBase via the License Manager on the command line by running this Linux command:

[crayon-673fd9919d621544822004/]
You can set up InterBase to run at startup on the command line by running the following to create a script and then adding it to crontab:
[crayon-673fd9919d623727898032/]
After you run the above commands at the Linux command line, you can run this Linux command:
[crayon-673fd9919d624678494608/]

And then add the following line at the end of the file with your favorite editor (like nano).

[crayon-673fd9919d626730294429/]

Save and exit crontab.

Running EMS Dev Server on Linux

You can now run the RAD Server installation on Linux. If you do not have libcurl3 installed you will need to install it at the Linux command line by running:

[crayon-673fd9919d627711359300/]

RAD Server contains an EMSServer directory with the two files ems_install.sh and LinuxEMSServer.tar. Copy these files to your Linux machine and execute the following command at the Linux command line to initiate and install RAD Server:

[crayon-673fd9919d628360942969/]

Once installed you will need to run the EMSDevServer to set up your emsserver.ib file and your emsserver.ini file via a wizard. You can do this by executing the following command at the Linux command line:

[crayon-673fd9919d62a872481675/]
It will prompt you to run the wizard and you can say Yes to do that.

In the wizard setup you can keep all of the default options during installation. After the wizard setup is complete it will auto start EMS Server on port 8080. You can test it with this Linux command line:

[crayon-673fd9919d62b332167585/]

After testing you can exit the EMSDevServer. You can find more complete instructions for finding and executing the EMS Server for Linux installation in the documentation under Configuring Your EMS Server or EMS Console Server on Linux.

At this point you should have InterBase running, you should have EMS Server installed, and you should be able to successfully visit the REST API endpoints of EMSDevServer via a web browser. You will only need EMSDevServer running during development if you will be using Apache in production.

Deploy RAD Server

The next step is to deploy your RAD Server and custom resource modules to Apache on Linux for production. You do not need EMSDevServer running during production if you have deployed EMS Server and your custom modules to Apache. Full detailed instructions for installing RAD Server into Apache are available in the documentation under Installing the RAD Server or the RAD Server Console on a Production Environment on Linux.

#1 Create a new file called ems.load in Apache’s mods-available directory. You can use a text editor such as nano from the Linux command line to create and edit the new file. Execute the nano /etc/apache2/mods-available/ems.load Linux command to edit the file. Add the following lines into the ems.load file:

[crayon-673fd9919d62c637612729/]

#2 Create a second file called ems.conf in Apache’s mods-available directory. Execute the nano /etc/apache2/mods-available/ems.conf Linux command to edit the file. Add the following lines to the ems.conf file:

[crayon-673fd9919d62e588227390/]
#3 Enable RAD Server by running a2enmod ems at the Linux command line. You can disable RAD Server again by running a2dismod ems.

You can now copy your RAD Server custom resource modules (like bplProject1.so) to the /usr/lib/ems directory on Linux. You will need to edit your emsserver.ini file in the Server. Packages section and add your custom resource modules.

[crayon-673fd9919d62f938831034/]

Test the RAD Server Installation

Restart Apache by running service apache2 restart at the Linux command line. You should be able to test your new RAD Server installation on Apache by running wget localhost/ems-server/version at the Linux command line or by visiting that URL in your web browser.

RAD Server Installation Command Summary

Note: The below command summary is an approximate list of commands from this article. Your specific commands and directories may vary from what is listed below depending on the version of Linux you may be running and where you upload files. You will also still need to manually upload the ems_install.sh and LinuxEMSServer.tar files from your RAD Studio folder to the Linux machine.

[crayon-673fd9919d630556077228/]

Summary

With that your RAD Server is setup and your module is deployed. The following links have more information to help you along the path with your RAD Server journey.

Interested to deploy your Linux server? Rapidly build and deploy services-based applications with the Rad Server’s IDE Software.
Exit mobile version