kind: ConfigMap
apiVersion: v1
metadata:
    name: gitlab-unicorn
    namespace: gitlab
    selfLink: /api/v1/namespaces/gitlab/configmaps/gitlab-unicorn
    uid: 98096da1-398b-11ea-b115-42010a8001d6
    resourceVersion: '2016123'
    creationTimestamp: '2020-01-18T00:43:50Z'
    labels:
        app: unicorn
        chart: unicorn-2.6.5
        heritage: Helm
        release: gitlab
data:
    configure: >
        set -e

        config_dir="/init-config"

        secret_dir="/init-secrets"


        for secret in shell gitaly registry postgres rails-secrets
        gitlab-workhorse ; do
          mkdir -p "${secret_dir}/${secret}"
          cp -v -r -L "${config_dir}/${secret}/." "${secret_dir}/${secret}/"
        done

        for secret in redis minio objectstorage ldap omniauth smtp ; do
          if [ -e "${config_dir}/${secret}" ]; then
            mkdir -p "${secret_dir}/${secret}"
            cp -v -r -L "${config_dir}/${secret}/." "${secret_dir}/${secret}/"
          fi
        done
    database.yml.erb: |
        production:
          adapter: postgresql
          encoding: unicode
          database: gitlabhq_production
          pool: 10
          username: gitlab
          password: "<%= File.read("/etc/gitlab/postgres/psql-password").strip.dump[1..-2] %>"
          host: "gitlab-postgresql"
          port: 5432
          prepared_statements: false
          # load_balancing:
          #   hosts:
          #     - host1.example.com
          #     - host2.example.com
          
    gitlab.yml.erb: |
        production: &base
          gitlab:
            host: gitlab.example.com
            https: true
            impersonation_enabled: 
            usage_ping_enabled: true
            default_can_create_group: true
            username_changing_enabled: true
            issue_closing_pattern: 
            default_theme: 
            default_projects_features:
              issues: true
              merge_requests: true
              wiki: true
              snippets: true
              builds: true
              container_registry: true
            webhook_timeout: 
            trusted_proxies:
            time_zone: "UTC"        
            email_from: "gitlab@example.com"
            email_display_name: "GitLab"
            email_reply_to: "noreply@example.com"
            email_subject_suffix: ""
          
          gravatar:
            plain_url: 
            ssl_url: 
          extra:
            
            
            
          artifacts:
            enabled: true
            object_store:
              enabled: true
              remote_directory: gitlab-artifacts
              direct_upload: true
              background_upload: false
              proxy_download: true
              connection:
                provider: AWS
                region: us-east-1
                aws_access_key_id: "<%= File.read('/etc/gitlab/minio/accesskey').strip.dump[1..-2] %>"
                aws_secret_access_key: "<%= File.read('/etc/gitlab/minio/secretkey').strip.dump[1..-2] %>"
                host: minio.example.com
                endpoint: http://gitlab-minio-svc:9000
                path_style: true
          lfs:
            enabled: true
            object_store:
              enabled: true
              remote_directory: git-lfs
              direct_upload: true
              background_upload: false
              proxy_download: true
              connection:
                provider: AWS
                region: us-east-1
                aws_access_key_id: "<%= File.read('/etc/gitlab/minio/accesskey').strip.dump[1..-2] %>"
                aws_secret_access_key: "<%= File.read('/etc/gitlab/minio/secretkey').strip.dump[1..-2] %>"
                host: minio.example.com
                endpoint: http://gitlab-minio-svc:9000
                path_style: true
          uploads:
            enabled: true
            object_store:
              enabled: true
              remote_directory: gitlab-uploads
              direct_upload: true
              background_upload: false
              proxy_download: true
              connection:
                provider: AWS
                region: us-east-1
                aws_access_key_id: "<%= File.read('/etc/gitlab/minio/accesskey').strip.dump[1..-2] %>"
                aws_secret_access_key: "<%= File.read('/etc/gitlab/minio/secretkey').strip.dump[1..-2] %>"
                host: minio.example.com
                endpoint: http://gitlab-minio-svc:9000
                path_style: true
          packages:
            enabled: true
            object_store:
              enabled: true
              remote_directory: gitlab-packages
              direct_upload: true
              background_upload: false
              proxy_download: true
              connection:
                provider: AWS
                region: us-east-1
                aws_access_key_id: "<%= File.read('/etc/gitlab/minio/accesskey').strip.dump[1..-2] %>"
                aws_secret_access_key: "<%= File.read('/etc/gitlab/minio/secretkey').strip.dump[1..-2] %>"
                host: minio.example.com
                endpoint: http://gitlab-minio-svc:9000
                path_style: true
          external_diffs:
            enabled: 
            when: 
            object_store:
              enabled: false
              remote_directory: gitlab-mr-diffs
              direct_upload: true
              background_upload: false
              proxy_download: true
              connection:
                provider: AWS
                region: us-east-1
                aws_access_key_id: "<%= File.read('/etc/gitlab/minio/accesskey').strip.dump[1..-2] %>"
                aws_secret_access_key: "<%= File.read('/etc/gitlab/minio/secretkey').strip.dump[1..-2] %>"
                host: minio.example.com
                endpoint: http://gitlab-minio-svc:9000
                path_style: true
          
          pages:
            enabled: false
          mattermost:
            enabled: false
          gitlab_ci:
          ldap:
            enabled: false
          
          omniauth:
            enabled: false
            sync_profile_from_provider: []
            sync_profile_attributes: ["email"]
            allow_single_sign_on: ["saml"]
            block_auto_created_users: true
            auto_link_ldap_user: false
            auto_link_saml_user: false
            external_providers: []
          kerberos:
            enabled: false
          shared:
          gitaly:
            client_path: /home/git/gitaly/bin
            token: "<%= File.read('/etc/gitlab/gitaly/gitaly_token').strip.dump[1..-2] %>"
          repositories:
            storages: # You must have at least a `default` storage path.
              default:
                path: /var/opt/gitlab/repo
                gitaly_address: tcp://gitlab-gitaly-0.gitlab-gitaly.gitlab:8075
              
          backup:
            path: "tmp/backups"   # Relative paths are relative to Rails.root (default: tmp/backups/)
          gitlab_shell:
            path: /home/git/gitlab-shell/
            hooks_path: /home/git/gitlab-shell/hooks/
            upload_pack: true
            receive_pack: true
            ssh_port: 22
            secret_file: /etc/gitlab/shell/.gitlab_shell_secret
          workhorse:
            secret_file: /etc/gitlab/gitlab-workhorse/secret
          git:
            bin_path: /usr/bin/git
          webpack:
          monitoring:
            ip_whitelist:
              - 0.0.0.0/0
            web_exporter:
              enabled: false
              address: 0.0.0.0
              port: 8083
            sidekiq_exporter:
          shutdown:
            blackout_seconds: 10
          rack_attack:
            git_basic_auth:
          ## Registry Integration
          registry:
            enabled: true
            host: registry.example.com
            api_url: http://gitlab-registry:5000
            key: /etc/gitlab/registry/gitlab-registry.key
            issuer: gitlab-issuer
    installation_type: |
        gitlab-helm-chart
    resque.yml.erb: |
        production:
          # Redis (single instance)
          url: redis://:<%= URI.escape(File.read("/etc/gitlab/redis/password").strip) %>@gitlab-redis:6379
          id:
    smtp_settings.rb: ''
    unicorn.rb: >
        # This file should be equivalent to `unicorn.rb` from:

        # * gitlab-foss:
        https://gitlab.com/gitlab-org/gitlab-foss/blob/master/config/unicorn.rb.example

        # * omnibus:
        https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/files/gitlab-cookbooks/gitlab/templates/default/unicorn.rb.erb

        worker_processes 2

        working_directory "/srv/gitlab"

        listen "0.0.0.0:8080", :tcp_nopush => true

        timeout 60

        pid "/home/git/unicorn.pid"

        preload_app true


        require_relative "/srv/gitlab/lib/gitlab/cluster/lifecycle_events"


        before_exec do |server|
          # Signal application hooks that we're about to restart
          Gitlab::Cluster::LifecycleEvents.do_before_master_restart
        end


        run_once = true

        before_fork do |server, worker|
          if run_once
            # There is a difference between Puma and Unicorn:
            # - Puma calls before_fork once when booting up master process
            # - Unicorn runs before_fork whenever new work is spawned
            # To unify this behavior we call before_fork only once (we use
            # this callback for deleting Prometheus files so for our purposes
            # it makes sense to align behavior with Puma)
            run_once = false

            # Signal application hooks that we're about to fork
            Gitlab::Cluster::LifecycleEvents.do_before_fork
          end

          # The following is only recommended for memory/DB-constrained
          # installations.  It is not needed if your system can house
          # twice as many worker_processes as you have configured.
          #
          # This allows a new master process to incrementally
          # phase out the old master process with SIGTTOU to avoid a
          # thundering herd (especially in the "preload_app false" case)
          # when doing a transparent upgrade.  The last worker spawned
          # will then kill off the old master process with a SIGQUIT.
          old_pid = "#{server.config[:pid]}.oldbin"
          if old_pid != server.pid
            begin
              sig = (worker.nr + 1) >= server.worker_processes ? :QUIT : :TTOU
              Process.kill(sig, File.read(old_pid).to_i)
            rescue Errno::ENOENT, Errno::ESRCH
            end
          end
          #
          # Throttle the master from forking too quickly by sleeping.  Due
          # to the implementation of standard Unix signal handlers, this
          # helps (but does not completely) prevent identical, repeated signals
          # from being lost when the receiving process is busy.
          # sleep 1
        end


        after_fork do |server, worker|
          # Signal application hooks of worker start
          Gitlab::Cluster::LifecycleEvents.do_worker_start

          # per-process listener ports for debugging/admin/migrations
          # addr = "127.0.0.1:#{9293 + worker.nr}"
          # server.listen(addr, :tries => -1, :delay => 5, :tcp_nopush => true)
        end


        ENV['GITLAB_UNICORN_MEMORY_MIN'] = (700 * 1 << 20).to_s

        ENV['GITLAB_UNICORN_MEMORY_MAX'] = (1024 * 1 << 20).to_s

