Expose setting to specify config_command in GitLab Workhorse config file
What does this MR do?
Expose setting to specify config_command in GitLab Workhorse config file. Depends on gitlab!140898 (merged)
Testing
-
Deploy GitLab using the following
docker-compose.yml
filedocker-compose.yml
version: '3.8' name: 'gitlab-test' x-default_settings: &default_settings image: "${GITLAB_IMAGE:-registry.gitlab.com/gitlab-org/omnibus-gitlab/gitlab-ee:8363-workhorse-external-config}" pull_policy: always privileged: true shm_size: '256m' restart: always services: redis: <<: *default_settings environment: GITLAB_OMNIBUS_CONFIG: | roles ['redis_master_role'] # Redis configuration redis['bind'] = '10.0.0.2' redis['port'] = 6379 redis['password'] = 'redis-password' # This is a pure Redis node. We don't need Rails stuff. gitlab_rails['enable'] = false networks: default: ipv4_address: 10.0.0.2 healthcheck: test: ["CMD", "gitlab-redis-cli", "ping"] start_period: 60s gitlab: <<: *default_settings environment: GITLAB_OMNIBUS_CONFIG: | external_url "http://127.0.0.1" # Disable bundled Redis redis['enable'] = false # Disable PG postgresql['enable'] = false # Disable everything else that uses Redis gitlab_rails['enable'] = false gitlab_kas['enable'] = false prometheus_monitoring['enable'] = false # Enable GitLab Workhorse gitlab_workhorse['enable'] = true # GitLab Exporter uses the Redis information from `gitlab_rails` gitlab_rails['redis_host'] = '10.0.0.2' gitlab_rails['redis_port'] = '6379' ports: - "80:80" - "443:443" - "22:22" networks: default: ipv4_address: 10.0.0.3 healthcheck: disable: true depends_on: redis: condition: service_healthy networks: default: ipam: config: - subnet: 10.0.0.0/24
-
Check the logs of
gitlab-workhorse
and see that it shows a warning about Redis not having an auth -
In the
gitlab
container, create the file/opt/redis-for-workhorse.sh
with the following content#!/usr/bin/env bash cat <<EOF { "redis": { "password": "redis-password" } } EOF
-
Make it executable
$ chmod +x /opt/redis-for-workhorse.sh
-
Add the following to
/etc/gitlab/gitlab.rb
gitlab_workhorse['extra_config_command'] = '/opt/redis-for-workhorse.sh'
-
Run
gitlab-ctl reconfigure
and see that the error ingitlab-workhorse
logs regarding Redis auth is gone.
Related issues
Closes #8363 (closed)
Checklist
See Definition of done.
For anything in this list which will not be completed, please provide a reason in the MR discussion.
Required
-
MR title and description are up to date, accurate, and descriptive. -
MR targeting the appropriate branch. -
Latest Merge Result pipeline is green. -
When ready for review, MR is labeled "~workflow::ready for review" per the Distribution MR workflow.
For GitLab team members
If you don't have access to this, the reviewer should trigger these jobs for you during the review process.
-
The manual Trigger:ee-package
jobs have a green pipeline running against latest commit. -
If config/software
orconfig/patches
directories are changed, make sure thebuild-package-on-all-os
job within theTrigger:ee-package
downstream pipeline succeeded. -
If you are changing anything SSL related, then the Trigger:package:fips
manual job within theTrigger:ee-package
downstream pipeline must succeed. -
If CI configuration is changed, the branch must be pushed to dev.gitlab.org
to confirm regular branch builds aren't broken.
Expected (please provide an explanation if not completing)
-
Test plan indicating conditions for success has been posted and passes. -
Documentation created/updated. -
Tests added. -
Integration tests added to GitLab QA. -
Equivalent MR/issue for the GitLab Chart opened. -
Validate potential values for new configuration settings. Formats such as integer 10
, duration10s
, URIscheme://user:passwd@host:port
may require quotation or other special handling when rendered in a template and written to a configuration file.