waitup
A modern, feature-rich CLI tool for waiting until TCP ports, HTTP endpoints, and services become available. Perfect for Docker, Kubernetes, CI/CD pipelines, and microservices orchestration.
Why choose waitup?
- DNS Resolution: Supports both hostnames and IP addresses
- Multiple Targets: Wait for multiple services with flexible strategies
- HTTP Health Checks: Full HTTP/HTTPS support with custom headers and status codes
- Rich Output: JSON output, progress indicators, and verbose logging
- Container Ready: Minimal Docker images and Kubernetes examples
- High Performance: Written in Rust for speed and reliability
- Library Support: Use as a Rust library in your applications
Features
- DNS Resolution: Supports both hostnames and IP addresses
- Multiple Targets: Wait for multiple services with
--anyor--allstrategies - Command Execution: Run commands after successful connections
- Progress Indicators: Verbose mode with progress bars and attempt counters
- HTTP Health Checks: Support for HTTP/HTTPS endpoints with status code validation
- Exponential Backoff: Smart retry strategy with configurable intervals
- Type Safety: Built with Rust for reliability and performance
- Environment Variables: Configure defaults via environment
- Optimized: Small binary size with release optimizations
Installation
From Crates.io (Recommended)
Docker
# Pull from GitHub Container Registry (recommended)
# Or use the Alpine build (smaller)
# Build from source using Docker
# Or build the Alpine variant from source
Pre-built Binaries
Download from GitHub Releases
From Source
Shell Completions
Generate completion scripts for your shell:
# Bash
# Zsh
# Fish
Usage
Basic TCP Connection
# Wait for a service to be ready
# With timeout and custom interval
DNS Resolution
# Works with hostnames
Multiple Targets
# Wait for all services (default)
# Wait for any service to be ready
HTTP Health Checks
# HTTP endpoint health check
# Custom status code expectation
# With custom headers (authentication, etc.)
Command Execution
# Run command after successful connection
# Multiple services before command
Progress and Verbose Output
# Verbose mode with progress information
# Quiet mode (no output)
# JSON output for CI/CD integration
Exponential Backoff
# Custom backoff configuration
Environment Variables
Configure defaults using environment variables:
Exit Codes
0: Success - all targets are reachable1: Timeout - failed to connect within timeout period2: Invalid arguments or configuration3: Command execution failed (when using--syntax)
Examples
Docker Compose
services:
app:
image: myapp
depends_on:
- db
command:
db:
image: postgres
Kubernetes Init Container
initContainers:
- name: waitup-db
image: waitup:latest
command:
CI/CD Pipeline
# Wait for test database before running tests
Microservices Health Check
# Wait for multiple dependencies
Time Format
Supports human-readable durations:
30s- 30 seconds2m- 2 minutes1h30m- 1 hour 30 minutes500ms- 500 milliseconds
Development
- Fork the repository
- Create a feature branch
- Run tests:
cargo test - Submit a pull request
Advanced Features
Retry Limits and Timeouts
# Limit retry attempts
# Custom connection timeout per attempt
JSON Output for Automation
# Perfect for CI/CD pipelines
|
# Example JSON output:
{
{
}
}
Library Usage
Add to your Cargo.toml:
[]
= "1.0"
Use in your Rust code:
use ;
use Duration;
async
Docker Usage
As a Kubernetes Init Container
apiVersion: v1
kind: Pod
spec:
initContainers:
- name: waitup-deps
image: waitup:alpine
command:
args:
containers:
- name: app
image: myapp:latest
In Docker Compose
version: "3.8"
services:
app:
image: myapp:latest
depends_on:
db-ready:
condition: service_completed_successfully
db-ready:
image: waitup:alpine
command:
depends_on:
- postgres
postgres:
image: postgres:15
Comparison with Alternatives
| Feature | waitup | waitup-it | dockerize | wait-on |
|---|---|---|---|---|
| Language | Rust | Bash | Go | Node.js |
| HTTP Support | ✅ | ❌ | ✅ | ✅ |
| Custom Headers | ✅ | ❌ | ❌ | ❌ |
| JSON Output | ✅ | ❌ | ❌ | ❌ |
| Multiple Strategies | ✅ | ❌ | ❌ | ✅ |
| DNS Resolution | ✅ | ✅ | ✅ | ✅ |
| Binary Size | ~6MB | N/A | ~8MB | N/A |
| Shell Completions | ✅ | ❌ | ❌ | ❌ |
| Library Support | ✅ | ❌ | ❌ | ❌ |
Configuration Options
| Option | Environment Variable | Description |
|---|---|---|
--timeout |
WAITUP_TIMEOUT |
Total timeout (default: 30s) |
--interval |
WAITUP_INTERVAL |
Initial retry interval (default: 1s) |
--max-interval |
- | Maximum retry interval (default: 30s) |
--connection-timeout |
- | Per-attempt timeout (default: 10s) |
--retry-limit |
- | Maximum retry attempts |
--expect-status |
- | Expected HTTP status (default: 200) |
FAQ
Q: Why not just use nc or telnet?
A: waitup provides proper error handling, exponential backoff, multiple targets, HTTP health checks, and structured output that makes it ideal for production deployments.
Q: Does it work with IPv6? A: Yes! waitup supports both IPv4 and IPv6 through Rust's standard networking stack.
Q: Can I use it to wait for services that require authentication?
A: Yes, use custom headers: --header "Authorization:Bearer token"
Q: How does it compare to Kubernetes readiness probes? A: waitup is perfect for init containers and external dependency checking, while readiness probes are for the service itself.
Contributing
We welcome contributions! Please see CONTRIBUTING.md for details.
Performance
- Startup time: ~5ms
- Memory usage: ~2MB RSS
- Binary size: 6MB (standard), 10MB (Alpine)
- Concurrent connections: Efficiently handles 100+ targets
Security
waitup follows security best practices:
- Runs as non-root user in containers
- No sensitive data logging
- Minimal attack surface
- Regularly updated dependencies
See SECURITY.md for vulnerability reporting.
License
MIT License - see LICENSE file for details.
Acknowledgments
- Inspired by waitup-it and dockerize
- Built with Rust and Tokio
- Thanks to all contributors!