OpenWeather Worker
OpenWeather worker collects weather data from the OpenWeatherMap API, providing environmental conditions for container cooling optimization.
This worker can be skipped for development mode. For production, you will need an OpenWeatherMap API key.
Install OpenWeather Worker
1. Clone the Repository
Use the same working directory for all the workers.
Inside your working directory, run the following command to clone the (miningos-wrk-ext-openweather) repository:
git clone https://github.com/tetherto/miningos-wrk-ext-openweather.gitAfter cloning the repository, move into its directory:
cd miningos-wrk-ext-openweather2. Install Dependencies
Inside the miningos-wrk-ext-openweather directory, run the following command to install dependencies using npm:
npm ci3. Generate Configuration Files
Next, run the following script to scan the config/ directory,
copy each .example file into an active configuration file by removing the .example suffix.
sh setup-config.sh4. Configure the Worker
After generating the configuration files, edit the files in the config/ directory to match your environment:
- common.json - Worker-wide settings including worker identity
- openweather.json - OpenWeatherMap API configuration including API key
For production servers, edit the config/openweather.json file and update the secretApiKey with your OpenWeatherMap API key.
5. Enable Debugging and Start the Worker
You can now start the worker by running the following command:
DEBUG="miningos:*" pm2 -s start worker.js --name 'openweather-1' -- --wtype wrk-ext-openweather-rack --env development --rack rack-1This worker does not support mock servers. Ensure you have a valid OpenWeatherMap API key configured before running in production.