Skip to content

Commit e61e9dc

Browse files
committedApr 6, 2017
Support an httpd 2.4 based runtime image
1 parent 722fec3 commit e61e9dc

File tree

4 files changed

+76
-12
lines changed

4 files changed

+76
-12
lines changed
 

‎.s2i/bin/assemble

+31-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,35 @@
11
#!/bin/bash
2-
/usr/libexec/s2i/assemble
3-
rc=$?
2+
# Based on https://github.com/sclorg/httpd-container/blob/master/2.4/s2i/bin/assemble
43

5-
if [ $rc -eq 0 ]; then
6-
bower install
7-
rc=$?
4+
set -e
5+
6+
echo "---> Enabling s2i support in httpd24 image"
7+
8+
sed -i -f /opt/app-root/httpdconf.sed /opt/rh/httpd24/root/etc/httpd/conf/httpd.conf && \
9+
sed -i -f /opt/app-root/sslconf.sed /opt/rh/httpd24/root/etc/httpd/conf.d/ssl.conf && \
10+
echo 'IncludeOptional /opt/app-root/etc/httpd.d/*.conf' >> /opt/rh/httpd24/root/etc/httpd/conf/httpd.conf && \
11+
head -n151 /opt/rh/httpd24/root/etc/httpd/conf/httpd.conf | tail -n1 | grep "AllowOverride All" || exit
12+
sed -ri ' s!^(\s*CustomLog)\s+\S+!\1 |/usr/bin/cat!g; s!^(\s*ErrorLog)\s+\S+!\1 |/usr/bin/cat!g;' /opt/rh/httpd24/root/etc/httpd/conf/httpd.conf
13+
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;' /opt/rh/httpd24/root/etc/httpd/conf.d/ssl.conf
14+
15+
echo "---> Installing application source"
16+
cp -Rf /tmp/src/dist/. ./
17+
cp -Rf /tmp/src/dist.java/. ./
18+
19+
if [ -d /tmp/src/httpd-cfg ]; then
20+
echo "---> Copying httpd configuration files..."
21+
if [ "$(ls -A /tmp/src/httpd-cfg/*.conf)" ]; then
22+
cp -v /tmp/src/httpd-cfg/*.conf "${HTTPD_CONFIGURATION_PATH}"
23+
fi
24+
fi
25+
26+
if [ -d /tmp/src/tls ]; then
27+
echo "---> Copying tls files..."
28+
if [ "$(ls -A /tmp/src/tls/*.*)" ]; then
29+
mkdir -p "${HTTPD_CONFIGURATION_PATH}/tls"
30+
cp -v /tmp/src/tls/*.* "${HTTPD_CONFIGURATION_PATH}/tls"
31+
fi
832
fi
933

10-
exit $rc
34+
# Fix source directory permissions
35+
fix-permissions ./

‎.s2i/bin/run

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
#!/bin/bash
22

3-
if [ -f /origin-web-console-config/config.js ]; then
4-
cp -f /origin-web-console-config/config.js app/config.js
3+
if [ -f /openshift-web-console-config/config.js ]; then
4+
cp -f /openshift-web-console-config/config.js config.js
55
else
6-
echo "No config.js is mounted, using default development config."
6+
echo "No config.js is mounted, the console can not run without a configuration defined."
7+
exit -1
78
fi
89

9-
CONSOLE_CONTEXT_ROOT="${CONSOLE_CONTEXT_ROOT:-"dev-console"}"
10-
11-
grunt serve --hostname=0.0.0.0 --contextRoot=${CONSOLE_CONTEXT_ROOT} --disable-live-reload
10+
exec /usr/libexec/s2i/run

‎httpd-cfg/openshift-web-console.conf

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# SSL configuration
2+
Listen 0.0.0.0:8443
3+
<VirtualHost *:8443>
4+
SSLEngine on
5+
SSLCertificateFile "${HTTPD_CONFIGURATION_PATH}/tls/tls.crt"
6+
SSLCertificateKeyFile "${HTTPD_CONFIGURATION_PATH}/tls/tls.key"
7+
8+
RewriteEngine on
9+
# First strip the context root
10+
RewriteRule ^${OSC_CONTEXT_ROOT}(.*) /$1
11+
RewriteRule ^/java$ ${OSC_ASSET_PUBLIC_URL}java/ [R,L]
12+
RewriteCond %{DOCUMENT_ROOT}/java/$1 !-f
13+
RewriteRule ^/java/(.*)$ /java/index.html [L,PT]
14+
RewriteCond %{DOCUMENT_ROOT}/$1 !-f
15+
RewriteRule (.*) /index.html [L,PT]
16+
</VirtualHost>
17+
<VirtualHost *:8080>
18+
# TODO check the context root and paths are correctly maintained
19+
Redirect permanent "/" "${OSC_ASSET_PUBLIC_URL}"
20+
</VirtualHost>
21+
22+
FileETag MTime Size
23+
# Have to strip the gzip off the incoming ETag for cache control to work correctly
24+
# https://bz.apache.org/bugzilla/show_bug.cgi?id=45023
25+
RequestHeader edit "If-None-Match" "^\"(.*)-gzip\"$" "\"$1\""
26+
Header set Cache-Control "public, max-age=0, must-revalidate"
27+
SetOutputFilter DEFLATE
28+
29+
<Location "/index.html">
30+
AddOutputFilterByType SUBSTITUTE text/html
31+
Substitute "s|<base href=\"/\">|<base href=\"${OSC_CONTEXT_ROOT}\">|i"
32+
</Location>
33+
<Location "/java/index.html">
34+
AddOutputFilterByType SUBSTITUTE text/html
35+
Substitute "s|<base href=\"/\">|<base href=\"${OSC_CONTEXT_ROOT}java/\">|i"
36+
</Location>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Adds some additional dependencies to the nodejs S2I builder so that the console integration tests
2+
# can be run against any openshift console (server must have auth set to AllowAllPasswordIdentityProvider)
3+
FROM centos/httpd-24-centos7
4+
USER 1001

0 commit comments

Comments
 (0)
Please sign in to comment.