Skip to content

ZipNap is a cloud resource management tool that automatically starts and stops various types of instances based on demand.

License

Notifications You must be signed in to change notification settings

mathspace/zipnap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

97 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ZipNap

ZipNap is a smart cloud resource management tool that automatically starts and stops various types of instances based on demand. It acts as a proxy that wakes up sleeping instances when they're needed and puts them back to sleep when idle, helping you save on cloud costs while maintaining availability.

Features

  • Smart Wake-Up: Automatically starts instances when requests arrive
  • HTTP Proxy: Routes HTTP traffic to target instances with health checks
  • TCP Proxy: Routes TCP traffic to target instances
  • Schedule-Based Activation: Wake up instances based on cron schedules
  • GitHub Actions Runner Activation: Starts host on matching GitHub Actions Job with specific labels
  • Idle Shutdown: Automatically stops instances after periods of inactivity
  • Health Monitoring: Continuous health checks with configurable endpoints
  • Waiting Pages: Shows user-friendly waiting pages while instances start up

How It Works

  1. Request Arrives: A request comes in through one of the configured activators (HTTP proxy, schedule, etc.)
  2. Wake Up: If the target instance is stopped, ZipNap starts it automatically
  3. Health Check: Monitors the instance until it's healthy and ready to serve traffic
  4. Proxy Traffic: Routes requests to the healthy instance
  5. Idle Detection: Tracks activity and stops the instance after a configured timeout period
  6. Cost Savings: Instance only runs when needed, reducing cloud costs

Installation

go install github.com/mathspace/zipnap@latest

Or build from source:

git clone https://github.com/mathspace/zipnap.git
cd zipnap
go build -o zipnap

Configuration

Create a zipnap.yaml configuration file:

instances:
  my-app:
    timeout: 5m  # Stop instance after 5 minutes of inactivity
    ec2:
      instance_id: "i-1234567890abcdef0"
    activators:
      web:
        httpproxy:
          listen_host: "0.0.0.0"
          listen_port: 8080
          host_port: 3000
          show_waiting_page_after: 3s
          health_check:
            path: "/health"
            interval: 5s
            status_codes: [200]
      scheduler:
        schedule:
          cron: "0 9 * * 1-5"  # Wake up at 9 AM on weekdays
          keep_awake: 1h # Keep awake for 1 hour after waking up

Usage

Run ZipNap with your configuration:

zipnap -config zipnap.yaml

Example Use Cases

  • Development Environments: Automatically start/stop development instances
  • Batch Processing: Wake up compute instances for scheduled jobs
  • Cost Optimization: Reduce costs for infrequently used applications
  • Demo Applications: Keep demo apps available on-demand without 24/7 costs

About

ZipNap is a cloud resource management tool that automatically starts and stops various types of instances based on demand.

Resources

License

Stars

Watchers

Forks