diff --git a/.gitignore b/.gitignore deleted file mode 100644 index e69de29..0000000 diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index d4c0173..0000000 --- a/Dockerfile +++ /dev/null @@ -1,71 +0,0 @@ -FROM registry.fedoraproject.org/f26/s2i-base - -# Apache HTTP Server image. -# -# Volumes: -# * /var/www - Datastore for httpd -# * /var/log/httpd - Storage for logs when $HTTPD_LOG_TO_VOLUME is set -# Environment: -# * $HTTPD_LOG_TO_VOLUME (optional) - When set, httpd will log into /var/log/httpd - -ENV HTTPD_VERSION=2.4 - -ENV SUMMARY="Platform for running Apache httpd $HTTPD_VERSION or building httpd-based application" \ - DESCRIPTION="Apache httpd $HTTPD_VERSION available as docker container, is a powerful, efficient, \ -and extensible web server. Apache supports a variety of features, many implemented as compiled modules \ -which extend the core functionality. \ -These can range from server-side programming language support to authentication schemes. \ -Virtual hosting allows one Apache installation to serve many different Web sites." - -LABEL summary="$SUMMARY" \ - description="$DESCRIPTION" \ - io.k8s.description="$SUMMARY" \ - io.k8s.display-name="Apache httpd $HTTPD_VERSION" \ - io.openshift.expose-services="8080:http,8443:https" \ - io.openshift.tags="builder,httpd,httpd24" - -ENV NAME=httpd \ - VERSION=0 \ - RELEASE=1 \ - ARCH=x86_64 - -LABEL com.redhat.component="$NAME" \ - name="$FGC/$NAME" \ - version="$VERSION" \ - release="$RELEASE.$DISTTAG" \ - architecture="$ARCH" \ - usage="docker run -d --name httpd -p 8080:8080 -v /wwwdata:/var/www:Z 26/httpd" \ - help="help.1" - -EXPOSE 80 -EXPOSE 443 -EXPOSE 8080 -EXPOSE 8443 - -RUN dnf install -y yum-utils gettext hostname && \ - INSTALL_PKGS="nss_wrapper bind-utils httpd mod_ssl" && \ - dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ - rpm -V $INSTALL_PKGS && \ - dnf clean all - -ENV HTTPD_CONTAINER_SCRIPTS_PATH=/usr/share/container-scripts/httpd/ \ - HTTPD_APP_ROOT=/opt/app-root \ - HTTPD_CONFIGURATION_PATH=${HTTPD_APP_ROOT}/etc/httpd.d \ - HTTPD_MAIN_CONF_PATH=/etc/httpd/conf \ - HTTPD_MAIN_CONF_D_PATH=/etc/httpd/conf.d \ - HTTPD_VAR_RUN=/var/run/httpd \ - HTTPD_DATA_PATH=/var/www \ - HTTPD_DATA_ORIG_PATH=/var/www \ - HTTPD_LOG_PATH=/var/log/httpd - -COPY ./s2i/bin/ $STI_SCRIPTS_PATH -COPY ./root / - -RUN /usr/libexec/httpd-prepare - -USER 1001 - -VOLUME ["${HTTPD_DATA_PATH}"] -VOLUME ["${HTTPD_LOG_PATH}"] - -CMD ["/usr/bin/run-httpd"] diff --git a/README.md b/README.md deleted file mode 100644 index eb97041..0000000 --- a/README.md +++ /dev/null @@ -1,121 +0,0 @@ -Apache HTTP Server 2.4 -====================== - -This container image includes Apache HTTP Server 2.4 for OpenShift and general usage. -Users can choose between RHEL, CentOS, and Fedora based images. -The RHEL image is available in the [Red Hat Registry](https://access.redhat.com/containers) -as registry.access.redhat.com/rhscl/httpd-24-rhel7. -The CentOS image is then available on [Docker Hub](https://hub.docker.com/r/centos/httpd-24-centos7/) -as centos/httpd-24-centos7. - - -DESCRIPTION ------------ - -Apache HTTP Server 2.4 available as docker container, is a powerful, efficient, -and extensible web server. Apache supports a variety of features, many implemented as compiled modules -which extend the core functionality. -These can range from server-side programming language support to authentication schemes. -Virtual hosting allows one Apache installation to serve many different Web sites." - - -USAGE ------ - -For this, we will assume that you are using the `rhscl/httpd-24-rhel7` image. -The image can be used as a base image for other applications based on Apache HTTP web server. - -An example of the data on the host for both the examples above, that will be served by -Apache HTTP web server: - -``` -$ ls -lZ /wwwdata/html --rw-r--r--. 1 1001 1001 54321 Jan 01 12:34 index.html --rw-r--r--. 1 1001 1001 5678 Jan 01 12:34 page.html -``` - -If you want to run the image and mount the static pages available in `/wwwdata` on the host -as a docker volume, execute the following command: - -``` -$ docker run -d --name httpd -p 8080:8080 -v /wwwdata:/var/www:Z rhscl/httpd-24-rhel7 -``` - -This will create a container named `httpd` running Apache HTTP Server, serving data from -`/wwwdata` directory. Port 8080 will be exposed and mapped to the host. - -If you want to create a new Docker layered image, use [Source-to-Image](https://github.com/openshift/source-to-image), a tool for building/building artifacts from source and injecting into docker images. To create a new Docker image named `httpd-app` using Source-to-Image, while using data available in `/wwwdata` on the host, execute the following command: - -``` -$ s2i build file:///wwwdata/html rhscl/httpd-24-rhel7 httpd-app -``` - -To run such a new image, execute the following command: - -``` -$ docker run -d --name httpd -p 8080:8080 httpd-app -``` - - -CONFIGURATION -------------- - -The Apache HTTP Server container image supports the following configuration variable, which can be set by using the `-e` option with the docker run command: - -| Variable name | Description | -| :---------------------- | ----------------------------------------- | -| `HTTPD_LOG_TO_VOLUME` | By default, httpd logs into standard output, so the logs are accessible by using the docker logs command. When `HTTPD_LOG_TO_VOLUME` is set, httpd logs into `/var/log/httpd24`, which can be mounted to host system using the Docker volumes. This option is only allowed when container is run as UID 0. | - - -If you want to run the image and mount the log files into `/wwwlogs` on the host -as a docker volume, execute the following command: - -``` -$ docker run -d -u 0 -e HTTPD_LOG_TO_VOLUME=1 --name httpd -v /wwwlogs:/var/log/httpd24:Z rhscl/httpd-24-rhel7 -``` - - -VOLUMES -------- - -You can also set the following mount points by passing the `-v /host:/container` flag to Docker. - -| Volume mount point | Description | -| :----------------------- | ---------------------------------------------------------------------- | -| `/var/www` | Apache HTTP Server data directory | -| `/var/log/httpd24` | Apache HTTP Server log directory (available only when running as root, path `/var/log/httpd` is used in case of Fedora based image) | - -**Notice: When mouting a directory from the host into the container, ensure that the mounted -directory has the appropriate permissions and that the owner and group of the directory -matches the user UID or name which is running inside the container.** - - -DEFAULT USER ------------- - -By default, Apache HTTP Server container runs as UID 1001. That means the volume mounted directories for the files (if mounted using `-v` option) need to be prepared properly, so the UID 1001 can read them. - -To run the container as a different UID, use `-u` option. For example if you want to run the container as UID 1234, execute the following command: - -``` -docker run -d -u 1234 rhscl/httpd-24-rhel7 -``` - -To log into a volume mounted directory, the container needs to be run as UID 0 (see above). - - - -TROUBLESHOOTING ---------------- -The httpd deamon in the container logs to the standard output by default, so the log is available in the container log. The log can be examined by running: - - docker logs - - -SEE ALSO --------- -Dockerfile and other sources for this container image are available on -https://github.com/sclorg/httpd-container. -In that repository, Dockerfile for CentOS is called Dockerfile, Dockerfile -for RHEL is called Dockerfile.rhel7. - diff --git a/dead.package b/dead.package new file mode 100644 index 0000000..2e10e65 --- /dev/null +++ b/dead.package @@ -0,0 +1 @@ +This container component is no longer used for anything, retiring to make it explicit. diff --git a/root/help.1 b/root/help.1 deleted file mode 100644 index 73f69f2..0000000 --- a/root/help.1 +++ /dev/null @@ -1,163 +0,0 @@ -.TH "HTTPD-24-RHEL7" "1" " Container Image Pages" "Red Hat" "April 07, 2017" "" - - -.SH Apache HTTP Server 2.4 -.PP -This container image includes Apache HTTP Server 2.4 for OpenShift and general usage. -Users can choose between RHEL, CentOS, and Fedora based images. -The RHEL image is available in the -\[la]https://access.redhat.com/containers\[ra] -as registry.access.redhat.com/rhscl/httpd\-24\-rhel7. -The CentOS image is then available on -\[la]https://hub.docker.com/r/centos/httpd-24-centos7/\[ra] -as centos/httpd\-24\-centos7. - -.SH DESCRIPTION -.PP -Apache HTTP Server 2.4 available as docker container, is a powerful, efficient, -and extensible web server. Apache supports a variety of features, many implemented as compiled modules -which extend the core functionality. -These can range from server\-side programming language support to authentication schemes. -Virtual hosting allows one Apache installation to serve many different Web sites." - -.SH USAGE -.PP -For this, we will assume that you are using the \fB\fCrhscl/httpd\-24\-rhel7\fR image. -The image can be used as a base image for other applications based on Apache HTTP web server. - -.PP -An example of the data on the host for both the examples above, that will be served by -Apache HTTP web server: - -.PP -.RS - -.nf -$ ls \-lZ /wwwdata/html -\-rw\-r\-\-r\-\-. 1 1001 1001 54321 Jan 01 12:34 index.html -\-rw\-r\-\-r\-\-. 1 1001 1001 5678 Jan 01 12:34 page.html - -.fi -.RE - -.PP -If you want to run the image and mount the static pages available in \fB\fC/wwwdata\fR on the host -as a docker volume, execute the following command: - -.PP -.RS - -.nf -$ docker run \-d \-\-name httpd \-p 8080:8080 \-v /wwwdata:/var/www:Z rhscl/httpd\-24\-rhel7 - -.fi -.RE - -.PP -This will create a container named \fB\fChttpd\fR running Apache HTTP Server, serving data from -\fB\fC/wwwdata\fR directory. Port 8080 will be exposed and mapped to the host. - -.PP -If you want to create a new Docker layered image, use -\[la]https://github.com/openshift/source-to-image\[ra], a tool for building/building artifacts from source and injecting into docker images. To create a new Docker image named \fB\fChttpd\-app\fR using Source\-to\-Image, while using data available in \fB\fC/wwwdata\fR on the host, execute the following command: - -.PP -.RS - -.nf -$ s2i build file:///wwwdata/html rhscl/httpd\-24\-rhel7 httpd\-app - -.fi -.RE - -.PP -To run such a new image, execute the following command: - -.PP -.RS - -.nf -$ docker run \-d \-\-name httpd \-p 8080:8080 httpd\-app - -.fi -.RE - -.SH CONFIGURATION -.PP -The Apache HTTP Server container image supports the following configuration variable, which can be set by using the \fB\fC\-e\fR option with the docker run command: -.TS -allbox; -Variable name Description -\fB\fCHTTPD\_LOG\_TO\_VOLUME\fR By default, httpd logs into standard output, so the logs are accessible by using the docker logs command. When \fB\fCHTTPD\_LOG\_TO\_VOLUME\fR is set, httpd logs into \fB\fC/var/log/httpd24\fR, which can be mounted to host system using the Docker volumes. This option is only allowed when container is run as UID 0. - -.TE - -.PP -If you want to run the image and mount the log files into \fB\fC/wwwlogs\fR on the host -as a docker volume, execute the following command: - -.PP -.RS - -.nf -$ docker run \-d \-u 0 \-e HTTPD\_LOG\_TO\_VOLUME=1 \-\-name httpd \-v /wwwlogs:/var/log/httpd24:Z rhscl/httpd\-24\-rhel7 - -.fi -.RE - -.SH VOLUMES -.PP -You can also set the following mount points by passing the \fB\fC\-v /host:/container\fR flag to Docker. -.TS -allbox; -Volume mount point Description -\fB\fC/var/www\fR Apache HTTP Server data directory - -\fB\fC/var/log/httpd24\fR Apache HTTP Server log directory (available only when running as root, path \fB\fC/var/log/httpd\fR is used in case of Fedora based image) - -.TE - -.PP -\fBNotice: When mouting a directory from the host into the container, ensure that the mounted -directory has the appropriate permissions and that the owner and group of the directory -matches the user UID or name which is running inside the container.\fP - -.SH DEFAULT USER -.PP -By default, Apache HTTP Server container runs as UID 1001. That means the volume mounted directories for the files (if mounted using \fB\fC\-v\fR option) need to be prepared properly, so the UID 1001 can read them. - -.PP -To run the container as a different UID, use \fB\fC\-u\fR option. For example if you want to run the container as UID 1234, execute the following command: - -.PP -.RS - -.nf -docker run \-d \-u 1234 rhscl/httpd\-24\-rhel7 - -.fi -.RE - -.PP -To log into a volume mounted directory, the container needs to be run as UID 0 (see above). - -.SH TROUBLESHOOTING -.PP -The httpd deamon in the container logs to the standard output by default, so the log is available in the container log. The log can be examined by running: - -.PP -.RS - -.nf -docker logs - -.fi -.RE - -.SH SEE ALSO -.PP -Dockerfile and other sources for this container image are available on - -\[la]https://github.com/sclorg/httpd-container\[ra]. -In that repository, Dockerfile for CentOS is called Dockerfile, Dockerfile -for RHEL is called Dockerfile.rhel7. diff --git a/root/usr/bin/run-httpd b/root/usr/bin/run-httpd deleted file mode 100755 index ad38ce0..0000000 --- a/root/usr/bin/run-httpd +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -set -eu - -source ${HTTPD_CONTAINER_SCRIPTS_PATH}/common.sh - -# Check whether we run as s2i -if ! [ -v HTTPD_RUN_BY_S2I ] && runs_privileged ; then - config_privileged -else - # We run as non-root or as s2i - config_non_privileged - generate_container_user -fi - -exec httpd -D FOREGROUND $@ diff --git a/root/usr/libexec/httpd-prepare b/root/usr/libexec/httpd-prepare deleted file mode 100755 index 6ca6309..0000000 --- a/root/usr/libexec/httpd-prepare +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash - -set -e - -source ${HTTPD_CONTAINER_SCRIPTS_PATH}/common.sh - -# compatibility symlinks so we hide SCL paths -if [ -v HTTPD_SCL ] ; then - # /opt/rh/httpd24/root/etc/httpd will be symlink to /etc/httpd - mv /opt/rh/httpd24/root/etc/httpd /etc/httpd - ln -s /etc/httpd /opt/rh/httpd24/root/etc/httpd - - # /opt/rh/httpd24/root/var/run/httpd will be symlink to /var/run/httpd - mv /opt/rh/httpd24/root/var/run/httpd /var/run/httpd - ln -s /var/run/httpd /opt/rh/httpd24/root/var/run/httpd - - # /opt/rh/httpd24/root/var/www will be symlink to /var/www - rm -rf /var/www - mv /opt/rh/httpd24/root/var/www /var/www - ln -s /var/www /opt/rh/httpd24/root/var/www -fi - -mkdir -p ${HTTPD_CONFIGURATION_PATH} -chmod -R a+rwx ${HTTPD_MAIN_CONF_PATH} -chmod -R a+rwx ${HTTPD_MAIN_CONF_D_PATH} -chmod -R a+r /etc/pki/tls/certs/localhost.crt -chmod -R a+r /etc/pki/tls/private/localhost.key -mkdir -p ${HTTPD_APP_ROOT}/etc -chmod -R a+rwx ${HTTPD_APP_ROOT}/etc -chmod -R a+rwx ${HTTPD_VAR_RUN} -chown -R 1001:0 ${HTTPD_APP_ROOT} -chown -R 1001:0 ${HTTPD_DATA_PATH} -chown -R 1001:0 ${HTTPD_LOG_PATH} - -config_general - diff --git a/root/usr/share/container-scripts/httpd/README.md b/root/usr/share/container-scripts/httpd/README.md deleted file mode 100644 index eb97041..0000000 --- a/root/usr/share/container-scripts/httpd/README.md +++ /dev/null @@ -1,121 +0,0 @@ -Apache HTTP Server 2.4 -====================== - -This container image includes Apache HTTP Server 2.4 for OpenShift and general usage. -Users can choose between RHEL, CentOS, and Fedora based images. -The RHEL image is available in the [Red Hat Registry](https://access.redhat.com/containers) -as registry.access.redhat.com/rhscl/httpd-24-rhel7. -The CentOS image is then available on [Docker Hub](https://hub.docker.com/r/centos/httpd-24-centos7/) -as centos/httpd-24-centos7. - - -DESCRIPTION ------------ - -Apache HTTP Server 2.4 available as docker container, is a powerful, efficient, -and extensible web server. Apache supports a variety of features, many implemented as compiled modules -which extend the core functionality. -These can range from server-side programming language support to authentication schemes. -Virtual hosting allows one Apache installation to serve many different Web sites." - - -USAGE ------ - -For this, we will assume that you are using the `rhscl/httpd-24-rhel7` image. -The image can be used as a base image for other applications based on Apache HTTP web server. - -An example of the data on the host for both the examples above, that will be served by -Apache HTTP web server: - -``` -$ ls -lZ /wwwdata/html --rw-r--r--. 1 1001 1001 54321 Jan 01 12:34 index.html --rw-r--r--. 1 1001 1001 5678 Jan 01 12:34 page.html -``` - -If you want to run the image and mount the static pages available in `/wwwdata` on the host -as a docker volume, execute the following command: - -``` -$ docker run -d --name httpd -p 8080:8080 -v /wwwdata:/var/www:Z rhscl/httpd-24-rhel7 -``` - -This will create a container named `httpd` running Apache HTTP Server, serving data from -`/wwwdata` directory. Port 8080 will be exposed and mapped to the host. - -If you want to create a new Docker layered image, use [Source-to-Image](https://github.com/openshift/source-to-image), a tool for building/building artifacts from source and injecting into docker images. To create a new Docker image named `httpd-app` using Source-to-Image, while using data available in `/wwwdata` on the host, execute the following command: - -``` -$ s2i build file:///wwwdata/html rhscl/httpd-24-rhel7 httpd-app -``` - -To run such a new image, execute the following command: - -``` -$ docker run -d --name httpd -p 8080:8080 httpd-app -``` - - -CONFIGURATION -------------- - -The Apache HTTP Server container image supports the following configuration variable, which can be set by using the `-e` option with the docker run command: - -| Variable name | Description | -| :---------------------- | ----------------------------------------- | -| `HTTPD_LOG_TO_VOLUME` | By default, httpd logs into standard output, so the logs are accessible by using the docker logs command. When `HTTPD_LOG_TO_VOLUME` is set, httpd logs into `/var/log/httpd24`, which can be mounted to host system using the Docker volumes. This option is only allowed when container is run as UID 0. | - - -If you want to run the image and mount the log files into `/wwwlogs` on the host -as a docker volume, execute the following command: - -``` -$ docker run -d -u 0 -e HTTPD_LOG_TO_VOLUME=1 --name httpd -v /wwwlogs:/var/log/httpd24:Z rhscl/httpd-24-rhel7 -``` - - -VOLUMES -------- - -You can also set the following mount points by passing the `-v /host:/container` flag to Docker. - -| Volume mount point | Description | -| :----------------------- | ---------------------------------------------------------------------- | -| `/var/www` | Apache HTTP Server data directory | -| `/var/log/httpd24` | Apache HTTP Server log directory (available only when running as root, path `/var/log/httpd` is used in case of Fedora based image) | - -**Notice: When mouting a directory from the host into the container, ensure that the mounted -directory has the appropriate permissions and that the owner and group of the directory -matches the user UID or name which is running inside the container.** - - -DEFAULT USER ------------- - -By default, Apache HTTP Server container runs as UID 1001. That means the volume mounted directories for the files (if mounted using `-v` option) need to be prepared properly, so the UID 1001 can read them. - -To run the container as a different UID, use `-u` option. For example if you want to run the container as UID 1234, execute the following command: - -``` -docker run -d -u 1234 rhscl/httpd-24-rhel7 -``` - -To log into a volume mounted directory, the container needs to be run as UID 0 (see above). - - - -TROUBLESHOOTING ---------------- -The httpd deamon in the container logs to the standard output by default, so the log is available in the container log. The log can be examined by running: - - docker logs - - -SEE ALSO --------- -Dockerfile and other sources for this container image are available on -https://github.com/sclorg/httpd-container. -In that repository, Dockerfile for CentOS is called Dockerfile, Dockerfile -for RHEL is called Dockerfile.rhel7. - diff --git a/root/usr/share/container-scripts/httpd/common.sh b/root/usr/share/container-scripts/httpd/common.sh deleted file mode 100644 index c949287..0000000 --- a/root/usr/share/container-scripts/httpd/common.sh +++ /dev/null @@ -1,63 +0,0 @@ -# Set of functions used in other scripts - -config_general() { - sed -i -e 's/^Listen 80/Listen 0.0.0.0:8080/' ${HTTPD_MAIN_CONF_PATH}/httpd.conf && \ - sed -i -e '151s%AllowOverride None%AllowOverride All%' ${HTTPD_MAIN_CONF_PATH}/httpd.conf && \ - sed -i -e 's/^Listen 443/Listen 0.0.0.0:8443/' ${HTTPD_MAIN_CONF_D_PATH}/ssl.conf -} - -config_log_to_stdout() { - sed -ri " s!^(\s*CustomLog)\s+\S+!\1 |/usr/bin/cat!g; s!^(\s*ErrorLog)\s+\S+!\1 |/usr/bin/cat!g;" ${HTTPD_MAIN_CONF_PATH}/httpd.conf - sed -ri " s!^(\s*CustomLog)\s+\S+!\1 |/usr/bin/cat!g; s!^(\s*TransferLog)\s+\S+!\1 |/usr/bin/cat!g; s!^(\s*ErrorLog)\s+\S+!\1 |/usr/bin/cat!g;" ${HTTPD_MAIN_CONF_D_PATH}/ssl.conf -} - -runs_privileged() { - test "$(id -u)" == "0" - return $? -} - -config_privileged() { - # Change the s2i permissions back to the normal ones - chmod 644 ${HTTPD_MAIN_CONF_PATH}/* && \ - chmod 755 ${HTTPD_MAIN_CONF_PATH} && \ - chmod 644 ${HTTPD_MAIN_CONF_D_PATH}/* && \ - chmod 755 ${HTTPD_MAIN_CONF_D_PATH} && \ - chmod 600 /etc/pki/tls/certs/localhost.crt && \ - chmod 600 /etc/pki/tls/private/localhost.key && \ - chmod 710 ${HTTPD_VAR_RUN} - - if ! [ -v HTTPD_LOG_TO_VOLUME ] ; then - config_log_to_stdout - fi -} - -config_s2i() { - sed -i -e "s%^DocumentRoot \"${HTTPD_DATA_ORIG_PATH}/html\"%DocumentRoot \"${HTTPD_APP_ROOT}/src\"%" ${HTTPD_MAIN_CONF_PATH}/httpd.conf - sed -i -e "s%^> ${HTTPD_MAIN_CONF_PATH}/httpd.conf && \ - head -n151 ${HTTPD_MAIN_CONF_PATH}/httpd.conf | tail -n1 | grep "AllowOverride All" || exit -} - -config_non_privileged() { - sed -i -e "s/^User apache/User default/" ${HTTPD_MAIN_CONF_PATH}/httpd.conf - sed -i -e "s/^Group apache/Group root/" ${HTTPD_MAIN_CONF_PATH}/httpd.conf - config_log_to_stdout - if [ -v HTTPD_LOG_TO_VOLUME ] ; then - echo "Error: Option HTTPD_LOG_TO_VOLUME is only valid for privileged runs (as UID 0)." - return 1 - fi -} - -# Set current user in nss_wrapper -generate_container_user() { - local passwd_output_dir="${HTTPD_APP_ROOT}/etc" - - export USER_ID=$(id -u) - export GROUP_ID=$(id -g) - envsubst < ${HTTPD_CONTAINER_SCRIPTS_PATH}/passwd.template > ${passwd_output_dir}/passwd - export LD_PRELOAD=libnss_wrapper.so - export NSS_WRAPPER_PASSWD=${passwd_output_dir}/passwd - export NSS_WRAPPER_GROUP=/etc/group -} - diff --git a/root/usr/share/container-scripts/httpd/passwd.template b/root/usr/share/container-scripts/httpd/passwd.template deleted file mode 100644 index 7ad0b78..0000000 --- a/root/usr/share/container-scripts/httpd/passwd.template +++ /dev/null @@ -1,15 +0,0 @@ -root:x:0:0:root:/root:/bin/bash -bin:x:1:1:bin:/bin:/sbin/nologin -daemon:x:2:2:daemon:/sbin:/sbin/nologin -adm:x:3:4:adm:/var/adm:/sbin/nologin -lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin -sync:x:5:0:sync:/sbin:/bin/sync -shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown -halt:x:7:0:halt:/sbin:/sbin/halt -mail:x:8:12:mail:/var/spool/mail:/sbin/nologin -operator:x:11:0:operator:/root:/sbin/nologin -games:x:12:100:games:/usr/games:/sbin/nologin -ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin -nobody:x:99:99:Nobody:/:/sbin/nologin -default:x:${USER_ID}:${GROUP_ID}:Default Application User:${HOME}:/sbin/nologin -apache:x:48:48:Apache:/usr/share/httpd:/sbin/nologin diff --git a/s2i/bin/assemble b/s2i/bin/assemble deleted file mode 100755 index 62ecc31..0000000 --- a/s2i/bin/assemble +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash - -set -e - -source ${HTTPD_CONTAINER_SCRIPTS_PATH}/common.sh - -echo "---> Enabling s2i support in httpd24 image" - -config_s2i - -echo "---> Installing application source" -cp -Rf /tmp/src/. ./ - -if [ -d ./httpd-cfg ]; then - echo "---> Copying httpd configuration files..." - if [ "$(ls -A ./httpd-cfg/*.conf)" ]; then - cp -v ./httpd-cfg/*.conf "${HTTPD_CONFIGURATION_PATH}" - rm -rf ./httpd-cfg - fi -else - if [ -d ./cfg ]; then - echo "---> Copying httpd configuration files from deprecated './cfg' directory, use './httpd-cfg' instead..." - if [ "$(ls -A ./cfg/*.conf)" ]; then - cp -v ./cfg/*.conf "${HTTPD_CONFIGURATION_PATH}" - rm -rf ./cfg - fi - fi -fi - -# Fix source directory permissions -fix-permissions ./ diff --git a/s2i/bin/run b/s2i/bin/run deleted file mode 100755 index 2748f34..0000000 --- a/s2i/bin/run +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -source ${HTTPD_CONTAINER_SCRIPTS_PATH}/common.sh - -export HTTPD_RUN_BY_S2I=1 - -run-httpd $@ diff --git a/s2i/bin/usage b/s2i/bin/usage deleted file mode 100755 index 9ace19c..0000000 --- a/s2i/bin/usage +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh - -DISTRO=`cat /etc/*-release | grep ^ID= | grep -Po '".*?"' | tr -d '"'` -NAMESPACE=centos -[[ $DISTRO =~ rhel* ]] && NAMESPACE=rhscl - -cat < output" - if ! run "fgrep -e 'Test Page for the Apache HTTP Server on' output" ; then - cat output - return 1 - fi -} - -function run_default_page_test() { - # Check default page - run "create_container test_default_page" - sleep 2 - cip=$(get_container_ip 'test_default_page') - _check_test_page ${cip} -} - -function run_as_root_test() { - # Try running as root - DOCKER_ARGS="-u 0" - run "create_container test_run_as_root" - DOCKER_ARGS= - sleep 2 - cip=$(get_container_ip 'test_run_as_root') - _check_test_page ${cip} -} - - -function run_log_to_volume_test() { - _run_invalid_log_volume_test - if _container_is_scl ; then - _run_log_to_volume_test old /var/log/httpd24 - else - _run_log_to_volume_test new /var/log/httpd - fi -} - -function _run_log_to_volume_test() { - # Check the HTTP_LOG_TO_VOLUME env variable - local variant=${1} - local volume_dir=${2} - local logs_dir=$(mktemp -d /tmp/httpd-test-volume-XXXXXX) - run "ls -d ${logs_dir} || mkdir ${logs_dir}" 0 'Create log directory' - run "chown -R 1001:1001 ${logs_dir}" - run "chcon -Rvt svirt_sandbox_file_t ${logs_dir}" 0 'Change SELinux context on the log dir' - DOCKER_ARGS="-e HTTPD_LOG_TO_VOLUME=1 -u 0 -v ${logs_dir}:${volume_dir}" - run "create_container test_log_dir_${variant}" - DOCKER_ARGS= - sleep 2 - cip=$(get_container_ip "test_log_dir_${variant}") - run "curl ${cip}:8080 > /dev/null" - ls ${logs_dir} > output - run "grep -e '^access_log$' output" 0 "Checking that file access_log exists" - run "grep -e '^error_log$' output" 0 "Checking that file error_log exists" - run "grep -e '^ssl_access_log$' output" 0 "Checking that file ssl_access_log exists" - run "grep -e '^ssl_error_log$' output" 0 "Checking that file ssl_error_log exists" - run "grep -e '^ssl_request_log$' output" 0 "Checking that file ssl_request_log exists" -} - -function _run_invalid_log_volume_test() { - # Check wrong usage of the HTTP_LOG_TO_VOLUME env variable - DOCKER_ARGS="-e HTTPD_LOG_TO_VOLUME=1 -u 1001" - run "create_container test_log_dir_fail" - DOCKER_ARGS= - sleep 2 - cid=$(get_cid "test_log_dir_fail") - exit_status=$(docker inspect -f '{{.State.ExitCode}}' ${cid}) - run "test $exit_status == 1" 0 "Checking that setting HTTPD_LOG_TO_VOLUME is not allowed if UID is not 0" -} - - -function run_data_volume_test() { - if _container_is_scl ; then - _run_data_volume_test old /opt/rh/httpd24/root/var/www - fi - _run_data_volume_test new /var/www -} - -function _run_data_volume_test() { - local variant=${1} - local volume_dir=${2} - # Test that docker volume for DocumentRoot works - datadir=$(mktemp -d /tmp/httpd-test-data-XXXXXX) - run "mkdir -p ${datadir}/html" 0 'Create document root' - run "echo hello > ${datadir}/html/index.html" - run "chown -R 1001:1001 ${datadir}" - run "chcon -Rvt svirt_sandbox_file_t ${datadir}/" 0 'Change SELinux context on the document root' - DOCKER_ARGS="-v ${datadir}:${volume_dir}" - run "create_container test_doc_root_${variant}" - DOCKER_ARGS= - sleep 2 - cip=$(get_container_ip "test_doc_root_${variant}") - run "curl ${cip}:8080 > output" - run "grep -e '^hello$' output" -} - - -function run_s2i_test() { - # Test s2i use case - # Since we built the candidate image locally, we don't want S2I attempt to pull - # it from Docker hub - s2i_args="--force-pull=false" - run "s2i usage ${s2i_args} ${IMAGE_NAME}" 0 "Testing 's2i usage'" - run "s2i build ${s2i_args} file://${test_dir}/sample-test-app ${IMAGE_NAME} ${IMAGE_NAME}-testapp" 0 "Testing 's2i build'" - DOCKER_ARGS='-u 1000' - create_container testing-app-s2i ${IMAGE_NAME}-testapp - DOCKER_ARGS= - sleep 5 - cip=$(get_container_ip 'testing-app-s2i') - run "curl ${cip}:8080 > output_s2i" - run "fgrep -e 'This is a sample s2i application with static content.' output_s2i" - # 0 "Checking page served by s2i feature" - sleep 2 -} - - -function run_all_tests() { - for test_case in $TEST_LIST; do - : "Running test $test_case" - $test_case - done; -} - - -function cleanup() { - for cidfile in $CIDFILE_DIR/* ; do - CONTAINER=$(cat $cidfile) - - echo "Stopping and removing container $CONTAINER..." - docker stop $CONTAINER - exit_status=$(docker inspect -f '{{.State.ExitCode}}' $CONTAINER) - if [ "$exit_status" != "0" ]; then - echo "Dumping logs for $CONTAINER" - docker logs $CONTAINER - fi - docker rm $CONTAINER - rm $cidfile - echo "Done." - done - if [ "$overall" -eq 0 ] ; then - print_result "pass" "All tests passed." - else - print_result "fail" "Tests failed." - fi - rmdir $CIDFILE_DIR - rm -Rf "$working_dir" - return "$overall" -} -trap cleanup EXIT - - -working_dir=`mktemp -d` -pushd $working_dir > /dev/null || exit 1 - -CIDFILE_DIR=`pwd`/cid_files -mkdir "$CIDFILE_DIR" - -overall=0 - -run "docker inspect $IMAGE_NAME >/dev/null || docker pull $IMAGE_NAME" 0 - - -TEST_LIST="\ -run_default_page_test -run_as_root_test -run_log_to_volume_test -run_data_volume_test -run_s2i_test" - -test $# -eq 1 -a "${1-}" == --list && echo "$TEST_LIST" && exit 0 - -TEST_LIST=${@:-$TEST_LIST} run_all_tests - -popd > /dev/null - -exit "$overall" diff --git a/test/sample-test-app/index.html b/test/sample-test-app/index.html deleted file mode 100644 index 38f417d..0000000 --- a/test/sample-test-app/index.html +++ /dev/null @@ -1 +0,0 @@ -This is a sample s2i application with static content. diff --git a/test/utils.sh b/test/utils.sh deleted file mode 100755 index 525c3e2..0000000 --- a/test/utils.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/env bash - -function print_result { - local RESET='\e[0m' - local RED='\e[0;31m' - local GREEN='\e[0;32m' - local YELLOW='\e[1;33m' - local PASS="${RESET}${GREEN}[PASS]" - local FAIL="${RESET}${RED}[FAIL]" - local WORKING="${RESET}${YELLOW}[....]" - local STATUS="$1" - shift - - if [ "${STATUS}" = pass ]; then - echo -en "${PASS}" - elif [ "${STATUS}" = fail ]; then - echo -en "${FAIL}" - elif [ "${STATUS}" = working ]; then - echo -en "${WORKING}" - else - return - fi - - echo -en " ${@}${RESET}" - echo -} - -function get_status { - if [ "$1" = "$2" ]; then - echo pass - else - echo fail - fi -} - -function run_command { - local cmd="$1" - local expected="${2:-0}" - local msg="${3:-Running command '$cmd'}" - print_result working "$msg" - eval $cmd - local res="$?" - status=`get_status "$res" "$expected"` - print_result "$status" "$msg" - return "$res" -}