diff options
author | Holger Weiss <holger@zedat.fu-berlin.de> | 2013-10-04 22:56:26 (GMT) |
---|---|---|
committer | Holger Weiss <holger@zedat.fu-berlin.de> | 2013-10-04 22:56:26 (GMT) |
commit | 84c4a5d24cbef536b8248a3d8ff72bb2b4248c29 (patch) | |
tree | aa5eaf24f84315ea5fa143bf287c9fcf7857391f | |
parent | 45d3e695be499cf9f9956c223883073fc20d48b4 (diff) | |
download | site-84c4a5d24cbef536b8248a3d8ff72bb2b4248c29.tar.gz |
Add test instance of the web site
Serve https://www.nagios-plugins.org:444/ from the "test" branch of this
repository.
-rwxr-xr-x | bin/build-web-site | 41 | ||||
-rwxr-xr-x | bin/git-export | 27 | ||||
-rw-r--r-- | etc/nginx/site.conf | 9 | ||||
-rwxr-xr-x | libexec/post-receive.d/01-git-export | 22 | ||||
-rwxr-xr-x | libexec/post-receive.d/04-build-web-site | 46 | ||||
-rw-r--r-- | web/input/development.md (renamed from web/content/development.md) | 0 | ||||
-rw-r--r-- | web/input/doc/extra-opts.md (renamed from web/content/doc/extra-opts.md) | 0 | ||||
-rw-r--r-- | web/input/doc/faq/index.md (renamed from web/content/doc/faq/index.md) | 0 | ||||
-rw-r--r-- | web/input/doc/index.md (renamed from web/content/doc/index.md) | 0 | ||||
-rw-r--r-- | web/input/doc/man/index.md (renamed from web/content/doc/man/index.md) | 0 | ||||
l--------- | web/input/doc/news.txt (renamed from web/content/doc/news.txt) | 0 | ||||
-rw-r--r-- | web/input/doc/presentation.md (renamed from web/content/doc/presentation.md) | 0 | ||||
-rw-r--r-- | web/input/doc/release-notes/1-5.md (renamed from web/content/doc/release-notes/1-5.md) | 0 | ||||
-rw-r--r-- | web/input/download.md (renamed from web/content/download.md) | 0 | ||||
-rw-r--r-- | web/input/impressum.md (renamed from web/content/impressum.md) | 0 | ||||
-rw-r--r-- | web/input/index.md (renamed from web/content/index.md) | 0 | ||||
-rw-r--r-- | web/input/media/favicon.ico (renamed from web/content/media/favicon.ico) | bin | 4286 -> 4286 bytes | |||
-rw-r--r-- | web/input/media/github.png (renamed from web/content/media/github.png) | bin | 7927 -> 7927 bytes | |||
-rw-r--r-- | web/input/media/plugins.css (renamed from web/content/media/plugins.css) | 0 | ||||
-rw-r--r-- | web/input/support.md (renamed from web/content/support.md) | 0 | ||||
-rw-r--r-- | web/input/team.md (renamed from web/content/team.md) | 0 | ||||
-rw-r--r-- | web/input/tests.md (renamed from web/content/tests.md) | 0 |
22 files changed, 110 insertions, 35 deletions
diff --git a/bin/build-web-site b/bin/build-web-site index 95ac355..9886b7a 100755 --- a/bin/build-web-site +++ b/bin/build-web-site | |||
@@ -16,31 +16,42 @@ set -e | |||
16 | set -u | 16 | set -u |
17 | 17 | ||
18 | prefix='/home/plugins' | 18 | prefix='/home/plugins' |
19 | poole_dir="$prefix/web/generator" | 19 | |
20 | site_source_dir="$prefix/exported/site/web/content" | 20 | export PATH="$prefix/src/poole:/usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin" |
21 | site_target_dir="$poole_dir/input" | 21 | |
22 | myself=${0##*/} | ||
22 | man_source_dir="$prefix/web/work/man" | 23 | man_source_dir="$prefix/web/work/man" |
23 | man_target_dir="$site_target_dir/doc/man" | ||
24 | guidelines_source="$prefix/web/work/guidelines.html" | 24 | guidelines_source="$prefix/web/work/guidelines.html" |
25 | guidelines_target="$site_target_dir/doc/guidelines.html" | 25 | site_target_dir=$(mktemp -d "/tmp/$myself.XXXXXX") |
26 | man_target_dir="$site_target_dir/input/doc/man" | ||
27 | guidelines_target="$site_target_dir/input/doc/guidelines.html" | ||
26 | 28 | ||
27 | export PATH="$prefix/src/poole:/usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin" | 29 | trap 'rm -rf "$site_target_dir"' EXIT |
30 | |||
31 | if [ $# -gt 0 ] && [ "$1" = '-t' ] | ||
32 | then # Build test instance. | ||
33 | site_source_dir="$prefix/exported/site-test/web" | ||
34 | output_dir="$prefix/web/test" | ||
35 | else | ||
36 | site_source_dir="$prefix/exported/site/web" | ||
37 | output_dir="$prefix/web/site" | ||
38 | fi | ||
28 | 39 | ||
29 | # | 40 | # |
30 | # Collect the pieces of the site. | 41 | # Collect the pieces of the site, and create a link to the output directory. |
31 | # | 42 | # |
32 | rsync -aH --delete "$site_source_dir/" "$site_target_dir" | 43 | rsync -aH "$site_source_dir/" "$site_target_dir" |
33 | rsync -aH "$man_source_dir/" "$man_target_dir" | 44 | rsync -aH "$man_source_dir/" "$man_target_dir" |
34 | cp -p "$guidelines_source" "$guidelines_target" | 45 | cp -p "$guidelines_source" "$guidelines_target" |
35 | 46 | ln -s "$output_dir" "$site_target_dir/output" | |
36 | cd "$poole_dir" | ||
37 | 47 | ||
38 | # | 48 | # |
39 | # See http://pythonhosted.org/Markdown/extensions/ for documentation on the | 49 | # See http://pythonhosted.org/Markdown/extensions/ for documentation on the |
40 | # extensions. | 50 | # extensions. |
41 | # | 51 | # |
42 | exec poole.py --build \ | 52 | poole.py --build \ |
43 | --md-ext='extra' \ | 53 | --md-ext='extra' \ |
44 | --md-ext='headerid' \ | 54 | --md-ext='headerid' \ |
45 | --md-ext='toc' \ | 55 | --md-ext='toc' \ |
46 | --md-ext='wikilinks' | 56 | --md-ext='wikilinks' \ |
57 | "$site_target_dir" | ||
diff --git a/bin/git-export b/bin/git-export index fc76081..06d832a 100755 --- a/bin/git-export +++ b/bin/git-export | |||
@@ -18,23 +18,38 @@ set -u | |||
18 | export PATH='/usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin' | 18 | export PATH='/usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin' |
19 | 19 | ||
20 | export_prefix='/home/plugins/exported' | 20 | export_prefix='/home/plugins/exported' |
21 | export_branch='master' | ||
22 | myself=${0##*/} | 21 | myself=${0##*/} |
23 | 22 | ||
24 | if [ $# -lt 1 ] | 23 | usage() |
25 | then | 24 | { |
26 | echo >&2 "Usage: $myself <repository> ..." | 25 | echo >&2 "Usage: $myself [-b <branch>] <repository> ..." |
27 | exit 2 | 26 | exit 2 |
28 | fi | 27 | } |
28 | |||
29 | while getopts b: option | ||
30 | do | ||
31 | case $option in | ||
32 | b) | ||
33 | branch=$OPTARG | ||
34 | ;; | ||
35 | *) | ||
36 | usage | ||
37 | ;; | ||
38 | esac | ||
39 | done | ||
40 | |||
41 | shift $((OPTIND - 1)) | ||
42 | test $# -ge 1 || usage | ||
29 | 43 | ||
30 | for repository in "$@" | 44 | for repository in "$@" |
31 | do | 45 | do |
32 | export_dir="$export_prefix/${repository##*/}" | 46 | export_dir="$export_prefix/${repository##*/}" |
33 | export_dir=${export_dir%.git} | 47 | export_dir=${export_dir%.git} |
48 | export_dir="$export_dir${branch:+-$branch}" | ||
34 | 49 | ||
35 | cd "$repository" | 50 | cd "$repository" |
36 | rm -r -f "$export_dir" | 51 | rm -r -f "$export_dir" |
37 | mkdir -p "$export_dir" | 52 | mkdir -p "$export_dir" |
38 | git archive "$export_branch" | tar -x -C "$export_dir" -f - | 53 | git archive "${branch:-master}" | tar -x -C "$export_dir" -f - |
39 | cd "$OLDPWD" | 54 | cd "$OLDPWD" |
40 | done | 55 | done |
diff --git a/etc/nginx/site.conf b/etc/nginx/site.conf index 432c051..9105591 100644 --- a/etc/nginx/site.conf +++ b/etc/nginx/site.conf | |||
@@ -14,8 +14,9 @@ | |||
14 | # | 14 | # |
15 | server { | 15 | server { |
16 | listen 443 ssl; | 16 | listen 443 ssl; |
17 | listen 444 ssl; | ||
17 | server_name www.nagios-plugins.org; | 18 | server_name www.nagios-plugins.org; |
18 | root /home/plugins/web/site; | 19 | root /home/plugins/web/port-$server_port; |
19 | 20 | ||
20 | # | 21 | # |
21 | # Downloads and attachments. | 22 | # Downloads and attachments. |
@@ -71,9 +72,15 @@ server { | |||
71 | 72 | ||
72 | # | 73 | # |
73 | # Redirect HTTP and all other domains to <https://www.nagios-plugins.org/>. | 74 | # Redirect HTTP and all other domains to <https://www.nagios-plugins.org/>. |
75 | # Ditto for the test instance. | ||
74 | # | 76 | # |
75 | server { | 77 | server { |
76 | listen 80 default_server; | 78 | listen 80 default_server; |
77 | listen 443 default_server ssl; | 79 | listen 443 default_server ssl; |
78 | return 301 https://www.nagios-plugins.org$request_uri; | 80 | return 301 https://www.nagios-plugins.org$request_uri; |
79 | } | 81 | } |
82 | server { | ||
83 | listen 81 default_server; | ||
84 | listen 444 default_server ssl; | ||
85 | return 301 https://www.nagios-plugins.org:444$request_uri; | ||
86 | } | ||
diff --git a/libexec/post-receive.d/01-git-export b/libexec/post-receive.d/01-git-export index 37994e2..171f05f 100755 --- a/libexec/post-receive.d/01-git-export +++ b/libexec/post-receive.d/01-git-export | |||
@@ -19,4 +19,26 @@ export PATH='/usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin' | |||
19 | 19 | ||
20 | prefix='/home/plugins' | 20 | prefix='/home/plugins' |
21 | 21 | ||
22 | # | ||
23 | # Check whether the "test" branch of the "site.git" repository has been updated. | ||
24 | # | ||
25 | if [ "${PWD##*/}" = 'site.git' ] | ||
26 | then | ||
27 | forty_zeros=$(printf '%.40d' '0') | ||
28 | |||
29 | while read old new ref | ||
30 | do | ||
31 | if [ "$ref" = 'refs/heads/test' ] | ||
32 | then | ||
33 | if [ "$new" != "$forty_zeros" ] | ||
34 | then | ||
35 | "$prefix/bin/git-export" -b 'test' "$PWD" | ||
36 | else | ||
37 | rm -rf "$prefix/exported/site-test" | ||
38 | fi | ||
39 | break | ||
40 | fi | ||
41 | done | ||
42 | fi | ||
43 | |||
22 | exec "$prefix/bin/git-export" "$PWD" | 44 | exec "$prefix/bin/git-export" "$PWD" |
diff --git a/libexec/post-receive.d/04-build-web-site b/libexec/post-receive.d/04-build-web-site index 7c178cf..6338968 100755 --- a/libexec/post-receive.d/04-build-web-site +++ b/libexec/post-receive.d/04-build-web-site | |||
@@ -19,17 +19,37 @@ export PATH='/usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin' | |||
19 | 19 | ||
20 | prefix='/home/plugins' | 20 | prefix='/home/plugins' |
21 | repository=${PWD##*/} | 21 | repository=${PWD##*/} |
22 | web_repositories='nagios-plugins.git site.git' | 22 | plugins_repository='nagios-plugins.git' |
23 | web_branch='master' | 23 | web_repository='site.git' |
24 | prod_branch='master' | ||
25 | test_branch='test' | ||
26 | test_directory="$prefix/web/test" | ||
24 | 27 | ||
25 | for web_repository in $web_repositories | 28 | if [ "$repository" = "$plugins_repository" ] \ |
26 | do | 29 | || [ "$repository" = "$web_repository" ] |
27 | if [ "$repository" = "$web_repository" ] | 30 | then |
28 | then | 31 | forty_zeros=$(printf '%.40d' '0') |
29 | while read old new ref | 32 | |
30 | do | 33 | while read old new ref |
31 | test "${ref#refs/heads/}" = "$web_branch" \ | 34 | do |
32 | && exec "$prefix/bin/build-web-site" >'/dev/null' | 35 | branch=${ref#refs/heads/} |
33 | done | 36 | |
34 | fi | 37 | if [ "$branch" = "$prod_branch" ] |
35 | done | 38 | then |
39 | "$prefix/bin/build-web-site" >'/dev/null' | ||
40 | elif [ "$repository" = "$web_repository" ] \ | ||
41 | && [ "$branch" = "$test_branch" ] | ||
42 | then | ||
43 | if [ "$new" != "$forty_zeros" ] | ||
44 | then | ||
45 | "$prefix/bin/build-web-site" -t >'/dev/null' | ||
46 | else | ||
47 | rm -rf "$test_directory"/* | ||
48 | fi | ||
49 | cat >>"$test_directory/robots.txt" <<-'EOF' | ||
50 | User-agent: * | ||
51 | Disallow: / | ||
52 | EOF | ||
53 | fi | ||
54 | done | ||
55 | fi | ||
diff --git a/web/content/development.md b/web/input/development.md index ddff634..ddff634 100644 --- a/web/content/development.md +++ b/web/input/development.md | |||
diff --git a/web/content/doc/extra-opts.md b/web/input/doc/extra-opts.md index 542c199..542c199 100644 --- a/web/content/doc/extra-opts.md +++ b/web/input/doc/extra-opts.md | |||
diff --git a/web/content/doc/faq/index.md b/web/input/doc/faq/index.md index 18584f2..18584f2 100644 --- a/web/content/doc/faq/index.md +++ b/web/input/doc/faq/index.md | |||
diff --git a/web/content/doc/index.md b/web/input/doc/index.md index 7b2d098..7b2d098 100644 --- a/web/content/doc/index.md +++ b/web/input/doc/index.md | |||
diff --git a/web/content/doc/man/index.md b/web/input/doc/man/index.md index d3c60c8..d3c60c8 100644 --- a/web/content/doc/man/index.md +++ b/web/input/doc/man/index.md | |||
diff --git a/web/content/doc/news.txt b/web/input/doc/news.txt index f5208d5..f5208d5 120000 --- a/web/content/doc/news.txt +++ b/web/input/doc/news.txt | |||
diff --git a/web/content/doc/presentation.md b/web/input/doc/presentation.md index 458b101..458b101 100644 --- a/web/content/doc/presentation.md +++ b/web/input/doc/presentation.md | |||
diff --git a/web/content/doc/release-notes/1-5.md b/web/input/doc/release-notes/1-5.md index b8f3457..b8f3457 100644 --- a/web/content/doc/release-notes/1-5.md +++ b/web/input/doc/release-notes/1-5.md | |||
diff --git a/web/content/download.md b/web/input/download.md index 4d46cf5..4d46cf5 100644 --- a/web/content/download.md +++ b/web/input/download.md | |||
diff --git a/web/content/impressum.md b/web/input/impressum.md index 1fba23b..1fba23b 100644 --- a/web/content/impressum.md +++ b/web/input/impressum.md | |||
diff --git a/web/content/index.md b/web/input/index.md index 8ab186c..8ab186c 100644 --- a/web/content/index.md +++ b/web/input/index.md | |||
diff --git a/web/content/media/favicon.ico b/web/input/media/favicon.ico index 76ae569..76ae569 100644 --- a/web/content/media/favicon.ico +++ b/web/input/media/favicon.ico | |||
Binary files differ | |||
diff --git a/web/content/media/github.png b/web/input/media/github.png index 1e19c21..1e19c21 100644 --- a/web/content/media/github.png +++ b/web/input/media/github.png | |||
Binary files differ | |||
diff --git a/web/content/media/plugins.css b/web/input/media/plugins.css index 552284f..552284f 100644 --- a/web/content/media/plugins.css +++ b/web/input/media/plugins.css | |||
diff --git a/web/content/support.md b/web/input/support.md index c6d8b3d..c6d8b3d 100644 --- a/web/content/support.md +++ b/web/input/support.md | |||
diff --git a/web/content/team.md b/web/input/team.md index f9b0a5d..f9b0a5d 100644 --- a/web/content/team.md +++ b/web/input/team.md | |||
diff --git a/web/content/tests.md b/web/input/tests.md index bad78a9..bad78a9 100644 --- a/web/content/tests.md +++ b/web/input/tests.md | |||