I have several VMs running gilab-runner
, and I'm using gitlab-ci
to deploy microservices into those VMs. Now I want to monitore those VMs with prometheus and grafana, but i need to setup node-exporter/cadvisor
etc. service into those VMs.
My idea is using gitlab-ci to define a common job for those VMs.
I have already write the docker-compose.yml
and .gitlab-ci.yml
.
version: '3.8'
services:
node-exporter:
image: prom/node-exporter:latest
container_name: node-exporter
restart: unless-stopped
volumes:
- /proc:/host/proc:ro
- /sys:/host/sys:ro
- /:/rootfs:ro
command:
- '--path.procfs=/host/proc'
- '--path.rootfs=/rootfs'
- '--path.sysfs=/host/sys'
- '--collector.filesystem.mount-points-exclude=^/(sys|proc|dev|host|etc)($$|/)'
ports:
- "9100:9100"
cadvisor:
image: google/cadvisor
container_name: cadvisor
restart: unless-stopped
volumes:
- /:/rootfs:ro
- /var/run:/var/run:rw
- /sys:/sys:ro
- /var/lib/docker/:/var/lib/docker:ro
- /dev/disk/:/dev/disk:ro
ports:
- "8080:8080"
deploy-workers:
tags:
- worker
stage: deploy-workers
script:
- docker-compose -f docker-compose.worker.yaml pull
- docker-compose -f docker-compose.worker.yaml down
- docker-compose -f docker-compose.worker.yaml up -d
Then I register the runner in all my VMs with worker
tag.
However, only one worker job is triggered during ci.
I have about 20
VMs to go.
Do anyone have suggestions?