1.5 KiB
kiviscrapworker
Kivi scraping worker
Setup
Copy example.env to the .env and set desired values
Deployment procedure
-
Compile source code with
go build -
Transfer generated binary to the clients
Command for sending files to the remote computer :
scp -i path/to/the/key.pem path/to/the/binary username@host:/path/to/destinationPath on the server where client resides is :
/home/ubuntu/kivi_scraper/client -
Add
.envfile next to the binary on the server and set correct values -
If
monitis not installed on the machine where client worker will be installed, install it (sudo apt install monit) -
Create
starth.shwith contents#!/bin/sh cd /home/ubuntu/kivi_scraper/client ./kiviscrapworker -
Create
stop.shwith contents#!/bin/sh cd /home/ubuntu/kivi_scraper/client sudo kill `cat sample.pid` -
Edit
monitconfiguration withsudo nano /etc/monit/monitrc -
Around line 208 is example how to set process check. Add new line below example
-
Add to the file :
check process kivi_scraper_worker_client pidfile /home/ubuntu/kivi_scraper/client/sample.pid start program = "/home/ubuntu/kivi_scraper/client/start.sh" stop program = "/home/ubuntu/kivi_scraper/client/stop.sh" if 5 restarts within 5 cycles then timeout -
Reboot with
sudo reboot
Notes
- To check
monitlogs, check/var/log/monit.log