In a previous post, we looked at a simple C# application that uses SpacePool API to get information about our Chia farm. In this post, we are going to Dockerize the application.

The core part of the application is still the same. It gets the latest partials from SpacePool API and checks if they are within an acceptable timeframe.

What’s new in this release is as follows:

  • Sends emails as alert notifications
  • The main application is a Worker Service to run every n minutes (n being CheckIntervalInMinutes environment variable)
  • The application runs in a Docker container, so you can easily pull it from Docker Hub.

Table of Contents

Usage

The easiest way to use the application is to download docker-compose-template.yaml, rename it to docker-compose.yaml and fill in the values. To be able to get alert notifications, you’re going to need

  • SpacePool API key and launcher id
  • An email address that you can use to send and receive emails

The template looks like this:

version: "3.9"

services:
  spacepool-monitor:
    image: devpowercouk/spacepool-monitor
    build:
      context: .
      dockerfile: SpacePoolMonitor.WorkerService/Dockerfile
    environment:
      AppSettings__LauncherId: ""
      AppSettings__ApiKey: ""
      AppSettings__UserAgent: ""
      AppSettings__CheckIntervalInMinutes: 30
      EmailSettings__FromAddress: ""
      EmailSettings__ToAddress: ""
      EmailSettings__Subject: ""
      EmailSettings__FromName: ""
      SmtpSettings__Host: ""
      SmtpSettings__Username: ""
      SmtpSettings__Password: ""
      SmtpSettings__Port: 587

After you have updated the configuration with your values, run the following command in terminal

docker-compose up

Then you can monitor the application logs to check if it’s working:

The SpacePool monitoring application output running successfully in a Docker container

Once you’ve confirmed everything’s working, you can run it in the background with the following command:

docker-compose up -d

Resources


Volkan Paksoy

Volkan Paksoy is a software developer with more than 15 years of experience, focusing mostly on C# and AWS. He’s a home lab and self-hosting fan who loves to spend his personal time developing hobby projects with Raspberry Pi, Arduino, LEGO and everything in-between.