Add cron schedule to monitor deployment playbook (#161)
* Default cron schedule * Added cron task * Docs * Overwriting log files * Removed deprecated flag * Default monitor_cron_schedule.
This commit is contained in:
parent
c66923827b
commit
9c8259700b
@ -47,6 +47,7 @@ cp hosts.yml.example hosts.yml
|
||||
<host_ip_B>:
|
||||
ansible_user: <user>
|
||||
#syslog_server_port: "<protocol>://<ip>:<port>"
|
||||
#monitor_cron_schedule: "*/4 * * * *" # When this parameter is set, it will overwrite default schedule for performing checks
|
||||
```
|
||||
|
||||
The config above would install the Oracle on `<host_ip_A>`, UI on `<host_ip_C>`, and both Oracle, UI and Monitor on `<host_ip_B>`.
|
||||
|
@ -51,4 +51,3 @@ MONITOR_FOREIGN_GAS_LIMIT: 300000
|
||||
MONITOR_HOME_GAS_PRICE_FALLBACK: 0
|
||||
MONITOR_FOREIGN_GAS_PRICE_FALLBACK: 10000000000
|
||||
MONITOR_LEFT_TX_THRESHOLD: 100
|
||||
MONITOR_CRON_SCHEDULE: "* * * * *"
|
||||
|
@ -52,4 +52,3 @@ MONITOR_FOREIGN_GAS_LIMIT: 300000
|
||||
MONITOR_HOME_GAS_PRICE_FALLBACK: 1000000000
|
||||
MONITOR_FOREIGN_GAS_PRICE_FALLBACK: 1000000000
|
||||
MONITOR_LEFT_TX_THRESHOLD: 100
|
||||
MONITOR_CRON_SCHEDULE: "* * * * *"
|
||||
|
@ -52,4 +52,3 @@ MONITOR_FOREIGN_GAS_LIMIT: 300000
|
||||
MONITOR_HOME_GAS_PRICE_FALLBACK: 15000000000
|
||||
MONITOR_FOREIGN_GAS_PRICE_FALLBACK: 10000000000
|
||||
MONITOR_LEFT_TX_THRESHOLD: 100
|
||||
MONITOR_CRON_SCHEDULE: "* * * * *"
|
||||
|
@ -17,3 +17,4 @@ sokol-kovan:
|
||||
127.0.0.1:
|
||||
ansible_user: ubuntu
|
||||
#syslog_server_port: "<protocol>://<ip>:<port>"
|
||||
#monitor_cron_schedule: "*/4 * * * *"
|
||||
|
2
deployment/roles/monitor/defaults/main.yml
Normal file
2
deployment/roles/monitor/defaults/main.yml
Normal file
@ -0,0 +1,2 @@
|
||||
---
|
||||
monitor_cron_schedule: "*/4 * * * *"
|
18
deployment/roles/monitor/tasks/cron.yml
Normal file
18
deployment/roles/monitor/tasks/cron.yml
Normal file
@ -0,0 +1,18 @@
|
||||
---
|
||||
- name: Parse cron schedule
|
||||
set_fact:
|
||||
minute: "{{ monitor_cron_schedule.split(' ')[0] }}"
|
||||
hour: "{{ monitor_cron_schedule.split(' ')[1] }}"
|
||||
day: "{{ monitor_cron_schedule.split(' ')[2] }}"
|
||||
month: "{{ monitor_cron_schedule.split(' ')[3] }}"
|
||||
weekday: "{{ monitor_cron_schedule.split(' ')[4] }}"
|
||||
job: "/bin/bash -c 'cd {{ bridge_path }}/monitor/scripts; ./checkDocker.sh >cronWorker.out 2>cronWorker.err'"
|
||||
- name: Add cron entry
|
||||
cron:
|
||||
name: "RUN_MONITOR_CHECKS"
|
||||
minute: "{{ minute }}"
|
||||
hour: "{{ hour }}"
|
||||
day: "{{ day }}"
|
||||
month: "{{ month }}"
|
||||
weekday: "{{ weekday }}"
|
||||
job: "{{ job }}"
|
@ -3,3 +3,4 @@
|
||||
- include_tasks: logging.yml
|
||||
- include_tasks: jumpbox.yml
|
||||
- include_tasks: servinstall.yml
|
||||
- include_tasks: cron.yml
|
||||
|
@ -22,4 +22,3 @@ FOREIGN_GAS_PRICE_FALLBACK={{ MONITOR_FOREIGN_GAS_PRICE_FALLBACK }}
|
||||
FOREIGN_GAS_PRICE_FACTOR={{ FOREIGN_GAS_PRICE_FACTOR }}
|
||||
LEFT_TX_THRESHOLD={{ MONITOR_LEFT_TX_THRESHOLD }}
|
||||
PORT={{ MONITOR_PORT }}
|
||||
CRON_SCHEDULE={{ MONITOR_CRON_SCHEDULE }}
|
||||
|
9
monitor/scripts/checkDocker.sh
Executable file
9
monitor/scripts/checkDocker.sh
Executable file
@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
cd $(dirname $0)/..
|
||||
|
||||
if /usr/local/bin/docker-compose ps | grep -q -i 'monitor'; then
|
||||
# https://github.com/docker/compose/issues/3352
|
||||
COMPOSE_INTERACTIVE_NO_CLI=1 /usr/local/bin/docker-compose exec -T monitor /bin/bash -c 'yarn check-all'
|
||||
else
|
||||
echo "Monitor is not running, skipping checks."
|
||||
fi
|
Loading…
Reference in New Issue
Block a user