Chapter 12. Application Images
12.1. Node.js
12.1.1. Description
The rhscl/nodejs-14-rhel7 image provides a Node.js 14 platform for building and running applications.
12.1.2. Access
To pull the rhscl/nodejs-14-rhel7 image, run the following command as root:
# podman pull registry.redhat.io/rhscl/nodejs-14-rhel7
12.1.3. Configuration
To set environment variables, you can place them as a key-value pair into a .s2i/environment
file inside your source code repository.
Variable Name | Description |
---|---|
| NodeJS runtime mode (default: "production") |
|
When set to "true", |
|
Select an alternate / custom runtime mode, defined in your |
| Use an npm proxy during assembly |
| Use an npm proxy during assembly |
| Use a custom NPM registry mirror to download packages during the build process |
12.2. PHP
12.2.1. Description
The rhscl/php-73-rhel7 image provides a PHP 7.3 platform for building and running applications. Node.js
with npm
is preinstalled in the PHP images.
12.2.2. Access
To pull the rhscl/php-73-rhel7 image, run the following command as root:
# podman pull registry.redhat.io/rhscl/php-73-rhel7
12.2.3. Configuration
To set environment variables, place them as a key-value pair into a .s2i/environment
file inside your source code repository.
The following environment variables set their equivalent property value in the php.ini
file:
Variable Name | Description | Default |
---|---|---|
| Informs PHP of which errors, warnings and notices you would like it to take action for |
|
| Controls whether or not and where PHP will output errors, notices and arnings |
|
| Cause display errors which occur during PHP’s startup sequence to be handled separately from display errors |
|
|
Store the last error/warning message in |
|
| Link errors to documentation related to the error |
|
| Path for PHP source files |
|
| Memory limit | 128M |
| Name of the session |
|
| Method for saving sessions |
|
| Location for session data files |
|
| The domain for which the cookie is valid | |
| Whether or not to add the httpOnly flag to the cookie |
|
| Specifies whether cookies should only be sent over secure connections |
|
| Determines whether or not PHP will recognize code between <? and ?> tags |
|
| Path that defines the DocumentRoot for your application (ie. /public) |
|
Replace the version of the rh-php7*
Software Collection when appropriate.
The following environment variables set their equivalent property value in the opcache.ini
file:
Variable Name | Description | Default |
---|---|---|
| The OPcache shared memory storage size in megabytes | 128 |
| How often to check script timestamps for updates, in seconds. 0 will result in OPcache checking for updates on every request. | 2 |
| The maximum number of keys (scripts) in the OPcache hash table. Only numbers between 200 and 1000000 are allowed. | 4000 |
You can also override the entire directory used to load the PHP configuration by setting:
Variable Name | Description |
---|---|
|
Sets the path to the |
| Path to scan for additional ini configuration files |
You can override the Apache MPM prefork settings to increase the performance for of the PHP application. In case you set the Cgroup limits, the image will attempt to automatically set the optimal values. You can override this at any time by specifying the values yourself:
Variable Name | Description | Default |
---|---|---|
| The StartServers directive sets the number of child server processes created on startup. | 8 |
| The MaxRequestWorkers directive sets the limit on the number of simultaneous requests that will be served. |
256 (this is automatically tuned by setting Cgroup limits for the container using this formula: |
You can use a custom composer repository mirror URL to download packages instead of the default packagist.org
:
Variable Name | Description |
---|---|
|
Adds a custom composer repository mirror URL to composer configuration. Note: This only affects packages listed in |
| Overrides the default URL for downloading Composer of https://getcomposer.org/installer. Useful in disconnected environments. |
|
Adds extra arguments to the |
In case the DocumentRoot of the application is nested within the source directory /opt/app-root/src
, users can provide their own .htaccess
file. This allows the overriding of Apache’s behavior and specifies how application requests should be handled. The .htaccess
file needs to be located at the root of the application source. For details about .htaccess
, see the Apache HTTP Server Tutorial.
12.2.4. Extending the Image
The PHP image can be extended using source-to-image.
For example, to build a customized PHP image my-php-rhel7
with configuration in the ~/image-configuration/
directory, run:
$ s2i build ~/image-configuration/ rhscl/php-73-rhel7 my-php-rhel7
Make sure to change the source image version accordingly.
The structure of the application can be similar to this example:
Directory name | Description |
---|---|
|
Can contain additional Apache configuration files ( |
|
Can contain own SSL certificate (in the |
|
Can contain shell scripts ( |
|
Can contain shell scripts ( |
| Application source code |
12.3. Perl
12.3.1. Description
The rhscl/perl-530-rhel7 image provides a Perl 5.30 platform for building and running applications. Apache httpd 2.4
with mod_perl
for deploying Perl web applications is preinstalled, as well as Node.js
with npm
.
These images also support deploying Perl Web Server Gateway Interface (PSGI) applications.
12.3.2. Access
To pull the rhscl/perl-530-rhel7 image, run the following command as root:
# podman pull registry.redhat.io/rhscl/perl-530-rhel7
12.3.3. Configuration
To set environment variables, you can place them as a key-value pair into a .s2i/environment
file inside your source code repository.
Variable Name | Description | Default |
---|---|---|
| Allows the installation of all specified cpan packages and the running of their tests |
|
| Specifies a mirror URL which will used by cpanminus to install dependencies | URL is not specified by default |
| Enables automatic reloading of modified Perl modules |
|
| The StartServers directive sets the number of child server processes created on startup |
|
| Number of simultaneous requests that will be handled by Apache |
|
| Specifies a relative path to the PSGI application file. Use an empty value to disable the PSGI auto-configuration | Single *.psgi file in the top-level directory, if it exists |
| Specifies a URI path that is handled by the PSGI application |
|
To install additional Perl modules from the Comprehensive Perl Archive Network (CPAN), create a cpanfile
in the root directory of your application sources. The file must conform to the cpanfile
format as defined in Module-CPANFile CPAN distribution. For detailed information about the cpanfile format, refer to the cpanfile documentation.
To modify the Apache httpd
behavior, drop the .htaccess
file in the application sources tree where appropriate. For details about .htaccess
, see the Apache HTTP Server Tutorial.
12.4. Python
12.4.1. Description
The rhscl/python-38-rhel7 image provides a Python 3.8 platform for building and running applications. Node.js
with npm
is preinstalled.
12.4.2. Access
To pull the rhscl/python-38-rhel7 image, run the following command as root:
# podman pull registry.redhat.io/rhscl/python-38-rhel7
12.4.3. Configuration
To set environment variables, you can place them as a key-value pair into a .s2i/environment
file inside your source code repository.
Variable Name | Description |
---|---|
|
Used to run the application from a script file. This should be a path to a script file (defaults to |
|
Used to run the application from a Python script. This should be a path to a Python file (defaults to |
|
Used to run the application with Gunicorn, as documented here. This variable specifies a WSGI callable with the pattern |
|
This variable can be used to specify a sub-directory in which the application to be run is contained. The directory pointed to by this variable needs to contain |
| Path to a valid Python file with a Gunicorn configuration file. |
|
Set this variable to a non-empty value to inhibit the execution of |
|
Set this variable to a non-empty value to inhibit the execution of |
|
Set this variable to a non-empty value to skip processing of the |
|
Set this variable to use Pipenv, the higher-level Python packaging tool, to manage dependencies of the application. This should be used only if your project contains an appropriately formatted |
|
Set this variable to a non-empty value to make use of an init wrapper. This is useful for servers that are not capable of reaping zombie processes, such as Django development server or Tornado. This option can be used together with the |
| Set this variable to use a custom index URL or mirror to download required packages during build process. This only affects packages listed in requirements.txt. |
|
Set this variable to a non-empty value to have the |
| Set this to change the default setting for the number of workers. By default, this is set to the number of available cores times 2. |
12.5. Ruby
12.5.1. Description
The rhscl/ruby-30-rhel7 image provides a Ruby 3.0 platform for building and running applications and the rhscl/ruby-27-rhel7 image provides a Ruby 2.7 platform.
Node.js
with npm
is preinstalled.
12.5.2. Access
To pull the rhscl/ruby-30-rhel7 image, run the following command as root:
# podman pull registry.redhat.io/rhscl/ruby-30-rhel7
To pull the rhscl/ruby-27-rhel7 image, run the following command as root:
# podman pull registry.redhat.io/rhscl/ruby-27-rhel7
12.5.3. Configuration
To set environment variables, you can place them as a key-value pair into a .s2i/environment
file inside your source code repository.
Variable Name | Description |
---|---|
|
This variable specifies the environment where the Ruby application will be deployed (unless overwritten) - |
|
This variable set to |
| These variables indicate the minimum and maximum threads that will be available in Puma's thread pool. |
| This variable indicates the number of worker processes that will be launched. See documentation on Puma’s clustered mode. |
| Set this variable to use a custom RubyGems mirror URL to download required gem packages during the build process. |
For S2I scripts to work, you need to include the puma
or rack
gem in the application’s Gemfile.