Skip to content

ruby-no-kai/rko-router

Folders and files

NameName
Last commit message
Last commit date

Latest commit

4823a83 · Feb 9, 2025
Dec 8, 2023
Feb 9, 2025
Nov 15, 2024
Nov 1, 2024
Jun 6, 2018
Sep 18, 2022
Sep 18, 2022
Sep 18, 2022
Nov 1, 2024
Sep 18, 2022
Jun 6, 2018
Sep 16, 2022
Jun 21, 2021
Jan 26, 2014
Feb 21, 2023
Jan 29, 2014
Sep 16, 2022

Repository files navigation

rubykaigi.org router

nginx container deployed on AWS App Runner and served through CloudFront.

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

Deploy

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

All resources except App Runner deployment is managed under Terraform (./tf).

Domains

Due to the quota of custom domains per App Runner service, the first hop on rko-router proxies a request to itself with correct Host header.

x-rko-host and x-rko-xfp headers are referenced as a Host and X-Forwarded-Proto header for the second hop.

These custom headers are assigned at CloudFront function (viewer-request) and implementation is at ./tf/cf_functions/src/viewreq.ts.

Run locally

docker build -t rko-router:latest .
docker run --rm --name rko-router --publish 127.0.0.1::8080 rko-router:latest
curl -H Host:rubykaigi.org http://$(docker port rko-router 8080)/
TARGET_HOST=http://$(docker port rko-router 8080) bundle exec rspec

Test

Test against production:

bundle exec rspec -fd ./spec

Test against alternate deployment:

bundle exec env TARGET_HOST=https://rko-router.herokuapp.com rspec -fd ./spec

AWS Login

https://rubykaigi.esa.io/posts/813