Code Monkey home page Code Monkey logo

paserver-docker's Introduction

RAD Studio PAServer Docker

Embarcadero RAD Studio

Welcome to the guide for deploying RAD Studio applications on Linux using Docker and PAServer. This repository offers a Docker script designed to simplify the setup and management of your development environment, allowing RAD Studio developers to deploy and test their applications in a Linux environment.

The image defaults to running PAServer on port 64211 with the password securepass

The 10.x images use Ubuntu 18.04.6 LTS (Bionic Beaver) while the +11.x images use Ubuntu 22.04.1 LTS (Jammy Jellyfish)

๐Ÿš€ How to Use [run.sh] Script

The [run.sh] script is your go-to automation tool for setting up and deploying the PAServer application with ease and flexibility. Below are the instructions to utilize this script effectively.

๐Ÿ“‹ Prerequisites

Ensure Docker is installed on your system as this script uses Docker for running the PAServer application.

๐ŸŒŸ Features

  • Customizable Name: Assign a unique name to your PAServer container.
  • Bind Path: Designate a custom path for volume mapping.
  • Detach Mode: Opt for running your container in the background.
  • Port Configuration: Select the port where PAServer runs.
  • Production Mode: Activate production mode for your deployment.
  • Version Control: Choose the specific PAServer version for deployment.
  • Password Protection: Secure your PAServer with a custom password.

๐Ÿ› ๏ธ Usage

Navigate to the directory containing [run.sh] in your terminal. Execute the script with your preferred options:

./run.sh [OPTIONS]

๐Ÿ“Œ Options

  • --name or -n: Container's name (e.g., --name=myPAServer).
  • --path or -pa: Bind path for volume mapping (e.g., --path=/my/custom/path).
  • --detach or -d: Run container in detach mode (background).
  • --port or -p: Port for PAServer (e.g., --port=64211).
  • --production or -pr: Enable production mode (true).
  • --version or -v: PAServer version (e.g., --version=latest).
  • --password or -pw: Set a password for PAServer (e.g., --password=securepass).
  • --help or -h: Shows the help of the script.

๐ŸŒˆ Examples

Run PAServer in production mode on port 65000 with a custom name and password:

./run.sh --name=myPAServer --port=65000 --production --password=mysupersecurepassword

Run PAServer in detach mode with a specific version, bind path, and password:

./run.sh --detach --version=12.1 --path=/my/custom/path --password=mysupersecurepassword

๐Ÿ“ Note

Make sure you have the necessary permissions to execute run.sh. Use chmod +x run.sh to make it executable if needed.

๐Ÿณ Using docker run Directly

For users who prefer a more hands-on approach or wish to customize their deployment further, you can directly use the docker run command to start your PAServer container. This method provides flexibility and allows you to manually specify each option.

๐Ÿ› ๏ธ Command Structure

The basic structure of the command to run the PAServer Docker container is as follows:

docker run [OPTIONS] radstudio/paserver:[VERSION]

๐Ÿ“Œ Options

  • -e PA_SERVER_PASSWORD=[PASSWORD]: Sets the password for the PAServer. Replace [PASSWORD] with your desired password.
  • --name [NAME]: Assigns a custom name to your Docker container. Replace [NAME] with your preferred container name.
  • -p [PORT]:64211: Maps a custom port on your host to the PAServer's default port (64211). Replace [PORT] with the port number you wish to use.
  • [DETACH_ARG]: Use -d to run the container in detached mode (in the background).
  • [BIND_PATH_ARG]: Use -v [HOST_PATH]:[CONTAINER_PATH] to bind a volume for persistent data or configurations. Replace [HOST_PATH] and [CONTAINER_PATH] with your specific paths.

๐ŸŒˆ Examples

To run the PAServer in a Docker container named myPAServer, listening on port 65000, with a password of mysupersecurepassword, and running in detached mode, you would use the following command:

docker run -d \
           -e PA_SERVER_PASSWORD=mysupersecurepassword \
           --name myPAServer \
           -p 65000:64211 radstudio/paserver:latest

If you wish to bind a volume for persistent data, you can add the -v option:

docker run -d \
           -e PA_SERVER_PASSWORD=securepass \
           -v /path/on/host:/root/PAServer/scratch-dir \
           --name myPAServer \
           -p 65000:64211 radstudio/paserver:latest

Using Docker Compose

Docker Compose allows you to define and run multi-container Docker applications. Here is an example docker-compose.yml file that demonstrates how to use a Docker image as part of a service, utilizing environment variables for configuration.

version: '3.8'
services:
  myPAServer:
    image: radstudio/paserver:latest
    container_name: myPAServer
    environment:
      - PA_SERVER_PASSWORD=${PA_SERVER_PASSWORD} # Environment variable for the server password
    ports:
      - '${HOST_PORT}:64211' # Environment variable for the host port
    volumes:
      - ${HOST_PATH}:/root/PAServer/scratch-dir # Environment variable for the host path
    restart: unless-stopped

This configuration defines a single service called myPAServer. It uses the Docker image radstudio/paserver:latest. The service configuration includes mapping a port from the host to the container, setting an environment variable for the server password, and mounting a volume from the host to the container. These settings are customizable through environment variables defined in a .env file located in the same directory as your docker-compose.yml.

# .env file
PA_SERVER_PASSWORD=securepass
HOST_PORT=65000
HOST_PATH=/path/on/host

To start your application, execute the following command in the directory containing your docker-compose.yml:

docker-compose up

This command initiates the Docker Compose process, which reads the docker-compose.yml file and the .env file, applying the configurations to start your service as defined.

This will pull the necessary image (if it's not already locally available), create the defined volumes, set the environment variables, and start your application on the specified ports.

๐Ÿ“ Note

Ensure you replace /path/on/host with the actual path you wish to use for volume binding. The latest tag can be replaced with any specific version of the PAServer you wish to deploy.

๐Ÿ› ๏ธ Customizing Your Docker Image

This guide will help you customize the PAServer image to suit your specific needs, such as adding additional files or folders, installing extra packages, and making other modifications.

๐Ÿ“ Adding Files or Folders

To add files or folders to your Docker image, use the COPY or ADD instruction in your Dockerfile. COPY is preferred for copying local files, while ADD can handle remote URLs and tar extraction.

Example: Adding a Configuration File

COPY ./myconfig.conf /etc/myapp/myconfig.conf

This command copies myconfig.conf from your project directory to /etc/myapp/myconfig.conf inside the Docker image.

๐Ÿ“ฆ Installing Extra Packages

To install additional packages, you can modify the RUN command that installs packages. It's best to combine package installation commands into a single RUN instruction to reduce the number of layers in your Docker image.

Example: Installing Git and Cmake

RUN apt-get update && apt-get install -y \
    git \
    cmake \
    && rm -rf /var/lib/apt/lists/*

Based on each project, specific libraries may be necessary. This command updates the package lists, installs Git and Cmake, and cleans up afterward to keep the image size down.

To avoid extra layering in the final Docker image, it's good practice to modify the existing RUN apt-get update command to include your required libraries.

๐Ÿ› ๏ธ Customizing Installation Commands

You can customize the Dockerfile to change environment variables, download different versions of software, or modify the installation process.

Example: Setting a Custom Environment Variable

ENV MY_CUSTOM_VAR=myvalue

This sets an environment variable MY_CUSTOM_VAR that can be used by your application.

๐Ÿ—๏ธ Building Your Custom Image

After customizing your Dockerfile, you can build your Docker image using the docker build command.

docker build -t my-custom-paserver:latest .

This command builds a Docker image named my-custom-paserver with the latest tag, using the Dockerfile in the current directory.

๐Ÿ”‘ Using Build Arguments

For values that might change between builds (like passwords or version numbers), you can use ARG instructions in your Dockerfile and pass values with the --build-arg option during the build.

Example: Specifying a Custom Password

ARG password=securepass

Build with a custom password:

docker build --build-arg password=mypassword -t my-custom-paserver:latest .

๐Ÿ’ก Tips

  • This repository provides a [build.sh] script that can be used as a template for simplifying custom builds.
  • Currently, this image is only compatible with linux/amd64. To avoid potential problems in arm setups, build the image with the arg --platform linux/amd64

๐Ÿ›ก๏ธ Best Practices

  • Minimize Layers: Combine related commands into single RUN instructions where possible.
  • Clean Up: Remove unnecessary files and packages to keep the image size down.
  • Use .dockerignore: Add a .dockerignore file to your project to avoid copying unnecessary files into your Docker image.
  • Secure Secrets: Avoid hardcoding sensitive information in your Dockerfile. Use build arguments for build-time secrets and environment variables or Docker secrets for runtime secrets.

License and Copyright

This software is Copyright ยฉ 2024 by Embarcadero Technologies, Inc.

You may only use this software if you are an authorized licensee of an Embarcadero developer tools product. See the latest software license agreement for any updates.

Embarcadero(Black) Embarcadero(White)

paserver-docker's People

Contributors

azapater avatar checkdigits avatar fmxexpress avatar jimmckeeth avatar lmbelo avatar lynxnake avatar marcocantu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

paserver-docker's Issues

How to enable the parameter -unrestricted?

Hi.

On Linux, mostly applications uses their configuration file inside the /etc repository, however, the paserver-docker container doesn't allow to access other path levels since its -unrestricted parameter is not enabled.

Is there any chance to enable this parameter?

Edit: The PAServer always remove all files inside the destination binary directory, this way, there is no any chance even symbolic links, since they will be removed each build at all.

Thank you!

PAServer using 100% of CPU in docker-compose

Hi.

Steps to reproduce the problem:

  1. Create a file called docker-compose.yml with the following content:
version: "3.6"
services:
  paserver:
    image: radstudio/paserver:10.3.2
    container_name: paserver
    ports:
      - 64211:64211/tcp    
      - 8082:8082/tcp
    restart: on-failure
  1. Run the following command:
$ docker-compose up
  1. Attach a shell to the container:
docker exec -it <ID> bash

<ID> = The container ID, e.g.: docker exec -it bbb5cb400d07 bash

  1. Inside the container, use the top command to watch the processes:
$ top

Now, notice the PAServer using 96.7 ~ 100% of CPU, e.g.:

top - 20:07:10 up 36 min,  0 users,  load average: 7.04, 5.76, 4.88
Tasks:   6 total,   2 running,   4 sleeping,   0 stopped,   0 zombie
%Cpu(s): 42.4 us, 23.7 sy,  0.0 ni, 31.3 id,  0.0 wa,  2.1 hi,  0.4 si,  0.0 st
KiB Mem :  5903916 total,  1600796 free,  2468084 used,  1835036 buff/cache
KiB Swap:  6037500 total,  5815292 free,   222208 used.  2868752 avail Mem 

    PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND                                                                                            
      8 root      20   0  364060  17092  15428 R  96.7  0.3   4:59.68 paserver                                                                                           
      1 root      20   0    4624    804    740 S   0.0  0.0   0:00.21 sh                                                                                                 
      6 root      20   0   18372   3044   2796 S   0.0  0.1   0:00.00 paserver_docker                                                                                    
      7 root      20   0  153452   5796   5208 S   0.0  0.1   0:00.00 broadwayd                                                                                          
     24 root      20   0   18504   3440   3000 S   0.0  0.1   0:00.77 bash                                                                                               
     34 root      20   0   36612   3036   2600 R   0.0  0.1   0:00.01 top

Exception EIdOSSLCouldNotLoadSSLLibrary 'Could not load SSL library.'

Running a Linux64 Datasnap server compiled with Delphi 12 within this docker causes the before mentioned exception. Indy 10 as included in Delphi 12 seems to need package libcurl-openssl1.0-dev (or any other package that brings lib-opnessl1.0-dev) which I found no obvious way of how to install it within ubuntu:jammy.

Furthermore zlib1g-dev needs to be added to the imported packages.

When will it support RAD Studio 10.4?

I tried to pull the Docker image (radstudio/paserver) from Docker Hub. When I tried to use it the version of pa-server didn't seem to be compatible with RAD Studio 10.4.

Is this a known problem or a new one? Is there going to be an updated version on Docker Hub?

NB. When I cloned this project from GitHub I could see folders for 10.3.2 and 10.3.3 but none for 10.4.

Dont work on mac m3 (arm)

Hello

I'm trying to use paserver in mac m3, but debug mode is not working.

When I start delphi 12.1 app, the got the error "unable to create process: ''A' packet returned an error -1"

Its NOT working:

  • Image from https://hub.docker.com/r/radstudio/paserver with command: "docker run --cap-add=SYS_PTRACE --security-opt seccomp=unconfined -it -e PA_SERVER_PASSWORD=securepass -p 64211:64211 -p 8082:8082 radstudio/paserver:latest"
  • Manual install on oracle linux 9 docker image, same error

Tested with docker option --platform linux/amd64 too.

It's working

  • Manual install on fresh VM with oracle linux 9 on OCI --> It's work's after soft link adjust on python3.so.
  • Manual install on a Docker image inside the same VM with oracle linux 9 on OCI --> It's work's after soft link adjust on python3.so.

I can deploy and start app on docker in all images, but cant debug.

The problems seems to be in mac M3 arm.

Delphi 12.1
PAServer 23.0 (updated version to Delphi 12.1)

Can you help me?

Thanks
Fabio Lobo

Error compiling

When I compile a simple console application I get the following error "Unable to create process: ''A' packet returned an error: 8'."
I've tried with docker installed in versions 18 and 22.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.