Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup Game Server PR Announcer #39

Merged
merged 6 commits into from
Feb 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 35 additions & 16 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable-small";
dragon-bot.url = "github:tgstation/dragon-bot";
tgstation-server.url = "github:tgstation/tgstation-server/e7d2a23450a7cb00e0b2bb87dc0815fec04d1855?dir=build/package/nix";
tgstation-pr-announcer.url = "github:tgstation/tgstation/c1ceeb35edfe1f72e9ed362a451ffd5bae9d2ede?dir=tools/Tgstation.PRAnnouncer";
tgstation-website.url = "github:tgstation-operations/website-v2";
impermanence.url = "github:scriptis/impermanence";
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
Expand Down
2 changes: 2 additions & 0 deletions systems/game-servers/secrets/secrets.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ in {
"rsc-cdn.age".publicKeys = users ++ systems ++ [wiggle];
# /tg/station13 main server secrets
"tg13-dbconfig.age".publicKeys = users ++ systems ++ [wiggle];
# The comms key in here is also used in the PR announcer
# If you change it here change it there as well
"tg13-comms.age".publicKeys = users ++ systems ++ [wiggle];
"tg13-tts_secrets.age".publicKeys = users ++ systems ++ [wiggle];
"tg13-webhooks.age".publicKeys = users ++ systems ++ [wiggle];
Expand Down
12 changes: 12 additions & 0 deletions systems/game-servers/systems/tgsatan/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
(import hw.common-gpu-nvidia)
(import hw.common-cpu-amd)
self.inputs.tgstation-server.nixosModules.default
self.inputs.tgstation-pr-announcer.nixosModules.default
];
localModules = [
../../../../modules/fail2ban.nix
Expand Down Expand Up @@ -114,6 +115,17 @@ in {
wants = ["mysql.service"];
};

age.secrets.tgstation-pr-announcer = {
file = ./secrets/tgstation-pr-announcer.age;
owner = "${config.services.tgstation-pr-announcer.username}";
group = "${config.services.tgstation-pr-announcer.groupname}";
};
services.tgstation-pr-announcer = {
enable = true;
production-appsettings = ./tgstation-pr-announcer/tgstation_pr_announcer_config.json;
environmentFile = config.age.secrets.tgstation-pr-announcer.path;
};

services.grafana = {
enable = true;
settings = {
Expand Down
15 changes: 14 additions & 1 deletion systems/game-servers/systems/tgsatan/modules/caddy/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,20 @@
useACMEHost = "tgs.tgsatan.us.tgstation13.org";
extraConfig = ''
encode gzip zstd
reverse_proxy localhost:5000
reverse_proxy localhost:5000 {
health_uri /health
health_port 5000
}
'';
};
"github_webhooks.tgstation13.org" = {
useACMEHost = "github_webhooks.tgstation13.org";
extraConfig = ''
encode gzip zstd
reverse_proxy localhost:5004 {
health_uri /health
health_port 5004
}
'';
};
"s3.tgstation13.org" = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
}: let
systemdPromPort = toString config.services.prometheus.exporters.systemd.port;
nodeExporterPort = toString config.services.prometheus.exporters.node.port;
# Needs moved into a common config
tgsPromPort = "5001";
prAnnouncerPort = "5004";
# The following is already a string, so no need to convert it
haproxyPromPort = config.systemd.services.haproxy.environment.PROMETHEUS_PORT;
in {
Expand Down Expand Up @@ -81,6 +83,16 @@ in {
}
];
}
{
job_name = "GitHub Webhook PR Announcer";
static_configs = [
{
targets = [
"tgsatan.tg.lan:${prAnnouncerPort}"
];
}
];
}
{
job_name = "systemd relay node";
static_configs = [
Expand Down
4 changes: 4 additions & 0 deletions systems/game-servers/systems/tgsatan/secrets/secrets.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ in {
"cloudflared-pem.age".publicKeys = users ++ systems;
# Tgstation website api key
"tgstation-web-apikey.age".publicKeys = users ++ systems;
# TGS PR Announcer
# The same value is used in game-servers/secrets/tg13-comms.age
# TODO: Move to a shared secret (somehow)
"tgstation-pr-announcer.age".publicKeys = users ++ systems;
# AWS Route 53 DNS-01
"aws_credentials.age".publicKeys = users ++ systems;
# Atticd
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"Settings": {
"GameServerHealthCheckSeconds": 30,
"Servers": [
{
"Address": "blockmoths.tg.lan",
"Port": 3336,
"InterestedRepoSlugs": [
"tgstation/tgstation"
]
},
{
"Address": "localhost",
"Port": 1337,
"InterestedRepoSlugs": [
"tgstation/tgstation"
]
},
{
"Address": "localhost",
"Port": 1447,
"InterestedRepoSlugs": [
"tgstation/tgstation"
]
},
{
"Address": "localhost",
"Port": 5337,
"InterestedRepoSlugs": [
"tgstation/TerraGov-Marine-Corps"
]
}
]
},
"Kestrel": {
"Endpoints": {
"Http": {
"Url": "http://0.0.0.0:5004"
}
}
}
}