-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(clusters): static endpoint for gg nodes
- Loading branch information
1 parent
d6d05f6
commit 1f6de98
Showing
11 changed files
with
121 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
svc/pkg/cluster/worker/src/workers/server_install/install_scripts/components/mod.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
use indoc::indoc; | ||
|
||
pub mod nomad; | ||
pub mod ok_server; | ||
pub mod rivet; | ||
pub mod s3; | ||
pub mod traefik; | ||
|
13 changes: 13 additions & 0 deletions
13
svc/pkg/cluster/worker/src/workers/server_install/install_scripts/components/ok_server.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
pub const OK_SERVER_PORT: usize = 9999; | ||
|
||
pub fn install(initialize_immediately: bool) -> String { | ||
let mut script = include_str!("../files/ok_server.sh") | ||
.replace("__OK_SERVER_PORT__", &OK_SERVER_PORT.to_string()); | ||
|
||
if initialize_immediately { | ||
// Run script immediately | ||
script.push_str("systemctl start --no-block ok_server.service"); | ||
} | ||
|
||
script | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
svc/pkg/cluster/worker/src/workers/server_install/install_scripts/files/ok_server.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Write script | ||
cat << 'EOF' > /usr/bin/ok_server.sh | ||
#!/bin/bash | ||
set -e | ||
trap "exit" INT | ||
while true; do | ||
{ echo -e 'HTTP/1.1 200 OK\r\n\r\n'; } | nc -l -p __OK_SERVER_PORT__ -q 0; | ||
done | ||
EOF | ||
|
||
chmod +x /usr/bin/ok_server.sh | ||
|
||
# Create systemd service file | ||
cat << 'EOF' > /etc/systemd/system/ok_server.service | ||
[Unit] | ||
Description=Rivet Ok Server | ||
Requires=network-online.target | ||
After=network-online.target | ||
[Service] | ||
User=root | ||
Group=root | ||
Type=oneshot | ||
ExecStart=/usr/bin/ok_server.sh | ||
Type=simple | ||
[Install] | ||
WantedBy=multi-user.target | ||
EOF | ||
|
||
systemctl daemon-reload | ||
systemctl enable ok_server.service |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters