Failed GitLab CE On-primise( 502 Error) Help me

Replace this template with your information

Describe your question in as much detail as possible:

  • What are you seeing, and how does it differ from what you expect to see?
  • Consider including screenshots, error messages, and/or other helpful visuals
  • What version are you on (Hint: /help) ? and are you using self-managed or gitlab.com?
  • What troubleshooting steps have you already taken? Can you link to any docs or other resources so we know where you have been?

*Thanks for taking the time to be thorough in your request, it really helps! :blush
You are currently using gitlab ce on-premises. But suddenly I’m getting a 502 error and I’m not able to resolve it.
Any help would be appreciated.


sudo gitlab-rake gitlab:check

Checking GitLab subtasks ...

Checking GitLab Shell ...

GitLab Shell: ... GitLab Shell version >= 14.20.0 ? ... OK (14.20.0)
Running /opt/gitlab/embedded/service/gitlab-shell/bin/check
Internal API available: FAILED - Internal API unreachable
gitlab-shell self-check failed
  Try fixing it:
  Make sure GitLab is running;
  Check the gitlab-shell configuration file:
  sudo -u git -H editor /opt/gitlab/embedded/service/gitlab-shell/config.yml
  Please fix the error above and rerun the checks.

Checking GitLab Shell ... Finished

Checking Gitaly ...

Gitaly: ... default ... OK

Checking Gitaly ... Finished

Checking Sidekiq ...

Sidekiq: ... Running? ... yes
Number of Sidekiq processes (cluster/worker) ... 1/1

Checking Sidekiq ... Finished

Checking Incoming Email ...

Incoming Email: ... Reply by email is disabled in config/gitlab.yml

Checking Incoming Email ... Finished

Checking LDAP ...

LDAP: ... LDAP is disabled in config/gitlab.yml

Checking LDAP ... Finished

Checking GitLab App ...

Database config exists? ... yes
All migrations up? ... yes
Database contains orphaned GroupMembers? ... no
GitLab config exists? ... yes
GitLab config up to date? ... yes
Cable config exists? ... yes
Resque config exists? ... yes
Log directory writable? ... yes
Tmp directory writable? ... yes
Uploads directory exists? ... yes
Uploads directory has correct permissions? ... yes
Uploads directory tmp has correct permissions? ... yes
Systemd unit files or init script exist? ... skipped (omnibus-gitlab has neither init script nor systemd units)
Systemd unit files or init script up-to-date? ... skipped (omnibus-gitlab has neither init script nor systemd units)
Projects have namespace: ...


sudo vi /etc/gitlab/gitlab.rb

external_url 'http://10.63.1.80:8088'

sudo vi /opt/gitlab/embedded/service/gitlab-shell/config.yml

# This file is managed by gitlab-ctl. Manual changes will be
# erased! To change the contents below, edit /etc/gitlab/gitlab.rb
# and run `sudo gitlab-ctl reconfigure`.

# GitLab user. git by default
user: git

# Url to gitlab instance. Used for api calls. May but need not end with a slash.
gitlab_url: "http+unix://%2Fvar%2Fopt%2Fgitlab%2Fgitlab-workhorse%2Fsockets%2Fsocket"

gitlab_relative_url_root:

# File that contains the secret key for verifying access to GitLab.
# Default is .gitlab_shell_secret in the gitlab-shell directory.
secret_file: "/var/opt/gitlab/gitlab-rails/etc/gitlab_shell_secret"

http_settings:

#  user: someone
#  password: somepass
#  ca_file: /etc/ssl/cert.pem
#  ca_path: /etc/pki/tls/certs

# File used as authorized_keys for gitlab user
auth_file: "/var/opt/gitlab/.ssh/authorized_keys"

# SSL certificate dir where custom certificates can be placed
# https://golang.org/pkg/crypto/x509/
ssl_cert_dir: "/opt/gitlab/embedded/ssl/certs/"

# Log file.
# Default is gitlab-shell.log in the root directory.
log_file: "/var/log/gitlab/gitlab-shell/gitlab-shell.log"

# Log level. INFO by default
log_level:

log_format: json

# Audit usernames.
# Set to true to see real usernames in the logs instead of key ids, which is easier to follow, but
# incurs an extra API call on every gitlab-shell command.
audit_usernames:

migration:
  {"enabled":true,"features":[]}

sudo tail -f /var/log/gitlab/gitlab-shell/gitlab-shell.log

{"correlation_id":"01HKRCEP3E53B4D6661Y2ET7M9","duration_ms":0,"error":null,"level":"error","method":"GET","msg":"Internal API error","status":502,"time":"2024-01-10T00:30:45Z","url":"http://unix/api/v4/internal/check"}
{"correlation_id":"01HKRCEP3E53B4D6661Y2ET7M9","duration_ms":0,"error":null,"level":"error","method":"GET","msg":"Internal API error","status":502,"time":"2024-01-10T00:30:46Z","url":"http://unix/api/v4/internal/check"}
{"correlation_id":"01HKRCEP3E53B4D6661Y2ET7M9","duration_ms":0,"error":null,"level":"error","method":"GET","msg":"Internal API error","status":502,"time":"2024-01-10T00:30:48Z","url":"http://unix/api/v4/internal/check"}

sudo tail -f /var/log/gitlab/gitlab-rails/production.log

Creating scope :order_name_asc. Overwriting existing method Label.order_name_asc.
Creating scope :order_name_desc. Overwriting existing method Label.order_name_desc.
Creating scope :open. Overwriting existing method ExternalPullRequest.open.
Creating scope :not_expired. Overwriting existing method Member.not_expired.
Creating scope :order_name_asc. Overwriting existing method Member.order_name_asc.
Creating scope :order_name_desc. Overwriting existing method Member.order_name_desc.
Creating scope :system. Overwriting existing method PrometheusMetric.system.
Creating scope :database. Overwriting existing method Ci::BuildTraceChunk.database.
Creating scope :with_user. Overwriting existing method GroupMember.with_user.
Creating scope :system. Overwriting existing method Gitlab::DatabaseImporters::CommonMetrics::PrometheusMetric.system.
Creating scope :human. Overwriting existing method User.human.
Raven 3.1.2 configured not to capture errors: DSN not set
Creating scope :without_statuses. Overwriting existing method CommitStatus.without_statuses.
Creating scope :in_pipelines. Overwriting existing method Ci::Build.in_pipelines.
Creating scope :without_statuses. Overwriting existing method Ci::Pipeline.without_statuses.
Creating scope :of_projects. Overwriting existing method MergeRequest.of_projects.
Creating scope :join_project. Overwriting existing method MergeRequest.join_project.
Creating scope :references_project. Overwriting existing method MergeRequest.references_project.
Creating scope :system. Overwriting existing method Note.system.
Creating scope :order_created_desc. Overwriting existing method Packages::Package.order_created_desc.
Creating scope :order_name_desc. Overwriting existing method Packages::Package.order_name_desc.
Creating scope :auth. Overwriting existing method Key.auth.
Creating scope :signing. Overwriting existing method Key.signing.
Creating scope :open. Overwriting existing method AbuseReport.open.
Creating scope :open. Overwriting existing method AlertManagement::Alert.open.
Creating scope :active. Overwriting existing method Clusters::AgentToken.active.
Creating scope :open. Overwriting existing method IncidentManagement::IssuableEscalationStatus.open.
Creating scope :without_statuses. Overwriting existing method Ci::Stage.without_statuses.
Creating scope :created. Overwriting existing method Ci::Stage.created.
Creating scope :pending. Overwriting existing method Ci::Stage.pending.
Creating scope :running. Overwriting existing method Ci::Stage.running.
Creating scope :success. Overwriting existing method Ci::Stage.success.
Creating scope :failed. Overwriting existing method Ci::Stage.failed.
Creating scope :canceled. Overwriting existing method Ci::Stage.canceled.
Creating scope :skipped. Overwriting existing method Ci::Stage.skipped.
Creating scope :manual. Overwriting existing method Ci::Stage.manual.
Creating scope :scheduled. Overwriting existing method Ci::Stage.scheduled.
Creating scope :preparing. Overwriting existing method Ci::Stage.preparing.
Creating scope :waiting_for_resource. Overwriting existing method Ci::Stage.waiting_for_resource.
Creating scope :order_name_asc. Overwriting existing method Label.order_name_asc.
Creating scope :order_name_desc. Overwriting existing method Label.order_name_desc.
Creating scope :open. Overwriting existing method ExternalPullRequest.open.
Creating scope :not_expired. Overwriting existing method Member.not_expired.
Creating scope :order_name_asc. Overwriting existing method Member.order_name_asc.
Creating scope :order_name_desc. Overwriting existing method Member.order_name_desc.
Creating scope :system. Overwriting existing method PrometheusMetric.system.
Creating scope :database. Overwriting existing method Ci::BuildTraceChunk.database.
Creating scope :with_user. Overwriting existing method GroupMember.with_user.
Creating scope :system. Overwriting existing method Gitlab::DatabaseImporters::CommonMetrics::PrometheusMetric.system.
Creating scope :human. Overwriting existing method User.human.

sudo gitlab-ctl status

run: alertmanager: (pid 31578) 62810s; run: log: (pid 7644) 153196s
run: gitaly: (pid 31592) 62810s; run: log: (pid 7636) 153197s
run: gitlab-exporter: (pid 31615) 62809s; run: log: (pid 7608) 153197s
run: gitlab-kas: (pid 31685) 62799s; run: log: (pid 7594) 153197s
run: gitlab-workhorse: (pid 31699) 62799s; run: log: (pid 7621) 153197s
run: logrotate: (pid 27971) 1598s; run: log: (pid 7593) 153197s
run: nginx: (pid 31733) 62798s; run: log: (pid 7602) 153197s
run: node-exporter: (pid 31746) 62798s; run: log: (pid 7599) 153197s
run: postgres-exporter: (pid 31754) 62797s; run: log: (pid 7605) 153197s
run: postgresql: (pid 31763) 62797s; run: log: (pid 7610) 153197s
run: prometheus: (pid 31776) 62797s; run: log: (pid 7618) 153197s
run: puma: (pid 3441) 2s; run: log: (pid 7597) 153197s
run: redis: (pid 31799) 62795s; run: log: (pid 7649) 153196s
run: redis-exporter: (pid 31806) 62794s; run: log: (pid 7601) 153197s
run: sidekiq: (pid 31862) 62790s; run: log: (pid 7638) 153197s

Please, Help me…ㅜㅜ

Did you edit this file manually? If so, you are not meant to. All changes are supposed to be made in /etc/gitlab/gitlab.rb

What were you doing before the 502 error started? Did you upgrade? Or were you editing files that caused it? If so, what changes did you make?

Gitlab doesn’t suddenly get a 502 error unless someone was changing something on the server.

Thank you for your reply.
I didn’t modify any files myself.
I didn’t do anything to the server before I got the 502 error, because only administrators can access the server.
I’m a new administrator, so this is my first time using gitlab server.
So it’s harder. I want to cry.

I solved it.
I modified my gitlab setting.
before
puma[‘listen’] = ‘0.0.0.0’
puma[‘port’] = 8080
after
puma[‘listen’] = ‘127.0.0.1’
puma[‘port’] = 7776

1 Like