Earlier this week I blogged about Getting Started with Delphi and Linux Docker Support covering the Docker scripts and ready-to-use Docker images on DockerHub you can use to deploy Delphi Linux applications manually or via PAServer and the IDE.

Now the main reason Embarcadero invested on Docker support is to help deploying RAD Server solutions.

What is RAD Server?

Over the last few years, Embarcadero has focused on building a new solution for modern, multi-tier, web service development, called RAD Server. This technology enables developers to quickly build new application back-ends or migrate existing Delphi or C++ client/server business logic to a modern services based architecture that is open, stateless, secure and scalable. RAD Server can be deployed to Windows on IIS and Linux on Apache. RAD Server is powered by a database for storing users data, usage information, and more and this database is a custom instance of Embarcadero’s InterBase. As a developer, you build resource modules (containing a various number of custom endpoints) as runtime packages (BPL) that can be added to RAD Server.

For more information see http://docwiki.embarcadero.com/RADStudio/Rio/en/RAD_Server_Overview and keep in mind that a single server deployment license is included with any RAD Studio Enterprise license, while the Architect editions include an unlimited server license.

Classic Deployment

In general, you can build a RAD Server solutions using a local, standalone version installed with the developers tools (a version we don’t recommend using in deployment, as its performance is limited). We distribute via GetIt package manager installers to deploy the needed files on both Windows and Linux. So if you have a server you want to deploy RAD Server to, you need to run those installers on your machine and deploy the license file as needed.

Deploying to Containers

As an alternative, you can deploy RAD Server to a Linux Docker container using the scripts we are providing (or customizing them). There are two approaches we provide:

  • The first, pa-radserver Docker image, includes RAD Server and Apache, plus PAServer
  • The second includes the elements above plus the RAD Server database (InterBase)

We recommend keeping the database on separate server, VM, or container, as it has a license attached to it and when recreating the container you’d have to reapply the license. In this case, you install only RAD Server in the container and provide the IP address and port of the machines hosting the database server.

The pa-radserver Docker image

The pa-radserver Docker image uses Ubuntu:Bionic as a base image and adds the PAServer and RAD Server on Apache installation plus their configurations. The PAServer archive and the RAD Server Installer are downloaded from the Embarcadero server. This image contains all of the functionalities of the PAServer image with the addition of RAD Server on Apache. 

This Docker container allows for developers to test, debug, and deploy Linux applications and custom RAD Server endpoints as well as deploying RAD Server in a production environment. Configuration options for this image include items such as the PAServer password and the RAD Server database (InterBase) location and port. 

This is an example of how you can download and start this image (in case of IB running on port 3050 in the current machine, other parameters are similar to the example in the previous blog post)

docker pull radstudio/pa-radserver
docker run -d --mount source=ems,target=/etc/ems -e DB_PORT=3050 -e DB_HOST=127.0.0.1 -e PA_SERVER_PASSWORD=securepass -p 80:80 -p 64211:64211 -p 8082:8082 radstudio/pa-radserver

​Now ​this installs the server without the ems.ini configuration file or any custom package. You can deploy those manually, or use a RAD Studio project to deploy the files via PAServer (a nice idea but beyond the scope of this blog post).

For this script to work, you need to have InterBase active (and with a RAD Server license deployed) on the machine hosting the docker engine.

The pa-radserver-ib Docker Image

The alternative approach is to use the pa-radserver-ib Docker image. This uses Ubuntu:Bionic as a base image and adds PAServer, RAD Server on Apache, and RAD Server database (InterBase) installation and their configurations. The PAServer archive and the RAD Server Installer are downloaded from the Embarcadero server. The pa-radserver-ib Dockerfile can be configured to accept a RAD Server license SLIP file at build time which will create a fully licensed Docker container.

Otherwise the pa-radserver-ib container should be run in foreground mode the first time so that you can add a RAD Server license. This image contains all of the functionalities of the pa-radserver image with the addition of the RAD Server database (InterBase). This provides you with a single self contained instance of RAD Server. This image can be configured to run as a production environment by disabling PAServer and broadwayd. Options can be specified at build time or at run time. 

This is an example of the commands needed to get this going (safe for the license, see below):

docker pull radstudio/pa-radserver-ib
docker run -it -e PA_SERVER_PASSWORD=securepass -p 80:80 -p 64211:64211 -p 8082:8082 -p 3050:3050 --mount source=interbase,target=/opt/interbase --mount source=ems,target=/etc/ems  radstudio/pa-radserver-ib

How To License The RAD Server Docker Container

There are two reasons this self-contained approach is not ideal. The first is you have to generate the database each time you want to run the system, the second is this is a bit at odds with the licensing. For this second issue, we can suggest some options.

There are two different ways to license the stand alone pa-radserver-ib Docker container image of RAD Server. The first method is to build the Dockerfile and have it take an existing distribution license slip file. The second method is to run an existing pa-radserver-ib Docker container image instance in interactive mode, enter your RAD Server license number, and register it with Embarcadero. Both methods should be run with a persistent volume so that any changes to RAD Server including the license are saved between run instances.

The Docker Scripts on GitHub

The scripts for the two images discussed in this blog post are available at:

The two images are on Docker Hub along with the PAServer one at https://hub.docker.com/u/radstudio

More Information on RAD Server deployment with Docker

More information will be made available soon in a specific white paper Embarcadero is finalizing.