Use monitor docker hub image for monitor deployment (#284)
This commit is contained in:
parent
52358d477b
commit
bce1e6509e
@ -1,3 +1,3 @@
|
|||||||
---
|
---
|
||||||
dependencies:
|
dependencies:
|
||||||
- { role: common, check_deployed: true, component: 'monitor' }
|
- { role: common, skip_repo: true, check_deployed: true, component: 'monitor' }
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
- name: Build the containers
|
- name: Pull the containers images
|
||||||
shell: docker-compose build
|
shell: docker-compose pull
|
||||||
args:
|
args:
|
||||||
chdir: "{{ bridge_path }}/monitor"
|
chdir: "{{ bridge_path }}/monitor"
|
||||||
|
@ -1,10 +1,46 @@
|
|||||||
---
|
---
|
||||||
|
- name: Create configs directory
|
||||||
|
file:
|
||||||
|
path: "{{ bridge_path }}/monitor/configs"
|
||||||
|
state: directory
|
||||||
|
mode: '0755'
|
||||||
|
when: skip_task != true
|
||||||
|
|
||||||
|
- name: Create responses directory
|
||||||
|
file:
|
||||||
|
path: "{{ bridge_path }}/monitor/responses"
|
||||||
|
state: directory
|
||||||
|
mode: '0755'
|
||||||
|
when: skip_task != true
|
||||||
|
|
||||||
|
- name: Create scripts directory
|
||||||
|
file:
|
||||||
|
path: "{{ bridge_path }}/monitor/scripts"
|
||||||
|
state: directory
|
||||||
|
mode: '0755'
|
||||||
|
when: skip_task != true
|
||||||
|
|
||||||
- name: Install .env config
|
- name: Install .env config
|
||||||
template:
|
template:
|
||||||
src: .env.j2
|
src: .env.j2
|
||||||
dest: "{{ bridge_path }}/monitor/.env"
|
dest: "{{ bridge_path }}/monitor/.env"
|
||||||
when: skip_task != true
|
when: skip_task != true
|
||||||
|
|
||||||
|
- name: Copy docker-compose file
|
||||||
|
copy:
|
||||||
|
src: ../../../../monitor/docker-compose.yml
|
||||||
|
dest: "{{ bridge_path }}/monitor/docker-compose.yml"
|
||||||
|
mode: '0755'
|
||||||
|
when: skip_task != true
|
||||||
|
|
||||||
|
- name: Copy script file
|
||||||
|
copy:
|
||||||
|
src: ../../../../monitor/scripts/getBridgeStats.sh
|
||||||
|
dest: "{{ bridge_path }}/monitor/scripts/getBridgeStats.sh"
|
||||||
|
owner: "{{ compose_service_user }}"
|
||||||
|
mode: '0755'
|
||||||
|
when: skip_task != true
|
||||||
|
|
||||||
- name: Install bridge config env
|
- name: Install bridge config env
|
||||||
template:
|
template:
|
||||||
src: config.env.j2
|
src: config.env.j2
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
# This role creates a tokenbridge-monitor service which is designed to manage docker-compose monitor deployment.
|
# This role creates a tokenbridge-monitor service which is designed to manage docker-compose monitor deployment.
|
||||||
# /etc/init.d/tokenbridge-monitor start, status, stop, restart - does what the services usually do in such cases.
|
# /etc/init.d/tokenbridge-monitor start, status, stop, restart - does what the services usually do in such cases.
|
||||||
# /etc/init.d/tokenbridge-monitor rebuild - builds a new monitor deployment from scratch.
|
|
||||||
---
|
---
|
||||||
- name: "Set the service"
|
- name: "Set the service"
|
||||||
template:
|
template:
|
||||||
|
@ -34,14 +34,6 @@ status(){
|
|||||||
sudo -u "{{ compose_service_user }}" /usr/local/bin/docker-compose ps
|
sudo -u "{{ compose_service_user }}" /usr/local/bin/docker-compose ps
|
||||||
}
|
}
|
||||||
|
|
||||||
rebuild(){
|
|
||||||
echo "Rebuild TokenBridge Monitor.."
|
|
||||||
cd $WORKDIR
|
|
||||||
sudo -u "{{ compose_service_user }}" /usr/local/bin/docker-compose down -v
|
|
||||||
sudo -u "{{ compose_service_user }}" /usr/local/bin/docker-compose rm -fv
|
|
||||||
sudo -u "{{ compose_service_user }}" /usr/local/bin/docker-compose up --detach --force-recreate --no-deps --build
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
|
|
||||||
@ -63,12 +55,8 @@ case "$1" in
|
|||||||
start
|
start
|
||||||
;;
|
;;
|
||||||
|
|
||||||
rebuild)
|
|
||||||
rebuild
|
|
||||||
;;
|
|
||||||
|
|
||||||
*)
|
*)
|
||||||
echo $"Usage: $0 {start|stop|restart|rebuild|status}"
|
echo $"Usage: $0 {start|stop|restart|status}"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
@ -2,9 +2,7 @@
|
|||||||
version: '2.4'
|
version: '2.4'
|
||||||
services:
|
services:
|
||||||
monitor:
|
monitor:
|
||||||
build:
|
image: poanetwork/tokenbridge-monitor:latest
|
||||||
context: ..
|
|
||||||
dockerfile: monitor/Dockerfile
|
|
||||||
ports:
|
ports:
|
||||||
- "${MONITOR_PORT}:${MONITOR_PORT}"
|
- "${MONITOR_PORT}:${MONITOR_PORT}"
|
||||||
env_file: ./.env
|
env_file: ./.env
|
||||||
|
@ -4,7 +4,7 @@ cd $(dirname $0)/..
|
|||||||
if /usr/local/bin/docker-compose ps | grep -q -i 'monitor'; then
|
if /usr/local/bin/docker-compose ps | grep -q -i 'monitor'; then
|
||||||
for file in configs/*.env
|
for file in configs/*.env
|
||||||
do
|
do
|
||||||
docker run --rm --env-file $file -v $(pwd)/responses:/mono/monitor/responses monitor_monitor /bin/bash -c 'yarn check-all'
|
docker run --rm --env-file $file -v $(pwd)/responses:/mono/monitor/responses poanetwork/tokenbridge-monitor:latest /bin/bash -c 'yarn check-all'
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
echo "Monitor is not running, skipping checks."
|
echo "Monitor is not running, skipping checks."
|
||||||
|
Loading…
Reference in New Issue
Block a user