Skip to content

Commit 76ad533

Browse files
authored
Merge pull request #143 from ruby-no-kai/quick-reference
Serve /#{year} and /#{year+1} automatically
2 parents daf0883 + aad064c commit 76ad533

File tree

2 files changed

+69
-2
lines changed

2 files changed

+69
-2
lines changed

README.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,62 @@ nginx container deployed on AWS App Runner and served through CloudFront.
44

55
Detailed docs for RubyKaigi orgz: https://rubykaigi.esa.io/posts/1241
66

7+
## Quick Reference
8+
9+
### Add regional.rubykaigi.org subdirectory
10+
11+
1. Prepare GitHub Pages. No need to configure custom domain.
12+
2. Write the following configuration to [./config/nginx.conf.erb](./config/nginx.conf.erb). Replace path, ORG_NAME and REPO_NAME with the actual value accordingly.
13+
14+
Add a new location block right before `regional.rubykaigi.org` location. Leave other parts as is.
15+
16+
```nginx
17+
# ...
18+
19+
location /penacony42 {
20+
include force_https.conf;
21+
include github_pages.conf;
22+
proxy_redirect https://ORG_NAME.github.io/REPO_NAME $map_request_proto://$http_host/REPO_NAME;
23+
proxy_pass https://ORG_NAME.github.io;
24+
}
25+
26+
# regional.rubykaigi.org
27+
location / {
28+
# ...
29+
}
30+
```
31+
32+
3. Submit a PR and wait for review.
33+
34+
__Cache:__ With the above configuration, our CDN respects GitHub Pages cache headers. As of Nov 2025, it is currently set to 10 minutes for everything. Contact RubyKaigi admins if you need immediate cache invalidation. We recommend to enable asset file hashing to avoid cache issues.
35+
36+
### Switch _the year_ of rubykaigi.org
37+
38+
Change the following values to the desired year. This will update `/` to redirect to the new year's website (`/YYYY/`), and serve `/#{year}` and `/#{year+1}` from the [rubykaigi.org repo](https://github.com/ruby-no-kai/rubykaigi.org). Make sure `#{year-1}` is switched to the archive beforehand.
39+
40+
- `current_year` value in [./config/nginx.conf.erb](./config/nginx.conf.erb)
41+
- `latest_year` value in [./spec/rubykaigi_org_spec.rb](./spec/rubykaigi_org_spec.rb)
42+
43+
You'll need to invalidate CloudFront cache of root page `/` after deploy.
44+
45+
### Archive old rubykaigi.org year
46+
47+
Update `# RubyKaigi Archives` location path regex accordingly in [./config/nginx.conf.erb](./config/nginx.conf.erb).
48+
49+
```nginx
50+
# RubyKaigi Archives
51+
location ~ ^/202[2-5] {
52+
include force_https.conf;
53+
# ...
54+
```
55+
56+
You'll need to invalidate CloudFront cache of the archived year `/YYYY` after deploy.
57+
58+
59+
----
60+
61+
If you're going to do something more than the above, continue reading. Don't forget to write tests for new functionailities.
62+
763
## Deploy
864

965
Deployments are automatically performed on GitHub Actions on `master` branch after CI.

config/nginx.conf.erb

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<% jump_host = ENV.fetch('JUMP_HOST', 'jump.rko-router.invalid') %>
33
<% platform = ENV.fetch("RKO_ROUTER_PLATFORM", "heroku") %>
44
<% stdout = platform == 'heroku' ? 'logs/nginx/access.log' : '/dev/stdout' %>
5-
<% current_year = '2026' %>
5+
<% current_year = 2026 %>
66

77
<% if platform == 'heroku' %>
88
daemon off;
@@ -558,6 +558,7 @@ http {
558558
proxy_pass https://2009-2011.rubykaigi.org;
559559
}
560560

561+
# RubyKaigi Archives
561562
location ~ ^/202[2-5] {
562563
include force_https.conf;
563564
include github_pages.conf;
@@ -567,7 +568,8 @@ http {
567568
proxy_pass https://2009-2011.rubykaigi.org;
568569
}
569570

570-
location /2026 {
571+
# Current year
572+
location /<%= current_year %> {
571573
include force_https.conf;
572574
include github_pages.conf;
573575
proxy_hide_header Cache-Control;
@@ -576,6 +578,15 @@ http {
576578
proxy_pass https://gh-pages.rubykaigi.org;
577579
}
578580

581+
# Next year
582+
location /<%= current_year + 1 %> {
583+
include force_https.conf;
584+
include github_pages.conf;
585+
proxy_hide_header Cache-Control;
586+
proxy_hide_header Expires;
587+
add_header Cache-Control "$implied_cache_control";
588+
proxy_pass https://gh-pages.rubykaigi.org;
589+
}
579590

580591
# current rubykaigi
581592
location = / {

0 commit comments

Comments
 (0)