docker-gitlab icon indicating copy to clipboard operation
docker-gitlab copied to clipboard

Modified `gitlab.yml` but not in effect

Open tonyjia87 opened this issue 5 years ago • 8 comments

gitlab.yml

  monitoring:
    # Time between sampling of unicorn socket metrics, in seconds
    unicorn_sampler_interval: 10
    # IP whitelist to access monitoring endpoints
    ip_whitelist:
      - 0.0.0.0/8
    # Sidekiq exporter is webserver built in to Sidekiq to expose Prometheus metrics
    sidekiq_exporter:
      enabled: true
      address: 0.0.0.0
      port: 3807

restart docker ,but no effection. gitlab is work.

tonyjia87 avatar Jan 09 '21 11:01 tonyjia87

Yes, it has no effect. gitlab.yml will be updated and overwritten by entrypoint.sh on every container startup. You can pass parameters as argument of docker run (or set in docker-compose.yml) instead. All available parameters are listed in README.md.
For your case, see GITLAB_MONITORING_IP_WHITELIST, GITLAB_MONITORING_SIDEKIQ_EXPORTER_ENABLED, GITLAB_MONITORING_SIDEKIQ_EXPORTER_ADDRESS and GITLAB_MONITORING_SIDEKIQ_EXPORTER_PORT.

kkimurak avatar Jan 10 '21 06:01 kkimurak

@kkimurak

append parameters --env 'GITLAB_MONITORING_UNICORN_SAMPLER_INTERVAL=10' --env 'GITLAB_MONITORING_IP_WHITELIST=0.0.0.0/8' --env 'GITLAB_MONITORING_SIDEKIQ_EXPORTER_ENABLED=true'

but

root@39e567d3c669:/home/git/gitlab# curl 0.0.0.0:3807
curl: (7) Failed to connect to 0.0.0.0 port 3807: Connection refused

how can export metric for prometheus ?

tonyjia87 avatar Jan 11 '21 02:01 tonyjia87

@tonyjia87

Source-installed gitlab does not contain prometheus so we need to build it by ourselves. And, unfortunately, this docker image seems to not provide that feature. See #1019, #1082 and #1102

So, your issue title may incorrect to things you want to do. The problem is not around gitlab.yml, but to support prometheus monitoring, I think.

-- P.S. : Sorry I've noticed just now, but parameters you added are seems to be same as default values (described in README and env-default) - so there were nothing to do.

-- P.S. (2) : I've tested in my environment (uses docker-compose), but curl 0.0.0.0:3807 repots no error.

Is your sidekiq running?

user@your-host-machine $ docker exec -it your-gitlab-container-name supervisorctl status sidekiq
sidekiq                          RUNNING   pid 1636, uptime ...

And, does the command ss -tl4 shows that port 3807 is opening and in LISTEN state?

user@your-host-machine $ docker exec -it your-gitlab-container-name ss -lnt4 'sport == :3807'
State    Recv-Q    Send-Q        Local Address:Port        Peer Address:Port
LISTEN   0         128                 0.0.0.0:3807             0.0.0.0:*

kkimurak avatar Jan 11 '21 06:01 kkimurak

Thank you for your answer

tonyjia87 avatar Jan 11 '21 08:01 tonyjia87

@tonyjia87 just for a reminder, please close this issue if you found answer

kkimurak avatar Feb 14 '21 11:02 kkimurak

Using the default docker compose I can't seem to make it work either.

@kkimurak can you please provide us the docker-compose.yml that works for you?

The ss command doesn't seem to be provided in the image anymore btw.

ss89 avatar Sep 05 '25 05:09 ss89

@ss89

  1. Can you explain more detail in which part of gitlab doesn't work for you? If about prometheus, I'm not using monitoring feature so providing my config might not help you.

  2. ss command: install it (iproute2) by yourself :

    docker exec -it <your-gitlab-container> bash; 
    root@your-gitlab-container:/home/git/gitlab# apt update && apt install iproute2
    

kkimurak avatar Sep 08 '25 04:09 kkimurak

Thanks for the hint, I did try this at first, but i was having networking issues resulting in the installation of ss not working. Now that is working though.

I did not disable the sidekiq exporter, yet ss does not show an open port 3807:

root@a9d7899b9d04:/home/git/gitlab# env | grep -i sidekiq
GITLAB_MONITORING_SIDEKIQ_EXPORTER_ENABLED=true
GITLAB_MONITORING_SIDEKIQ_EXPORTER_ADDRESS=0.0.0.0
GITLAB_MONITORING_SIDEKIQ_EXPORTER_PORT=3807

root@a9d7899b9d04:/home/git/gitlab# ss -lnt4 'sport == :3807'
State                   Recv-Q                    Send-Q                                       Local Address:Port                                       Peer Address:Port                   Process

root@a9d7899b9d04:/home/git/gitlab# grep -i -C3 sidekiq_exporter config/gitlab.yml
      - 172.16.0.1/16,172.18.0.1/16,127.0.0.1/32,192.168.0.1/24

    # Sidekiq exporter is webserver built in to Sidekiq to expose Prometheus metrics
    sidekiq_exporter:
     enabled: true
     address: 0.0.0.0
     port: 3807
--
  # We use random port to not block ability to run
  # multiple instances of the service
  monitoring:
    sidekiq_exporter:
      enabled: true
      address: 127.0.0.1
      port: 0

As per this output i would have expected that the exporter gets started upon container start. Somehow that's not the case though. I'd be happy to get any idea why that would not be the case (without reading through the entire startup scripts).

ss89 avatar Oct 05 '25 11:10 ss89