Skip to content

Commit

Permalink
Perl image 5.30-mod_fcgid for RHEL8 reached EOL in Nov 2023 (#292)
Browse files Browse the repository at this point in the history
This pull request removes it from Makefile, building and testing

* Remove 5.30-mod_fcgid from GitHub Actions
* Remove 5.30-mod_fcgid EOL version from test_perl_imagestream
* Update also main README.md file

Signed-off-by: Petr "Stone" Hracek <[email protected]>
  • Loading branch information
phracek authored Jan 11, 2024
1 parent 6e3e6d3 commit b3fdebd
Show file tree
Hide file tree
Showing 8 changed files with 4 additions and 248 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/container-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
strategy:
fail-fast: false
matrix:
version: [ "5.26", "5.26-mod_fcgid", "5.30", "5.30-mod_fcgid", "5.32", "5.34", "5.36", "5.38" ]
version: [ "5.26", "5.26-mod_fcgid", "5.30", "5.32", "5.34", "5.36", "5.38" ]
os_test: [ "fedora", "rhel7", "rhel8", "rhel9", "c9s" ]
test_case: [ "container" ]

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/openshift-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
strategy:
fail-fast: false
matrix:
version: [ "5.26", "5.26-mod_fcgid", "5.30", "5.30-mod_fcgid", "5.32", "5.34", "5.36", "5.38" ]
version: [ "5.26", "5.26-mod_fcgid", "5.30", "5.32", "5.34", "5.36", "5.38" ]
os_test: [ "rhel7", "rhel8", "rhel9"]
test_case: [ "openshift-3", "openshift-4" ]
exclude:
Expand Down
Empty file added 5.30-mod_fcgid/.exclude-rhel8
Empty file.
219 changes: 1 addition & 218 deletions 5.30-mod_fcgid/README.md
Original file line number Diff line number Diff line change
@@ -1,221 +1,4 @@
Perl 5.30 container image
=========================

This container image includes Perl 5.30 as an [S2I](https://github.com/openshift/source-to-image) base image for your Perl 5.30 applications.
Users can choose between RHEL, CentOS and Fedora based builder images.
The RHEL images are available in the [Red Hat Container Catalog](https://access.redhat.com/containers/),
the CentOS images are available on [Docker Hub](https://hub.docker.com/r/centos/),
and the Fedora images are available in [Fedora Registry](https://registry.fedoraproject.org/).
The resulting image can be run using [podman](https://github.com/containers/libpod).

Note: while the examples in this README are calling `podman`, you can replace any such calls by `docker` with the same arguments.

Description
-----------

Perl 5.30 available as container is a base platform for
building and running various Perl 5.30 applications and frameworks.
Perl is a high-level programming language with roots in C, sed, awk and shell scripting.
Perl is good at handling processes and files, and is especially good at handling text.
Perl's hallmarks are practicality and efficiency. While it is used to do a lot of
different things, Perl's most common applications are system administration utilities
and web programming.

This container image includes an cpanm utility, so users can use it to install Perl
modules for their web applications. There is no guarantee for any specific CPAN module
version, that is included in the image; those versions can be changed anytime.

Usage in Openshift
------------------

In this example, we will assume that you are using the `ubi8/perl-530` image, available via `perl:5.30` imagestream tag in Openshift.
To build a simple [perl-sample-app](https://github.com/sclorg/dancer-ex.git) application in Openshift:

```
oc new-app perl:5.30~https://github.com/sclorg/dancer-ex.git
```

**To access the application:**

```
oc get pods
oc exec <pod> -- curl 127.0.0.1:8080
```

Source-to-Image framework and scripts
-------------------------------------

This image supports the [Source-to-Image](https://docs.openshift.com/container-platform/3.11/creating_images/s2i.html)
(S2I) strategy in OpenShift. The Source-to-Image is an OpenShift framework
which makes it easy to write images that take application source code as
an input, use a builder image like this Node.js container image, and produce
a new image that runs the assembled application as an output.

To support the Source-to-Image framework, important scripts are included in the builder image:

* The `/usr/libexec/s2i/assemble` script inside the image is run to produce a new image with the application artifacts. The script takes sources of a given application and places them into appropriate directories inside the image. It utilizes some common patterns in Perl application development (see the **Environment variables** section below).
* The `/usr/libexec/s2i/run` script is set as the default command in the resulting container image (the new image with the application artifacts). It runs `httpd` for production.

Building an application using a Dockerfile
------------------------------------------

Compared to the Source-to-Image strategy, using a Dockerfile is a more
flexible way to build a Perl container image with an application.
Use a Dockerfile when Source-to-Image is not sufficiently flexible for you or
when you build the image outside of the OpenShift environment.

To use the Perl image in a Dockerfile, follow these steps:

#### 1. Pull a base builder image to build on

```
podman pull ubi8/perl-530
```

An ubi8 image `ubi8/perl-530` is used in this example.

#### 2. Pull and application code

An example application available at https://github.com/sclorg/dancer-ex.git is used here. Feel free to clone the repository for further experiments.

```
git clone https://github.com/sclorg/dancer-ex.git app-src
```

#### 3. Prepare an application inside a container

This step usually consists of at least these parts:

* putting the application source into the container
* installing the dependencies
* setting the default command in the resulting image

For all these three parts, users can either setup all manually and use commands `perl` and `cpanm` explicitly in the Dockerfile ([3.1.](#31-to-use-your-own-setup-create-a-dockerfile-with-this-content)), or users can use the Source-to-Image scripts inside the image ([3.2.](#32-to-use-the-source-to-image-scripts-and-build-an-image-using-a-dockerfile-create-a-dockerfile-with-this-content); see more about these scripts in the section "Source-to-Image framework and scripts" above), that already know how to set-up and run some common Perl applications.

##### 3.1 To use your own setup, create a Dockerfile with this content:

```
FROM ubi8/perl-530
# Add application sources
ADD app-src .
# Set the paths to local Perl modules
ENV PATH=${PATH}:/opt/app-root/src/extlib/bin
ENV PERL5LIB=/opt/app-root/src/extlib/lib/perl5
# Install the dependencies
RUN cpanm --notest -l extlib Module::CoreList && \
cpanm --notest -l extlib --installdeps .
# Install Plack as an FCGI server
RUN cpanm --notest -l extlib Plack::Handler::FCGI FCGI::ProcManager
RUN patch --read-only=ignore -d ./extlib/lib/perl5 -p2 < /opt/app-root/Plack-1.0047-Work-around-mod_fcgid-bogus-SCRIPT_NAME-PATH_INFO.patch
RUN printf '\
FcgidInitialEnv MODFCGID_VIRTUAL_LOCATION /\n\
PassEnv HOME\n\
FcgidInitialEnv "HOME" "%s"\n\
PassEnv PATH\n\
FcgidInitialEnv "PATH" "%s"\n\
PassEnv PERL5LIB\n\
FcgidInitialEnv "PERL5LIB" "%s"\n\
<Location />\n\
SetHandler fcgid-script\n\
Options +ExecCGI\n\
FcgidWrapper "/opt/app-root/psgiwrapper /usr/bin/env plackup -s FCGI ./app.psgi" virtual\n\
</Location>\n' "$HOME" "$PATH" "$PERL5LIB"> /opt/app-root/etc/httpd.d/40-psgi.conf
# Run scripts uses standard ways to run the application
CMD exec httpd -C 'Include /opt/app-root/etc/httpd.conf' -D FOREGROUND
```

##### 3.2 To use the Source-to-Image scripts and build an image using a Dockerfile, create a Dockerfile with this content:

```
FROM ubi8/perl-530
# Add application sources to a directory that the assemble scriptexpects them
# and set permissions so that the container runs without root access
USER 0
ADD app-src /tmp/src
RUN chown -R 1001:0 /tmp/src
USER 1001
# Install the dependencies
RUN /usr/libexec/s2i/assemble
# Set the default command for the resulting image
CMD /usr/libexec/s2i/run
```

#### 4. Build a new image from a Dockerfile prepared in the previous step

```
podman build -t perl-app .
```

#### 5. Run the resulting image with final application

```
podman run -d perl-app
```

Environment variables for Source-to-Image
-----------------------------------------

To set environment variables, you can place them as a key value pair into a `.s2i/environment`
file inside your source code repository.

* **ENABLE_CPAN_TEST**

Allow the installation of all specified cpan packages and the running of their tests. The default value is `false`.

* **CPAN_MIRROR**

This variable specifies a mirror URL which will used by cpanminus to install dependencies.
By default the URL is not specified.

* **HTTPD_START_SERVERS**

The [StartServers](https://httpd.apache.org/docs/2.4/mod/mpm_common.html#startservers)
directive sets the number of child server processes created on startup. Default is 8.

* **HTTPD_MAX_REQUEST_WORKERS**

Number of simultaneous requests that will be handled by Apache httpd. The default
is 256, but it will be automatically lowered if memory is limited.

* **PSGI_FILE**

Override PSGI application detection.

If the PSGI_FILE variable is set to empty value, no PSGI application will
be detected and mod_fcgid not be reconfigured.

If the PSGI_FILE variable is set and non-empty, it will define path to
the PSGI application file. No detection will be used.

If the PSGI_FILE variable does not exist, autodetection will be used:
If exactly one ./*.psgi file exists, mod_fcgid will be configured to
execute that file.

* **PSGI_RELOAD**

Reload PSGI application when source code in application directory will be changed.

If the PSGI_RELOAD variable is set to empty value, no reload will be used.

If the PSGI_RELOAD variable is set and non-empty, it will cause reload defined by
code change in application directory.

* **PSGI_URI_PATH**

This variable overrides location URI path that is handled path the PSGI
application. Default value is "/".

See also
--------

Dockerfile and other sources are available on https://github.com/sclorg/s2i-perl-container.
In that repository you also can find another versions of Perl environment Dockerfiles.
Dockerfile for CentOS is called `Dockerfile`, Dockerfile for RHEL7 is called `Dockerfile.rhel7`, for RHEL8 `Dockerfile.rhel8` and the Fedora Dockerfile is called `Dockerfile.fedora`.
**The Perl 5.30-mod_fcgid image is deprecated.**
21 changes: 0 additions & 21 deletions 5.30-mod_fcgid/content_sets.yml

This file was deleted.

2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Variables are documented in common/build.sh.
BASE_IMAGE_NAME = perl
VERSIONS = 5.26-mod_fcgid 5.26 5.30-mod_fcgid 5.30 5.32 5.34 5.36 5.38
VERSIONS = 5.26-mod_fcgid 5.26 5.30 5.32 5.34 5.36 5.38
OPENSHIFT_NAMESPACES = 5.16

# HACK: Ensure that 'git pull' for old clones doesn't cause confusion.
Expand Down
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,6 @@ Usage
For information about usage of the Dockerfile for Perl 5.30,
see [usage documentation](5.30/README.md).
For information about usage of the Dockerfile for Perl 5.30 - mod_fcgid version,
see [usage documentation](5.30-mod_fcgid/README.md).
For information about usage of the Dockerfile for Perl 5.32 - mod_fcgid version,
see [usage documentation](5.32/README.md).
Expand Down
3 changes: 0 additions & 3 deletions test/test-lib-perl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ function test_perl_imagestream() {
if [ "${VERSION}" == "5.26-mod_fcgid" ]; then
VERSION="5.26"
fi
if [ "${VERSION}" == "5.30-mod_fcgid" ]; then
VERSION="5.30"
fi
echo "Testing perl imagestream application"
ct_os_test_image_stream_quickstart "${THISDIR}/imagestreams/perl-${OS%[0-9]*}.json" \
"${THISDIR}/sample-test-app.json" \
Expand Down

0 comments on commit b3fdebd

Please sign in to comment.