0

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?

1 Answer 1

0

GitLab is probably not the right tool for this. GitLab build pipelines are designed to produce output, not manage state on various servers. What system did you use to install and configure gitlab-runner on each of these servers? This is the sort of tool you're looking for to manage all of these servers.

1
  • you are right, i'm using docker swarm instead, just run the gitlab-runner on leader node to deploy service. Commented Jan 28, 2023 at 16:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.