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.
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
Then you can monitor the application logs to check if it’s working:
Once you’ve confirmed everything’s working, you can run it in the background with the following command:
docker-compose up -d