Skip to content

Ducktatorrr/uptime-goat-node

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🐐 Uptime Goat Node

This repository contains the goat_report and endpoint_agent scripts. The goat_report script periodically sends asynchronous reports to the Cryptards Uptime Goat servers. The endpoint_agent script periodically fetches the endpoints where goat_report needs to send the reports to.

Uptime Goat

🚀 Features

  • Asynchronous Requests: Uses aiohttp to make fast, concurrent requests to multiple endpoints.
  • Goat Monitoring: Tracks consecutive goat report numbers and logs when these reset unexpectedly.
  • Docker Ready: A pre-built image is available for seamless deployment.

🐙 Quick Start with Docker Compose (recommended)

We recommend using Docker Compose to run the script as this is the most robust.

Prerequisites:

  • Docker Compose
  • Docker
  • Git
  1. Clone the repository:

    git clone https://github.com/Ducktatorrr/uptime-goat-node.git
    cd uptime-goat-node/app
  2. Create a .env file:

    cp .env.example .env
  3. Open the .env file and set the GOAT_ID and GOAT_KEY variables:

    GOAT_ID=<token_here>
    GOAT_KEY=<key_here>
    ENDPOINTS_URL=<PREFILLED>

    Replace <token_here> with your actual 32-character hexadecimal GOAT_ID and GOAT_KEY.

    You should not change the ENDPOINTS_URL variable unless you know what you are doing.

  4. Run the Docker Compose command:

    docker compose up -d
  5. Check the logs:

    docker compose logs -f

Stopping & Updating the deployment

To stop the deployment, use:

docker compose down

When a new version is released pull the repository and rebuild the images:

git pull

To update all the containers in the deployment:

docker compose pull
docker compose up -d --build

To update a specific service (example Endpoint Agent):

docker compose up -d --build endpoint-agent

This automatically rebuilds the image and restarts the service.

🐋 Quick Start with balena (for the Cryptards)

If you want to run this on a device like a Raspberry Pi, Orange Pi or other single board computer, you can run this app using balenaCloud for free.

Simply click the "Deploy with balena" button below (you will need to create an account if you haven't already got one):

Deploy with button

You will then need to add a Device Variable with the name GOAT_ID and another with the name GOAT_KEY. The values should be set information you got from the Onboarding - Uptime GOAT page. You should not change the ENDPOINTS_URL variable unless you know what you are doing.

📦 Quick Start with Docker (strongly discouraged)

To run the goat report node using Docker, follow these steps:

  1. Pull the pre-built Docker image:

    docker pull ghcr.io/ducktatorrr/uptime-goat-node/combined:latest
  2. Run the container:

    docker run --restart always --name uptime_goat -d -e GOAT_ID=<token_here> -e GOAT_KEY=<key_here> -e ENDPOINTS_URL=https://raw.githubusercontent.com/1rabbit/goat_servers/refs/heads/main/uptime_endpoints ghcr.io/ducktatorrr/uptime-goat-node/combined:latest
    • Replace <token_here> with your actual 32-character hexadecimal GOAT_ID and GOAT_KEY.

    This will start the container in detached mode (-d), with automatic restart enabled (--restart always), ensuring the container always stays up.

    To live view the logs, use:

    docker logs uptime_goat -f

Stopping & Updating the container

To stop the container, use:

docker stop uptime_goat

To remove the container:

docker rm uptime_goat

To update the container:

docker pull ghcr.io/ducktatorrr/uptime-goat-node/combined:latest

Then you can start the container again with the same command as above.

🐍 Quick Start with Python

If you want to run the script locally without Docker:

  1. Clone the repository:

    git clone https://github.com/Ducktatorrr/uptime-goat-node.git
    cd uptime-goat-node/app
  2. Create a virtual environment and activate it:

    python -m venv venv
    source venv/bin/activate
  3. Install dependencies:

    pip install -r requirements.txt
  4. Copy the .env.example file to .env:

    cp .env.example .env
  5. Open the .env file and set the GOAT_ID and GOAT_KEY variables:

    GOAT_ID=<token_here>
    GOAT_KEY=<key_here>
    ENDPOINTS_URL=<PREFILLED>

    Replace <token_here> with your actual 32-character hexadecimal GOAT_ID and GOAT_KEY.

    You should not change the ENDPOINTS_URL variable unless you know what you are doing.

  6. Run the scripts:

    python goat_report.py
    python endpoint_agent.py

🛠 Configuration

🐛 Error Handling

If the request fails, the script logs the error message and retries on the next cycle. If the "consecutive" goat count resets (indicating a potential "rug pull"), the script logs this with the message RUGGED 💀.

🎉 Contributing

We welcome contributions! Feel free to submit issues, pull requests, or feature requests. Beware that automatic Flake8 linting is enabled so make sure your code is linted before submitting a PR.

⚖️ License

This project is licensed under the MIT License - see the LICENSE file for details.