Pull changes from upstream for version 2.6

created from upstream commit: 2f676852fab45caf07c5958cf4b7fa6ffc2498d1
This commit is contained in:
Petr Kubat 2020-02-13 16:28:40 +01:00
commit a4e75f54ed
15 changed files with 359 additions and 111 deletions

View file

@ -1,21 +1,24 @@
.TH Ruby 2.5 container image
.TH Ruby 2.6 container image
.PP
This container image includes Ruby 2.5 as a S2I
\[la]https://github.com/openshift/source-to-image\[ra] base image for your Ruby 2.5 applications.
Users can choose between RHEL and CentOS based builder images.
The RHEL image is available in the Red Hat Container Catalog
\[la]https://access.redhat.com/containers/#/registry.access.redhat.com/rhscl/ruby-25-rhel7\[ra]
as registry.access.redhat.com/rhscl/ruby\-25\-rhel7.
The CentOS image is then available on Docker Hub
\[la]https://hub.docker.com/r/centos/ruby-25-centos7/\[ra]
as centos/ruby\-25\-centos7.
The resulting image can be run using Docker
\[la]http://docker.io\[ra]\&.
This container image includes Ruby 2.6 as a S2I
\[la]https://github.com/openshift/source-to-image\[ra] base image for your Ruby 2.6 applications.
Users can choose between RHEL, CentOS and Fedora based builder images.
The RHEL images are available in the Red Hat Container Catalog
\[la]https://access.redhat.com/containers/\[ra],
the CentOS images are available on Docker Hub
\[la]https://hub.docker.com/r/centos/\[ra],
and the Fedora images are available in Fedora Registry
\[la]https://registry.fedoraproject.org/\[ra]\&.
The resulting image can be run using podman
\[la]https://github.com/containers/libpod\[ra]\&.
.PP
Note: while the examples in this README are calling \fB\fCpodman\fR, you can replace any such calls by \fB\fCdocker\fR with the same arguments
.SH Description
.PP
Ruby 2.5 available as container is a base platform for
building and running various Ruby 2.5 applications and frameworks.
Ruby 2.6 available as container is a base platform for
building and running various Ruby 2.6 applications and frameworks.
Ruby is the interpreted scripting language for quick and easy object\-oriented programming.
It has many features to process text files and to do system management tasks (as in Perl).
It is simple, straight\-forward, and extensible.
@ -28,35 +31,33 @@ the nodejs itself is included just to make the npm work.
.SH Usage
.PP
To build a simple ruby\-sample\-app
\[la]https://github.com/sclorg/s2i-ruby-container/tree/master/2.5/test/puma-test-app\[ra] application
using standalone S2I
\[la]https://github.com/openshift/source-to-image\[ra] and then run the
resulting image with Docker
\[la]http://docker.io\[ra] execute:
.IP \(bu 2
For this, we will assume that you are using the \fB\fCubi8/ruby\-26 image\fR, available via \fB\fCruby:2.6\fR imagestream tag in Openshift.
Building a simple ruby\-sample\-app
\[la]https://github.com/sclorg/s2i-ruby-container/tree/master/2.6/test/puma-test-app\[ra] application
in Openshift can be achieved with the following step:
.PP
\fBFor RHEL based image\fP
.PP
.RS
.nf
$ s2i build https://github.com/sclorg/s2i\-ruby\-container.git \-\-context\-dir=2.5/test/puma\-test\-app/ rhscl/ruby\-25\-rhel7 ruby\-sample\-app
$ docker run \-p 8080:8080 ruby\-sample\-app
```
$ oc new\-app ruby:2.6\~https://github.com/sclorg/s2i\-ruby\-container.git \-\-context\-dir=2.6/test/puma\-test\-app/
```
.fi
.RE
.IP \(bu 2
.PP
\fBFor CentOS based image\fP
The same application can also be built using the standalone S2I
\[la]https://github.com/openshift/source-to-image\[ra] application on systems that have it available:
.PP
.RS
.nf
$ s2i build https://github.com/sclorg/s2i\-ruby\-container.git \-\-context\-dir=2.5/test/puma\-test\-app/ centos/ruby\-25\-centos7 ruby\-sample\-app
$ docker run \-p 8080:8080 ruby\-sample\-app
```
$ s2i build https://github.com/sclorg/s2i\-ruby\-container.git \-\-context\-dir=2.6/test/puma\-test\-app/ ubi8/ruby\-26 ruby\-sample\-app
```
.fi
.RE
@ -75,8 +76,10 @@ $ curl 127.0.0.1:8080
.SH Environment variables
.PP
To set these environment variables, you can place them as a key value pair into a \fB\fC\&.sti/environment\fR
To set these environment variables, you can place them as a key value pair into a \fB\fC\&.s2i/environment\fR
file inside your source code repository.
.RS
.IP \(bu 2
.PP
@ -115,22 +118,26 @@ This variable indicate the number of worker processes that will be launched. See
.PP
Set this variable to use a custom RubyGems mirror URL to download required gem packages during build process.
.RE
.SH Hot deploy
.PP
In order to dynamically pick up changes made in your application source code, you need to make following steps:
.RS
.IP \(bu 2
.PP
\fBFor Ruby on Rails applications\fP
.PP
Run the built Rails image with the \fB\fCRAILS\_ENV=development\fR environment variable passed to the Docker
\[la]http://docker.io\[ra] \fB\fC\-e\fR run flag:
Run the built Rails image with the \fB\fCRAILS\_ENV=development\fR environment variable passed to the podman
\[la]https://github.com/containers/libpod\[ra] \fB\fC\-e\fR run flag:
.PP
.RS
.nf
$ docker run \-e RAILS\_ENV=development \-p 8080:8080 rails\-app
$ podman run \-e RAILS\_ENV=development \-p 8080:8080 rails\-app
.fi
.RE
@ -140,6 +147,8 @@ $ docker run \-e RAILS\_ENV=development \-p 8080:8080 rails\-app
\fBFor other types of Ruby applications (Sinatra, Padrino, etc.)\fP
.PP
Your application needs to be built with one of gems that reloads the server every time changes in source code are done inside the running container. Those gems are:
.RS
.IP \(bu 2
Shotgun
\[la]https://github.com/rtomayko/shotgun\[ra]
@ -150,40 +159,44 @@ Rerun
Rack\-livereload
\[la]https://github.com/johnbintz/rack-livereload\[ra]
.RE
.PP
Please note that in order to be able to run your application in development mode, you need to modify the S2I run script
\[la]https://github.com/openshift/source-to-image#anatomy-of-a-builder-image\[ra], so the web server is launched by the chosen gem, which checks for changes in the source code.
.PP
After you built your application image with your version of S2I run script
\[la]https://github.com/openshift/source-to-image#anatomy-of-a-builder-image\[ra], run the image with the RACK\_ENV=development environment variable passed to the Docker
\[la]http://docker.io\[ra] \-e run flag:
\[la]https://github.com/openshift/source-to-image#anatomy-of-a-builder-image\[ra], run the image with the RACK\_ENV=development environment variable passed to the podman
\[la]https://github.com/containers/libpod\[ra] \-e run flag:
.PP
.RS
.nf
$ docker run \-e RACK\_ENV=development \-p 8080:8080 sinatra\-app
$ podman run \-e RACK\_ENV=development \-p 8080:8080 sinatra\-app
.fi
.RE
.RE
.PP
To change your source code in running container, use Docker's exec
\[la]http://docker.io\[ra] command:
To change your source code in running container, use Podman's exec
\[la]https://github.com/containers/libpod\[ra] command:
.PP
.RS
.nf
docker exec \-it <CONTAINER\_ID> /bin/bash
$ podman exec \-it <CONTAINER\_ID> /bin/bash
.fi
.RE
.PP
After you Docker exec
\[la]http://docker.io\[ra] into the running container, your current
After you podman exec
\[la]https://github.com/containers/libpod\[ra] into the running container, your current
directory is set to \fB\fC/opt/app\-root/src\fR, where the source code is located.
.SH Performance tuning
@ -197,14 +210,14 @@ Puma
the cgroup cpusets
\[la]https://www.kernel.org/doc/Documentation/cgroup-v1/cpusets.txt\[ra]
subsystem. You can specify the cores that the container is allowed to use by passing
the \fB\fC\-\-cpuset\-cpus\fR parameter to the Docker
\[la]http://docker.io\[ra] run command:
the \fB\fC\-\-cpuset\-cpus\fR parameter to the podman
\[la]https://github.com/containers/libpod\[ra] run command:
.PP
.RS
.nf
$ docker run \-e PUMA\_MAX\_THREADS=32 \-\-cpuset\-cpus='0\-2,3,5' \-p 8080:8080 sinatra\-app
$ podman run \-e PUMA\_MAX\_THREADS=32 \-\-cpuset\-cpus='0\-2,3,5' \-p 8080:8080 sinatra\-app
.fi
.RE
@ -232,7 +245,7 @@ You can specify a memory limit using the \fB\fC\-\-memory\fR flag:
.RS
.nf
$ docker run \-e PUMA\_MAX\_THREADS=32 \-\-memory=300m \-p 8080:8080 sinatra\-app
$ podman run \-e PUMA\_MAX\_THREADS=32 \-\-memory=300m \-p 8080:8080 sinatra\-app
.fi
.RE
@ -246,5 +259,6 @@ workers can also be set explicitly by setting \fB\fCPUMA\_WORKERS\fR\&.
.PP
Dockerfile and other sources are available on
\[la]https://github.com/sclorg/s2i-ruby-container\[ra]\&.
In that repository you also can find another versions of Python environment Dockerfiles.
Dockerfile for CentOS is called Dockerfile, Dockerfile for RHEL is called Dockerfile.rhel7.
In that repository you also can find another versions of Ruby environment Dockerfiles.
Dockerfile for CentOS is called \fB\fCDockerfile\fR, Dockerfile for RHEL7 is called \fB\fCDockerfile.rhel7\fR,
for RHEL8 it's \fB\fCDockerfile.rhel8\fR and the Fedora Dockerfile is called Dockerfile.fedora.

View file

@ -3,4 +3,4 @@
#
# This will make scl collection binaries work out of box.
unset BASH_ENV PROMPT_COMMAND ENV
source scl_source enable rh-ruby25 $NODEJS_SCL
source scl_source enable rh-ruby26 $NODEJS_SCL