Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ctronp/healthcheck
Placeholder for health checks in AWS NLB services. Responds with `HTTP 200 OK` to any request, ideal for testing or initial configurations without additional logic.
https://github.com/ctronp/healthcheck
aws axum docker graceful-shutdown healthcheck http microservices nlb rust server
Last synced: 12 days ago
JSON representation
Placeholder for health checks in AWS NLB services. Responds with `HTTP 200 OK` to any request, ideal for testing or initial configurations without additional logic.
- Host: GitHub
- URL: https://github.com/ctronp/healthcheck
- Owner: ctronp
- License: mit
- Created: 2024-11-24T18:11:19.000Z (2 months ago)
- Default Branch: main
- Last Pushed: 2024-12-10T01:55:07.000Z (about 2 months ago)
- Last Synced: 2024-12-10T02:32:26.667Z (about 2 months ago)
- Topics: aws, axum, docker, graceful-shutdown, healthcheck, http, microservices, nlb, rust, server
- Language: Rust
- Homepage:
- Size: 8.79 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Healthcheck Service
A lightweight and customizable healthcheck service built with Rust and Axum. It supports multiple ports and paths
configured through environment variables, making it ideal for scenarios requiring dynamic health checks, such as AWS
Network Load Balancer (NLB) integrations.## Features
- Responds with `HTTP 200 OK` to any configured path.
- Supports multiple ports and paths defined via environment variables.
- Graceful shutdown on receiving a termination signal (e.g., `Ctrl+C`).
- Logs incoming requests to the console.## Configuration
The service uses environment variables to configure its behavior:
### Environment Variables
- `PORT` or `PORTS`: Comma-separated list of ports to listen on. Example: `PORTS=8080,8081`.
- `HEALTHCHECK` or `HEALTHCHECK_PATH`: Comma-separated list of healthcheck paths. Example:
`HEALTHCHECK_PATH=/health,/status`.### Example
```dotenv
PORT=8080,8081
HEALTHCHECK=/health,/status```
## Build and Run
### Prerequisites
- Rust toolchain
- Docker (optional for containerized deployment)### Build Locally
1. Clone the repository:
```bash
git clone
cd```
2. Build the binary:
```bash
cargo build --release
```
3. Run the binary:
```bash
PORT=8080 HEALTHCHECK=/health ./target/release/healthcheck
```
### Run with Docker
1. Build the Docker image:
```bash
docker build -t healthcheck-service .
```
2. Run the container:
```bash
docker run -e PORT=8080,8081 -e HEALTHCHECK=/health -p 8080:8080 -p 8081:8081 healthcheck-service
```
## Project Structure
- **`src/main.rs`**: Main application logic, including router setup and graceful shutdown.
- **`Dockerfile`**: Multi-stage build for an optimized container image.
- **`Cargo.toml`**: Dependency and configuration file for Rust.## License
This project is licensed under the [MIT License](LICENSE).