Docker/Compose/GitLab

From Chorke Wiki
Revision as of 01:03, 2 September 2024 by Shahed (talk | contribs)
Jump to navigation Jump to search

docker-compose.yml

cat << YML | tee ${HOME}/Documents/gitlab-playground/docker-compose.yml >/dev/null
name: gitlab
services:
  gitlab:
    image: gitlab/gitlab-ce:15.1.3-ce.0
    container_name: gitlab
    restart: always
    hostname: 'gitlab.host.k8s.local'
    extra_hosts:
      - "host.docker.internal:host-gateway"
    networks:
      portal:
        aliases:
          - gitlab.host.k8s.local
    labels:
      gitlab: "GitLab CE"
    environment:
      GITLAB_OMNIBUS_CONFIG: |
        external_url 'http://gitlab.host.k8s.local'
        gitlab_rails['db_adapter'] = 'postgresql'
        gitlab_rails['db_database'] = 'gitlab'
        gitlab_rails['db_username'] = 'gitlab'
        gitlab_rails['db_password'] = 'sadaqah!'
        gitlab_rails['db_host'] = 'host.docker.internal'
        gitlab_rails['gitlab_ssh_host'] = 'code.host.k8s.local'
        nginx['proxy_set_headers'] = { 'X-Forwarded-Proto' => 'http', 'X-Forwarded-Ssl' => 'Off' }
        nginx['listen_port'] = 80
        nginx['listen_https'] = false
        gitlab_rails['smtp_enable'] = true
        gitlab_rails['smtp_domain'] = "mail.k8s.local"
        gitlab_rails['smtp_address'] = 'mail.k8s.local'
        gitlab_rails['smtp_port'] = 10587
        gitlab_rails['smtp_user_name'] = '[email protected]'
        gitlab_rails['smtp_password'] = 'sadaqah!'
        gitlab_rails['smtp_enable_starttls_auto'] = true
        gitlab_rails['smtp_tls'] = false
        gitlab_rails['gitlab_email_from'] = '[email protected]'
        gitlab_rails['gitlab_email_display_name'] = 'Academia Gitlab'
        gitlab_rails['gitlab_email_reply_to'] = '[email protected]'
        gitlab_rails['omniauth_enabled'] = true
        gitlab_rails['omniauth_allow_single_sign_on'] = ['openid_connect']
        gitlab_rails['omniauth_block_auto_created_users'] = false
        gitlab_rails['gitlab_default_can_create_group'] = false
        gitlab_rails['gitlab_username_changing_enabled'] = false
        gitlab_rails['omniauth_providers'] = [{ 'name' => 'openid_connect', 'label' => 'Academia OpenID', 'icon' => '', 'args' => {'name' => 'openid_connect', 'scope' => ['openid','profile'], 'response_type' => 'code', 'issuer' => 'http://keycloak.k8s.local/realms/GoogleWorkspace', 'discovery' => true, 'client_auth_method' => 'query', 'uid_field' => 'sub', 'send_scope_to_token_endpoint' => 'false', 'client_options' => { 'identifier' => 'gitlab.host.k8s.local', 'secret' => 'sRQwifypRYYhvXPZId8yh3wK0oU9Jqgh', 'redirect_uri' => 'http://gitlab.host.k8s.local/users/auth/openid_connect/callback' }}}]
    ports:
      - '4430:443'
      - '1080:80'
      - '1022:22'
    volumes:
      - './gitlab/config:/etc/gitlab'
      - './gitlab/logs:/var/log/gitlab'
      - './gitlab/data:/var/opt/gitlab'
    shm_size: '256m'
networks:
  portal:
    ipam:
      config:
        - subnet: 10.10.10.0/24
YML