Skip to content

A service to monitor servers and keep 'em alive, such as repl.it projects.

License

Notifications You must be signed in to change notification settings

madhavarshney/keepalive-service

Repository files navigation

Keepalive Service

A tool to monitor servers and keep 'em alive by periodically pinging them. This tool is useful for monitoring servers like repl.it projects and also has notifications built-in. Discord webhooks currently supported.

Setup

Currently, there are two ways to setup and run keepalive-service:

  1. Clone, setup, and run this repo directly
  2. Use the prebuilt docker container

The following sections describe how to use both approaches.

Direct Installation

Clone the repo:

git clone https://github.com/madhavarshney/keepalive-service
cd keepalive-service

Install Python 3 and pip, and then install the required packages:

python3 -m pip install -r requirements.txt

Create a file called config.yaml with your configuration (see below) and then start the monitoring script:

python3 -m keepalive

Using Docker

This service can also be run as a docker container. Prebuilt images are available at ghcr.io/madhavarshney/keepalive-service. The config file should be bind-mounted as a volume to /keepalive-service/config.yaml, and --init should be enabled.

Running with Docker:

docker run --init \
  -v "$(pwd)"/config.yaml:/keepalive-service/config.yaml \
  ghcr.io/madhavarshney/keepalive-service:latest

Using Docker Compose:

version: "3.9"

services:
  keepalive:
    image: ghcr.io/madhavarshney/keepalive-service:latest

    restart: always
    init: true

    volumes:
      - ./config.yaml:/keepalive-service/config.yaml:ro

Configuration

The configuration file config.yaml should follow the following format:

# Time in seconds to recheck the services
interval: 60

# Discord Webhook URL to send notifications to
discord_webhook_url: https://discordapp.com/api/webhooks/...

# Service definitions
services:
  - name: Repl.it HTTP Project
    check:
      # Check a generic HTTP service hosted on repl.it
      # This fetches the specified URL and verifies that the returned content matches "data".
      type: REPL_HTTP_SERVICE
      url: https://coolnewthing.someone.repl.co
      data: Service is working.

  - name: My Webpage
    check:
      # Check a generic webpage with HTML content.
      # This verifies that the HTML <title> element matches "data".
      type: HTML_TITLE
      url: https://webpage.someone.repl.co
      data: The Daily News

License

The MIT License.

About

A service to monitor servers and keep 'em alive, such as repl.it projects.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages