Skip to content

Commit

Permalink
redirect config and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
mbund committed Feb 8, 2025
1 parent 4e4df17 commit 84d0ec1
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@

This is a log of important decisions made to the infrastructure, reasoning why a decision was made, and why other options were not chosen. Minor changes, like deploying an extra container, do not necessarily need to be a part of the decisions log. However, changes to the _way_ the infrastructure works should be documented here for future generations.

### 2025-02-05: Traefik for redirects

Use Traefik docker labels for redirects. That is, all subdomains should redirect to [osucyber.club](https://osucyber.club) if they are no used by anything else. Also, certain subdomains like [discord.osucyber.club](https://discord.osucyber.club) should go to a Discord invite link. An alternative (which was used before) was to have an API Gateway in front of a Lambda function which handles redirects. However, this introduces more complexity and adds more resources added to Terraform. Using Traefik is more since we already have it, and it requires only a small amount of configuration.

First introduced in [77d1d881](https://github.com/cscosu/infra2/commit/77d1d8816cf29184120fc5c5df5193bd379b3052).

### 2025-02-02: Minimize root disk space

Use minimal AMI instead of ECS optimized AMI. The ECS optimized AMI requires a minimum of a 30GB root volume, however we really only need a 4GB root volume. At $0.08/GB/month, this means $2.08/instance/month saved. The ECS agent cleans up old images every 30 minutes by default ([docs](https://github.com/aws/amazon-ecs-agent/blob/0f876b5372c9ecb15228f607f11d2c4be629d364/README.md#L206)), so there is little reason to worry about running out of storage. Additionally, it is easy to change the root storage if needed by just modifying the Terraform. This comes at a maintenance cost of additional user data script to install the required agents, though this should be just copy/paste.
Expand Down
20 changes: 16 additions & 4 deletions traefik.tf
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,22 @@ resource "aws_ecs_task_definition" "traefik" {
"traefik.http.middlewares.redirect-to-main.redirectregex.regex" = ".*"
"traefik.http.middlewares.redirect-to-main.redirectregex.replacement" = "https://osucyber.club"

"traefik.http.routers.discord.rule" = "Host(`discord.testing.osucyber.club`)"
"traefik.http.routers.discord.middlewares" = "redirect-discord"
"traefik.http.middlewares.redirect-discord.redirectregex.regex" = ".*"
"traefik.http.middlewares.redirect-discord.redirectregex.replacement" = "https://discord.com"
"traefik.http.routers.discord.rule" = "Host(`discord.testing.osucyber.club`)"
"traefik.http.routers.discord.middlewares" = "redirect-discord"
"traefik.http.middlewares.redirect-discord.redirectregex.regex" = ".*"
"traefik.http.middlewares.redirect-discord.redirectregex.replacement" = "https://discord.gg/x4VgQBTBCp"
"traefik.http.routers.zoom.rule" = "Host(`zoom.testing.osucyber.club`)"
"traefik.http.routers.zoom.middlewares" = "redirect-zoom"
"traefik.http.middlewares.redirect-zoom.redirectregex.regex" = ".*"
"traefik.http.middlewares.redirect-zoom.redirectregex.replacement" = "https://osu.zoom.us/j/94385413286?pwd=L2pHUEc0blZqV0Erc3pNeWxRTW4vUT09"
"traefik.http.routers.mailinglist.rule" = "Host(`mailinglist.testing.osucyber.club`)"
"traefik.http.routers.mailinglist.middlewares" = "redirect-mailinglist"
"traefik.http.middlewares.redirect-mailinglist.redirectregex.regex" = ".*"
"traefik.http.middlewares.redirect-mailinglist.redirectregex.replacement" = "https://eepurl.com/c0qMHn"
"traefik.http.routers.attend.rule" = "Host(`attend.testing.osucyber.club`)"
"traefik.http.routers.attend.middlewares" = "redirect-attend"
"traefik.http.middlewares.redirect-attend.redirectregex.regex" = ".*"
"traefik.http.middlewares.redirect-attend.redirectregex.replacement" = "https://auth.osucyber.club"
}

logConfiguration = {
Expand Down

0 comments on commit 84d0ec1

Please sign in to comment.