Skip to content

Commit 54d080c

Browse files
authored
Merge pull request openshift#7468 from wgordon17/master
[WIP] Migration to OpenShift v3 hosting
2 parents 7400ec4 + 6f323c2 commit 54d080c

13 files changed

+1588
-209
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,6 @@ dev_guide/builds/images/chained-build.png
99
dev_guide/builds/images/chained-build.png.cache
1010
.DS_Store
1111
.venv
12+
.gem
13+
bin
14+
commercial_package

.s2i/bin/assemble

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
#!/bin/bash -e
2+
# The assemble script builds the application artifacts from source and
3+
# places them into appropriate directories inside the image.
4+
5+
# `gem install` is required because `bundle install` does not properly place `asciibinder` into $PATH
6+
echo "---> Installing AsciiBinder ..."
7+
gem install ascii_binder
8+
9+
# Move git repository to local working directory
10+
shopt -s dotglob
11+
echo "---> Installing application source ..."
12+
mv /tmp/src/* ./
13+
14+
# Fetch and locally add all remote branches to ensure AsciiBinder is able to build the necessary branches
15+
echo "---> Fetching remote branches"
16+
# Because the s2i builder only makes the remote branch applicable to the specified branch,
17+
# it's necessary to enforce a * ref so that all branches are referenced
18+
sed -i 's%fetch = +refs.*%fetch = +refs/heads/*:refs/remotes/origin/*%' .git/config
19+
git fetch --all --quiet
20+
for remote in $(git branch -r | egrep -v "(>|$(git rev-parse --abbrev-ref HEAD))|master"); do git checkout --track $remote; done
21+
git checkout master
22+
23+
# Fixes incompatible character encodings: US-ASCII and UTF-8 error
24+
export LANG="en_US.UTF-8"
25+
26+
echo "---> AsciiBinder packaging commercial content ..."
27+
# AsciiBinder uses git to some extent and requires `user.email` to be properly set
28+
git config user.email "[email protected]"
29+
# Properly package assets
30+
asciibinder package --site=commercial
31+
mkdir commercial_package
32+
mv _package/commercial commercial_package
33+
git checkout master
34+
mkdir commercial_package/commercial/httpd-cfg
35+
mv .s2i/httpd-cfg/01-commercial.conf commercial_package/commercial/httpd-cfg
36+
mv 404-commercial.html commercial_package/commercial/404.html
37+
38+
echo "---> Installing Minishift content ..."
39+
mkdir minishift
40+
cd minishift
41+
if wget http://artifacts.ci.centos.org/minishift/minishift/docs/latest/minishift-adoc.tar ; then
42+
tar -xvf minishift-adoc.tar --strip 1
43+
cat _topic_map.yml >> ../_topic_map.yml
44+
rm minishift-adoc.tar
45+
cd ..
46+
git add .
47+
git commit -am "Minishift build-time commit"
48+
else
49+
echo "WARNING: Could not retrieve minishift-adoc.tar"
50+
cd ..
51+
rmdir minishift
52+
fi
53+
54+
echo "---> AsciiBinder packaging community content ..."
55+
asciibinder package --site=community
56+
mkdir community_package
57+
mv _package/community community_package
58+
git checkout master
59+
mkdir community_package/community/httpd-cfg
60+
mv .s2i/httpd-cfg/01-community.conf community_package/community/httpd-cfg
61+
mv 404-community.html community_package/community/404.html
62+
63+
# Fix source directory permissions
64+
echo "---> Fixing permissions ..."
65+
fix-permissions ./

.s2i/httpd-cfg/01-commercial.conf

+270
Large diffs are not rendered by default.

.s2i/httpd-cfg/01-community.conf

+215
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,215 @@
1+
# ----------------------------------------------------------------------
2+
# Better website experience for IE users
3+
# ----------------------------------------------------------------------
4+
5+
# Force the latest IE version, in various cases when it may fall back to IE7 mode
6+
# github.com/rails/rails/commit/123eb25#commitcomment-118920
7+
# Use ChromeFrame if it's installed for a better experience for the poor IE folk
8+
9+
<IfModule mod_headers.c>
10+
Header set X-UA-Compatible "IE=Edge,chrome=1"
11+
# mod_headers can't match by content-type, but we don't want to send this header on *everything*...
12+
<FilesMatch "\.(js|css|gif|png|jpe?g|pdf|xml|oga|ogg|m4a|ogv|mp4|m4v|webm|svg|svgz|eot|ttf|otf|woff|woff2|ico|webp|appcache|manifest|htc|crx|oex|xpi|safariextz|vcf)$" >
13+
Header unset X-UA-Compatible
14+
</FilesMatch>
15+
</IfModule>
16+
17+
# ----------------------------------------------------------------------
18+
# Proper MIME type for all files
19+
# ----------------------------------------------------------------------
20+
21+
# JavaScript
22+
# Normalize to standard type (it's sniffed in IE anyways)
23+
# tools.ietf.org/html/rfc4329#section-7.2
24+
AddType application/javascript js jsonp
25+
AddType application/json json
26+
27+
# Audio
28+
AddType audio/ogg oga ogg
29+
AddType audio/mp4 m4a f4a f4b
30+
31+
# Video
32+
AddType video/ogg ogv
33+
AddType video/mp4 mp4 m4v f4v f4p
34+
AddType video/webm webm
35+
AddType video/x-flv flv
36+
37+
# SVG
38+
# Required for svg webfonts on iPad
39+
# twitter.com/FontSquirrel/status/14855840545
40+
AddType image/svg+xml svg svgz
41+
AddEncoding gzip svgz
42+
43+
# Webfonts
44+
AddType application/vnd.ms-fontobject eot
45+
AddType application/x-font-ttf ttf ttc
46+
AddType font/opentype otf
47+
AddType application/x-font-woff woff
48+
AddType application/font-woff2 woff2
49+
50+
# Assorted types
51+
AddType image/x-icon ico
52+
AddType image/webp webp
53+
AddType text/cache-manifest appcache manifest
54+
AddType text/x-component htc
55+
AddType application/xml rss atom xml rdf
56+
AddType application/x-chrome-extension crx
57+
AddType application/x-opera-extension oex
58+
AddType application/x-xpinstall xpi
59+
AddType application/octet-stream safariextz
60+
AddType application/x-web-app-manifest+json webapp
61+
AddType text/x-vcard vcf
62+
AddType application/x-shockwave-flash swf
63+
AddType text/vtt vtt
64+
65+
66+
# ----------------------------------------------------------------------
67+
# Gzip compression
68+
# ----------------------------------------------------------------------
69+
70+
<IfModule mod_deflate.c>
71+
# Force deflate for mangled headers developer.yahoo.com/blogs/ydn/posts/2010/12/pushing-beyond-gzipping/
72+
<IfModule mod_setenvif.c>
73+
<IfModule mod_headers.c>
74+
SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding
75+
RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding
76+
</IfModule>
77+
</IfModule>
78+
79+
# Compress all output labeled with one of the following MIME-types
80+
<IfModule mod_filter.c>
81+
AddOutputFilterByType DEFLATE application/atom+xml \
82+
application/javascript \
83+
application/json \
84+
application/rss+xml \
85+
application/vnd.ms-fontobject \
86+
application/x-font-ttf \
87+
application/xhtml+xml \
88+
application/xml \
89+
font/opentype \
90+
image/svg+xml \
91+
image/x-icon \
92+
text/css \
93+
text/html \
94+
text/plain \
95+
text/x-component \
96+
text/xml
97+
</IfModule>
98+
</IfModule>
99+
100+
# ----------------------------------------------------------------------
101+
# Start rewrite engine
102+
# ----------------------------------------------------------------------
103+
104+
# Turning on the rewrite engine is necessary for the following rules and
105+
# features. FollowSymLinks must be enabled for this to work.
106+
107+
# Some cloud hosting services require RewriteBase to be set: goo.gl/HOcPN
108+
# If using the h5bp in a subdirectory, use `RewriteBase /foo` instead where
109+
# 'foo' is your directory.
110+
111+
# If your web host doesn't allow the FollowSymlinks option, you may need to
112+
# comment it out and use `Options +SymLinksOfOwnerMatch`, but be aware of the
113+
# performance impact: http://goo.gl/Mluzd
114+
115+
<IfModule mod_rewrite.c>
116+
<Directory "${HOME}">
117+
118+
Options Indexes FollowSymLinks
119+
AllowOverride All
120+
Order Allow,Deny
121+
Allow from All
122+
123+
RewriteEngine On
124+
RewriteBase /
125+
126+
# Redirects for "latest" version
127+
RewriteRule ^origin-m4/?$ /latest/ [R=301]
128+
129+
# Welcome page redirects
130+
RewriteRule ^(latest|[0-9.]+)/?$ /$1/welcome/index.html [L,R=301]
131+
132+
# Overview page has moved to Index page
133+
RewriteRule ^(.*)/overview\.html(.*)$ /$1/index.html$2 [L,R=301]
134+
135+
# Developers console redirect
136+
RewriteRule ^(latest|[0-9.]+)/getting_started/developers/developers_console\.html(.*)$ /$1/getting_started/developers_console.html$2 [L,R=301]
137+
138+
# Deployments redirect
139+
RewriteRule ^(latest|[0-9.]+)/dev_guide/deployments\.html(.*)$ /$1/dev_guide/deployments/how_deployments_work.html$2 [L,R=301]
140+
141+
# Builds redirect
142+
RewriteRule ^(latest|[0-9.]+)/dev_guide/builds\.html(.*)$ /$1/dev_guide/builds/index.html$2 [L,R=301]
143+
144+
# Other specific redirects
145+
RewriteRule ^latest/admin_guide/build_defaults_overrides\.html(.*)$ /latest/install_config/build_defaults_overrides.html$1 [L,R=301]
146+
RewriteRule ^latest/admin_guide/install/(advanced_install|deploy_router|docker_registry|first_steps|overview|prerequisites|quick_install|upgrades)\.html(.*)$ /latest/install_config/install/$1.html$2 [R=301]
147+
RewriteRule ^(latest|[0-9.]+)/admin_guide/upgrades\.html(.*) /$1/install_config/upgrades.html$2 [R=301]
148+
RewriteRule ^(latest|[0-9.]+)/admin_guide/(aggregate_logging|cluster_metrics|configuring_authentication|configuring_aws|configuring_gce|configuring_openstack|http_proxies|master_node_configuration|native_container_routing|routing_from_edge_lb|syncing_groups_with_ldap|web_console_customization)\.html(.*)$ /$1/install_config/$2.html$3 [R=301]
149+
RewriteRule ^(latest|[0-9.]+)/admin_guide/persistent_storage/(persistent_storage_aws|persistent_storage_cinder|persistent_storage_gce|persistent_storage_glusterfs|persistent_storage_nfs)\.html(.*)$ /$1/install_config/persistent_storage/$2.html$3 [R=301]
150+
RewriteRule ^latest/admin_guide/selfprovisioned_projects\.html(.*)$ /$1/$2/admin_guide/managing_projects.html$3 [R=301]
151+
RewriteRule ^latest/install_config/upgrades\.html(.*)$ /latest/install_config/upgrading/index.html$1 [R=301]
152+
153+
</Directory>
154+
</IfModule>
155+
156+
# ----------------------------------------------------------------------
157+
# Prevent 404 errors for non-existing redirected folders
158+
# ----------------------------------------------------------------------
159+
160+
# without -MultiViews, Apache will give a 404 for a rewrite if a folder of the
161+
# same name does not exist.
162+
# webmasterworld.com/apache/3808792.htm
163+
164+
Options -MultiViews
165+
166+
# ----------------------------------------------------------------------
167+
# Custom 404 page
168+
# ----------------------------------------------------------------------
169+
170+
# You can add custom pages to handle 500 or 403 pretty easily, if you like.
171+
# If you are hosting your site in subdirectory, adjust this accordingly
172+
# e.g. ErrorDocument 404 /subdir/404.html
173+
ErrorDocument 404 /404.html
174+
175+
176+
# ----------------------------------------------------------------------
177+
# UTF-8 encoding
178+
# ----------------------------------------------------------------------
179+
180+
# Use UTF-8 encoding for anything served text/plain or text/html
181+
AddDefaultCharset utf-8
182+
183+
# Force UTF-8 for a number of file formats
184+
AddCharset utf-8 .atom .css .js .json .rss .vtt .xml
185+
186+
187+
# ----------------------------------------------------------------------
188+
# A little more security
189+
# ----------------------------------------------------------------------
190+
191+
# "-Indexes" will have Apache block users from browsing folders without a
192+
# default document Usually you should leave this activated, because you
193+
# shouldn't allow everybody to surf through every folder on your server (which
194+
# includes rather private places like CMS system folders).
195+
<IfModule mod_autoindex.c>
196+
Options -Indexes
197+
</IfModule>
198+
199+
# Block access to "hidden" directories or files whose names begin with a
200+
# period. This includes directories used by version control systems such as
201+
# Subversion or Git.
202+
<IfModule mod_rewrite.c>
203+
RewriteCond %{SCRIPT_FILENAME} -d [OR]
204+
RewriteCond %{SCRIPT_FILENAME} -f
205+
RewriteRule "(^|/)\." - [F]
206+
</IfModule>
207+
208+
# Block access to backup and source files. These files may be left by some
209+
# text/html editors and pose a great security danger, when anyone can access
210+
# them.
211+
<FilesMatch "(\.(bak|config|sql|fla|psd|ini|log|sh|inc|swp|dist)|~)$">
212+
Order allow,deny
213+
Deny from all
214+
Satisfy All
215+
</FilesMatch>

0 commit comments

Comments
 (0)