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

revert influx lib upgrade; Influx smoke test before listening on http port. #307

Merged
merged 4 commits into from
Oct 1, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/deploy-stats-server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: superfly/flyctl-actions/setup-flyctl@master
- run: flyctl deploy stats-server
- run: flyctl deploy stats-server --wait-timeout 1m
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
21 changes: 10 additions & 11 deletions stats-server/Cargo.lock

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

5 changes: 3 additions & 2 deletions stats-server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ authors = ["David Laban <[email protected]>"]
edition = "2021"
publish = false

# Make a new workspace so that we get our own Cargo.lock and target dir for the docker build.
# Make a new workspace so that we get our own Cargo.lock and target dir for the docker build.
[workspace]

[dependencies]
tokio = { version = "1", features = ["rt-multi-thread", "macros"] }
axum = "0.7"
influxrs = { version = "3", features = ["client"] }
# FIXME: revert back to using crates.io once https://github.com/ijagberg/influx/pull/5 is released
influxrs = { git = "https://github.com/alsuren/influxrs", rev = "bc037531ef31e0a19014556120ecdd151427561b" }

[profile.release]
lto = "thin"
1 change: 1 addition & 0 deletions stats-server/fly.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
app = "cargo-quickinstall-stats-server"
kill_signal = "SIGINT"
kill_timeout = 5
deploy.strategy = "bluegreen"

[env]
PORT = "8080"
Expand Down
12 changes: 12 additions & 0 deletions stats-server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,18 @@ fn main() {
.route("/record-install", get(redirect_to_root))
.route("/record-install", post(record_install));

// Smoke test that we can write to influxdb before listening on the socket.
// This is a poor man's startup probe to avoid serving traffic before we can write to influxdb.
INFLUX_CLIENT
.write(
&INFLUX_BUCKET,
&[Measurement::builder("startups")
.field("count", 1)
.build()
.unwrap()],
)
.await
.unwrap();
// ipv6 + ipv6 any addr
let addr = SocketAddr::from(([0, 0, 0, 0, 0, 0, 0, 0], 8080));
let listener = TcpListener::bind(addr).await.unwrap();
Expand Down