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

Implement healthcheck endpoint for Lightsail #8

Merged
merged 4 commits into from
Apr 1, 2024
Merged

Conversation

junlarsen
Copy link
Member

Could maybe use a proper http framework, but we just need to return a valid http message for AWS Lightsail recognize a healthy service.

Maybe in the future we can actually health-check the Slack websocket connection in this?

Copy link
Contributor

@joleeee joleeee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could also consider pulling in something like warp and just doing

#[tokio::main]
async fn main() {
    // GET /hello/warp => 200 OK with body "Hello, warp!"
    let hello = warp::path!("hello" / String)
        .map(|name| format!("Hello, {}!", name));

    warp::serve(hello)
        .run(([127, 0, 0, 1], 3030))
        .await;
}

src/healthcheck.rs Show resolved Hide resolved
src/healthcheck.rs Outdated Show resolved Hide resolved
src/healthcheck.rs Outdated Show resolved Hide resolved
.await
.expect("Failed to start HTTP server");
});
futures::future::join_all(vec![app_handle, http_handle]).await;
Copy link
Contributor

@joleeee joleeee Apr 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also i think its very possible for the app to crash but this will wait forever for the http server to also stop, so perhaps not the best health check

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah it's not really a good healthcheck, but Lightsail just needs a http endpoint on the service

@junlarsen junlarsen requested a review from joleeee April 1, 2024 17:53
@junlarsen
Copy link
Member Author

@junlarsen junlarsen merged commit 09630ef into main Apr 1, 2024
2 checks passed
@junlarsen junlarsen deleted the feat/healthcheck branch April 1, 2024 18:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants