Skip to content

Commit c77b8eb

Browse files
committed
Add jruby.org nginx config and "nginx" task for deploying changes
1 parent fd2f41f commit c77b8eb

5 files changed

Lines changed: 177 additions & 1 deletion

File tree

Gemfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,6 @@ gem "mojombo-jekyll"
66
gem "rack", "1.0.0"
77
gem "aws-s3"
88
gem "request-log-analyzer"
9+
platforms :jruby do
10+
gem "jruby-openssl"
11+
end

Gemfile.lock

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,19 @@ GEM
33
remote: http://rubygems.org/
44
specs:
55
RedCloth (4.2.3)
6+
RedCloth (4.2.3-java)
67
aws-s3 (0.6.2)
78
builder
89
mime-types
910
xml-simple
11+
bouncy-castle-java (1.5.0145.2)
1012
builder (2.1.2)
1113
classifier (1.3.3)
1214
fast-stemmer (>= 1.0.0)
1315
directory_watcher (1.3.2)
1416
fast-stemmer (1.0.0)
17+
jruby-openssl (0.7.1)
18+
bouncy-castle-java
1519
liquid (2.2.2)
1620
maruku (0.6.0)
1721
syntax (>= 1.0.0)
@@ -25,15 +29,17 @@ GEM
2529
open4 (>= 0.9.6)
2630
open4 (1.0.1)
2731
rack (1.0.0)
28-
request-log-analyzer (1.9.0)
32+
request-log-analyzer (1.9.3)
2933
syntax (1.0.0)
3034
xml-simple (1.0.12)
3135

3236
PLATFORMS
37+
java
3338
ruby
3439

3540
DEPENDENCIES
3641
aws-s3
42+
jruby-openssl
3743
mojombo-jekyll
3844
rack (= 1.0.0)
3945
request-log-analyzer

Rakefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ task :deploy => :generate do
2626
sh "tar -C _site/ -zcf - . | ssh deploy@jruby.org 'cd /data/jruby.org && tar zxf -'"
2727
end
2828

29+
desc "Deploy Nginx config changes"
30+
task :nginx do
31+
sh "tar -C conf/ -zcf - . | ssh deploy@jruby.org 'cd /etc/nginx/servers && sudo tar zxf - && sudo /etc/init.d/nginx reload'"
32+
end
33+
2934
task :default do
3035
puts "JRuby.org documentation site. Available tasks:"
3136
Rake.application.options.show_tasks = true

conf/hudson.conf

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
2+
upstream hudson_upstream {
3+
server 127.0.0.1:8080;
4+
}
5+
6+
server {
7+
listen 80;
8+
9+
server_name ci.jruby.org;
10+
11+
root /data/hello_world/current/public;
12+
13+
access_log /var/log/engineyard/nginx/hudson.access.log main;
14+
15+
error_log /var/log/engineyard/nginx/hudson.error.log notice;
16+
# error_log /dev/null notice;
17+
18+
include /etc/nginx/common/servers.conf;
19+
20+
location /snapshots {
21+
alias /builds/jobs/jruby-dist/lastSuccessful/archive/dist;
22+
autoindex on;
23+
}
24+
25+
location / {
26+
# auth is disabled for this server
27+
# auth_basic "Restricted";
28+
# auth_basic_user_file /etc/nginx/servers/hello_world.users;
29+
30+
include /etc/nginx/common/proxy.conf;
31+
32+
if (!-f $request_filename) {
33+
proxy_pass http://hudson_upstream;
34+
break;
35+
}
36+
}
37+
38+
location = /500.html {
39+
root /data/hello_world/current/public;
40+
}
41+
}

conf/jruby.conf

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
server {
2+
listen 80;
3+
4+
server_name jruby.org;
5+
6+
root /data/jruby.org;
7+
8+
access_log /var/log/engineyard/nginx/jruby.access.log main;
9+
error_log /var/log/engineyard/nginx/jruby.error.log notice;
10+
11+
include /etc/nginx/common/servers.conf;
12+
13+
location /repo/ {
14+
alias /home/git/repositories/;
15+
16+
set $repo "";
17+
if ($request_uri ~ ^/repo/([^/]+)\.git/) {
18+
set $repo $1.git;
19+
}
20+
if ($repo = "") {
21+
return 404;
22+
}
23+
if (!-f /home/git/repositories/$repo/git-daemon-export-ok) {
24+
return 404;
25+
}
26+
}
27+
28+
location /git {
29+
fastcgi_pass 127.0.0.1:7000;
30+
31+
fastcgi_param SCRIPT_FILENAME $fastcgi_script_name;
32+
fastcgi_param QUERY_STRING $query_string;
33+
34+
fastcgi_param REQUEST_METHOD $request_method;
35+
fastcgi_param CONTENT_TYPE $content_type;
36+
fastcgi_param CONTENT_LENGTH $content_length;
37+
fastcgi_param REQUEST_URI $request_uri;
38+
fastcgi_param DOCUMENT_URI $document_uri;
39+
fastcgi_param DOCUMENT_ROOT $document_root;
40+
fastcgi_param SERVER_PROTOCOL $server_protocol;
41+
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
42+
fastcgi_param SERVER_SOFTWARE nginx;
43+
fastcgi_param REMOTE_ADDR $remote_addr;
44+
fastcgi_param REMOTE_PORT $remote_port;
45+
fastcgi_param SERVER_ADDR $server_addr;
46+
fastcgi_param SERVER_PORT $server_port;
47+
fastcgi_param SERVER_NAME $server_name;
48+
}
49+
50+
location /apidocs {
51+
include /etc/nginx/common/proxy.conf;
52+
53+
if ($request_uri ~ ^/apidocs$) {
54+
rewrite ^/apidocs$ /apidocs/ redirect;
55+
}
56+
57+
if (!-f $request_filename) {
58+
rewrite ^/apidocs/(.*)$ /job/jruby-dist/javadoc/$1;
59+
proxy_pass http://hudson_upstream;
60+
break;
61+
}
62+
}
63+
64+
location / {
65+
if ($http_accept ~* application/x-thor-template) {
66+
rewrite ^/$ /rails3.rb break;
67+
}
68+
index index.html;
69+
if (-f $request_filename) {
70+
break;
71+
}
72+
if (-f $request_filename.html) {
73+
rewrite ^(.+)$ $1.html last;
74+
}
75+
}
76+
}
77+
78+
server {
79+
listen 80;
80+
81+
server_name wiki.jruby.org;
82+
83+
root /data/hello_world/current/public;
84+
85+
access_log /var/log/engineyard/nginx/jruby.access.log main;
86+
error_log /var/log/engineyard/nginx/jruby.error.log notice;
87+
88+
include /etc/nginx/common/servers.conf;
89+
90+
location / {
91+
set $id '';
92+
if ($uri = '/') {
93+
set $id Home;
94+
}
95+
rewrite ([^/]*)$ http://kenai.com/projects/jruby/pages/$1$id?nav=off;
96+
}
97+
}
98+
99+
server {
100+
listen 80;
101+
102+
server_name bugs.jruby.org;
103+
104+
root /data/hello_world/current/public;
105+
106+
access_log /var/log/engineyard/nginx/jruby.access.log main;
107+
error_log /var/log/engineyard/nginx/jruby.error.log notice;
108+
109+
include /etc/nginx/common/servers.conf;
110+
111+
location / {
112+
set $id '';
113+
if ($uri ~* JRUBY-([0-9]+)) {
114+
set $id -$1;
115+
}
116+
if ($uri ~ ([0-9]+)) {
117+
set $id -$1;
118+
}
119+
rewrite ^ http://jira.codehaus.org/browse/JRUBY$id;
120+
}
121+
}

0 commit comments

Comments
 (0)