Have an amazing solution built in RAD Studio? Let us know. Looking for discounts? Visit our Special Offers page!
News

The New RAD Server Lite (RSLite) in RAD Studio 11

rad-server-blog-banner-6

As part of the RAD Studio 11 Alexandria release we have announced the availability of a new option to deploy and license RAD Server, with the goal of simplifying the deployment for installations not requiring a large amount of REST requests.

What is RAD Server?

Before I get to the specifics, let me remind you what RAD Server is. It is a REST server engine that allows you to quickly develop REST endpoints, primarily serving JSON, by using Delphi or C++Builder code based on FireDAC (or other data access layers). In short, you create add-on packages (BPLs) each registering additional URL endpoints and providing an implementation. On top of it, RAD Server comes with a number of ready-to-use services. You can read more at https://www.embarcadero.com/products/rad-server.

Why RAD Server Lite?

RAD Server requires a backend database, based on InterBase, and it is generally deployed as a web server DLL module for either IIS or Apache. For this reason, a standard deployment requires:

  • The web server and its configuration of the RAD Server module
  • The RAD Server deployment and configuration
  • An installation of InterBase with a special purpose RAD Server license (a license the user needs to register on the target device to activate)

For development, we have long offered a stand alone version of RAD Server, based on the Indy HTTP server, which offers limited performance but much easier deployment and the ability to be executed under the debugger (so you can debug your RAD Server modules code). The development version is not meant and it’s not licensed for deployment. It has a limit in the number of users you can create, and it can work with a local InterBase Developer edition (the license for it is part of the RAD Studio license).

RAD Server Lite (aka RSLite) offers a simpler deployment model for test servers and scenarios not requiring a lot of throughput, and it offers this by using the InterBase embedded database engine, IBToGo, instead of the full-blown server and combines it with a simplified licensing model. RSLite uses the same binary of the development edition (that ships with RAD Studio) along with IBToGo binaries and a license slip file you can deploy with your solution (requiring no registration on the computer you deploy it to).

Because it uses an embedded database and because it uses the Indy HTTP Server component, it cannot serve the same number of requests per second of a regular full-blown RAD Server installation and it cannot scale with multiple RAD Server front ends. We haven’t added any hard-coded limitation, but the underlying architecture used by RSLite has a much more limited scalability, but we expect it to be sufficient for many simple deployment scenarios — keeping in mind that the throughput also depends on the specific code your RAD Server modules execute. Notice that for deployment on a public system, we recommend to avoid exposing the RSLite HTTP server directly, but make it accessible via a proxy configuration, so you still have a web server (like Apache or IIS) providing the security context for the incoming HTTPS calls and forwarding those to RSLite.

Asking for a License

Now let’s get to the practical aspects of RSLite. First thing, you need to redeem a license, something you can do with any Enterprise or Architect license for RAD Studio  11 (including Delphi 11 and C++Builder 11). All you need to do is to visit the page:

https://reg.embarcadero.com/srs6/promotion.jsp?promoId=572

and follow the instructions provided: you’ll need your registration key and EDN account. The process here is not just to receive a license key for RSLite, but a slip file (a license stored in a .TXT file) that you can deploy alongside your installation. This license has no limitations in terms of the number of installations (but you cannot have two instances running on the same machine). Notice that the license file needs to place in a specific subfolder, unlike what the general information on the redemption site might seem to imply.

Deploying a RAD Server Lite project

Once you have the license, how do you deploy RSLite? There are two different considerations:

  • First, you need to create a deployment configuration with RSLite, the required runtime packages, and IBToGo deployment (steps are below)
  • Second you need to generate a proper database file for production, compatible with the IBToGo license — a local database created by RAD Server Developer edition won’t be compatible

The Files to Deploy

In practical terms, these are the files needed to deploy a RSLite solution (in additional to your application packages and their dependencies):

  1. The RSLite executable, which is the same of the developer edition: EMSDevServer.exe available in the RAD Studio bin folder (or the similar 64-bit version)
  2. The required RAD Studio runtime packages, which include those required for a minimal installation (listed here and available in the RAD Studio win32 or win64 redist folder) plus any other runtime package required by the code in your RAD Server modules:
    • bindengine280.bpl            
    • dbrtl280.bpl                 
    • emsclientfiredac280.bpl      
    • emsserverapi280.bpl
    • FireDAC280.bpl
    • FireDACCommon280.bpl
    • FireDACCommonDriver280.bpl   
    • FireDACIBDriver280.bpl
    • rtl280.bpl                   
    • vcl280.bpl                   
    • vcldb280.bpl                 
    • vclFireDAC280.bpl
    • vclimg280.bpl                
    • vclwinx280.bpl               
    • vclx280.bpl                  
    • Xmlrtl280.bpl
  3. The InterBase ToGo deployment files found under the public document InterBase redist folder (for example, C:/Users/Public/Documents/Embarcadero/Interbase/redist/InterBase2020) in the subfolders win32_togo or win64_togo — for Linux you can find the libibtogo.so file in the proper InterBase redist folder
  4. Add the license file obtained above to the interbase/license folder (part of the IBToGo redist configuration)

MSVC runtime

Notice also that in order to run IBToGo (and so RSLite using IBToGo) on a target Windows machine it needs to have the Visual C++ 2013 runtime library installed. On a developer machine with RAD Studio, you’d most likley have it already installed. On a general target deployment machine, however, you might have to install it, after downloading it from Microsoft.

Creating the Production Database

With this configuration, you can start RSLite by executing the EMSDevServer.exe application. If the target machine has an InterBase client, however, it will pick it up as higher priority, and if the InterBase client is the Developer edition that comes with RAD Studio, everything will work but in a standard RAD Server Developer configuration.

You can figure it out easily because when RAD Server starts it tells you if this is an “RSLite” configuration in its log. The first few lines will look like:

{“Thread”:19124,”ConfigLoaded”:{“Filename”:”[folder]emsserver.ini”,”Exists”:true}}
{“Thread”:19124,”Licensing”:{“Lite”:true,”Licensed”:true,”LicensedMaxUsers”:2}}
{“Thread”:19124,”DBConnection”:{“InstanceName”:””,”Filename”:”[folder]emsserver.ib”}}

If the code is indicating that “Lite” is set to false, you might need to manually disable loading of gds32.dll (or its 64 bit version) InterBase client library, generally found in C:/Windows/SysWOW64 (if the InterBase client library cannot be found it loads the local ibtogo.dll — something we’ll make configurable in a coming release).

Now if you start RSLite (with the proper configuration) and there is no emsserver.ini file and no emsserver.ib database file, it will prompt you to create one. For this to work, RSLite needs to find the configuration in RAD Studio’s Object Repository folder (ObjRepos under the product folder). The easier way to do this is to copy the files under ObjRepos/en/ems in a folder with this relative path from emsdevserver.exe: “../ObjRepos/en”. In other words, you need an ObjRepost folder at the same level of the folder containing your RSLite installation 

Note: This is not needed for each RSLite deployment, only once to generate a production database you can later copy on the target computers as is. In fact the database created in a development environment is not compatible with RSLite deployment.

I recommend you specify as target folder the same of your RSLite deployment, so that the wizard will create an emsserver.ini file and an emsserver.ib database file in your deployment folder. Now grab the entire folder with RSLite, these configuration files, the runtime packages and IBToGo, including the license, and you have all you need to deploy on a target Windows computer.

Proxy Configuration

As I mentioned, it is not recommended to expose RSLite directly as a public web application, due to its limitations in terms or protection and encryption. I’d recommend using a proxy layer, with a dedicated service or using one of the popular web services as a front end. In Apache, for example, in you configure a virtual host, enable HTTPS, and redirect the traffics to the RSLite instance with a configuration like the following:

For Linux

For Linux you can follow similar steps as above and everything should work as expected. As an alternative you can also consider installing the full RAD Server and than adding IBToGo to the installation: 

    • Install the RAD Server using the ems_install.sh available in the RAD installation folder (https://docwiki.embarcadero.com/RADStudio/Sydney/en/Configuring_Your_RAD_Server_Engine_or_RAD_Server_Console_on_Linux)
    • Copy the IBToGo files from the Interbase “redist” folder to the EMS folder on Linux (/usr/lib/ems)
    • Execute the EMSDevServerCommand and follow the wizard to create the EMS database and configuration file (notice you might need to run the application via sudo to have the proper permissions)

Upgrading to the Full RAD Server

As a final note, let me remind you that RSLite has a limited scope in terms of user requests traffic it can handle. If you need a higher bandwidth and throughput we recommend deploying the full RAD Server instead. 

Any customer with an Enterprise Edition of RAD Studio, Delphi or C++Builder receives one deployment license of the full, production version, of RAD Server. Architect Edition customers receive an unlimited deployment license (but one that still requires activation for each server you want to deploy to). Alternatively, you can contact our sales team for a RAD Server VAR agreement, which would allow you to distribute the full RAD Server simply deploying a slip file along with your application, to unlimited customers and with no registration required.


What's New for RAD Studio 11

Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder.
Design. Code. Compile. Deploy.
Start Free Trial   Upgrade Today

   Free Delphi Community Edition   Free C++Builder Community Edition

About author

Marco is one of the RAD Studio Product Managers, focused on Delphi. He's the best selling author of over 20 books on Delphi.

10 Comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

IN THE ARTICLES