Skip to content

Add a gitlab:tcp_check rake task

Nick Thomas requested to merge (removed):add-tcp-check-rake-task into master

What does this MR do?

Adds a rake task that checks whether TCP connectivity to a given host + port is working.

It can be used like:

rake gitlab:tcp_check[example.com,5432]

Are there points in the code the reviewer needs to double check?

I don't see any need for this to be EE-specific so I put it in gitlab-ce. It could have gone in omnibus instead, but I didn't see a strong need for that and it's usable by more people here.

Why was this MR needed?

Geo documentation needs to include a step where we check TCP connectivity to a remote host.

Screenshots (if relevant)

# Missing arguments
$ rake gitlab:tcp_check
Please specify a host and port: `rake gitlab:tcp_check[example.com,80]`

# Successful connection over IPv6
$ rake gitlab:tcp_check[google.com,443]
TCP connection from [2001:ba8:1f1:901:228:f8ff:fe7a:4f2c]:58256 to [2a00:1450:4009:815::200e]:443 succeeded

# Successful connection over IPv4
$ rake gitlab:tcp_check[10.0.1.1,443]
TCP connection from 10.0.1.104:60612 to 10.0.1.1:443 succeeded

# Failed connection due to firewall -j REJECT
$ rake gitlab:tcp_check[google.com,5432]
TCP connection to google.com:5432 failed: Connection refused - connect(2) for 216.58.206.78:5432

Check that host and port are correct, and that the traffic is permitted through any firewalls.

# Failed connection due to firewall -j DROP (runs in 10 seconds)
$ rake gitlab:tcp_check[ur.gs,5432]
TCP connection to ur.gs:5432 failed: Connection timed out - user specified timeout

Check that host and port are correct, and that the traffic is permitted through any firewalls.

Does this MR meet the acceptance criteria?

What are the relevant issue numbers?

Related to https://gitlab.com/gitlab-org/gitlab-ee/issues/4240

Omnibus version: omnibus-gitlab!2130 (closed) - I really prefer this version to that one.

Edited by Rémy Coutable

Merge request reports

Loading