Earlier this week, I blogged about Getting Started with Delphi and Linux Docker Support, which covered the Docker scripts and ready-to-use Docker images on DockerHub that you can use to deploy Delphi Linux applications manually or via PAServer and the IDE.
The main reason Embarcadero invested in Docker support is to aid in the deployment of RAD Server solutions.
Table of Contents
What is RAD Server?
Embarcadero has spent the last few years developing RAD Server, a new solution for modern, multi-tier web service development. This technology enables developers to create new application backends quickly 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 installed on Windows using IIS and on Linux using Apache. The database used by RAD Server to store user data, usage information, and other information is a custom instance of Embarcadero’s InterBase. As a developer, you create resource modules (which contain a variety of custom endpoints) as runtime packages (BPL) that can be added to RAD Server.
For more information, visit http://docwiki.embarcadero.com/RADStudio/Rio/en/RAD_Server_Overview, and keep in mind that any RAD Studio Enterprise license includes a single server deployment license, whereas the Architect editions include an unlimited server license.
In general, you can build a RAD Server solution using a local, standalone version installed with the developer’s 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 a 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 to 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 functionality of the PAServer image with the addition of RAD Server on Apache.
This Docker container allows developers to test, debug, and deploy Linux applications and custom RAD Server endpoints as well as deploy 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 the case of IB running on port 3050 on 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 licensing. For this second issue, we can suggest some options.
There are two ways to license the RAD Server stand-alone pa-radserver-ib Docker container image. The first approach is to create the Dockerfile and instruct it to use an existing distribution license slip file. The second method is to launch an interactive pa-radserver-ib Docker container image instance, enter your RAD Server license number, and register it with Embarcadero. Both methods should be used with a persistent volume to save any changes to RAD Server, including the license, 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 as a specific white paper on Embarcadero is finalized.