Page MenuHomePhabricator

Let HAProxy handle port 80
Closed, ResolvedPublic

Description

Analogue to the deprecated T254235, HAProxy should handle port 80 --> 443 redirection

Current state: the cache hosts on the following datacenters have been correctly updated (HAProxy and Varnish configurations) via the dedicated cookbook to swap port 80 management from Varnish to HAProxy.

  • drmrs (text and upload)
  • esams (text and upload)
  • codfw (text and upload)
  • eqiad (text and upload)

The Varnish and HAProxy configuration on the following datacenters has been updated previously without cookbook:

  • eqsin (text and upload)
  • ulsfo (text and upload)

Event Timeline

Vgutierrez created this task.
Vgutierrez updated the task description. (Show Details)
BCornwall changed the task status from Open to Stalled.Feb 22 2023, 6:05 PM
BCornwall moved this task from Backlog to Traffic team actively servicing on the Traffic board.
BCornwall subscribed.
BCornwall changed the task status from Stalled to In Progress.Apr 25 2023, 9:00 PM
BCornwall added a subscriber: BTullis.

After talking with @Vgutierrez these are the steps the cookbook needs to implement:

  1. Depool the host
  2. Set profile::cache::varnish::frontend::enable_http_redirection: false (via netbox->hiera)
  3. Run puppet
  4. Restart varnish
  5. Set profile::cache::haproxy::http_redirection_port: 80 via netxbox->hiera
  6. Run puppet
  7. Repool the host

The action plan is slightly changed thanks to the contribution of @Vgutierrez and @Volans .
Now the checklist is more like (on a per-DC basis):

  1. Disable puppet on all impacted hosts
  2. Merge the changes on hiera (no need to use netbox->hiera function anymore)

The next steps are on a per-host basis:

  1. Depool the host
  2. Stop Varnish
  3. Enable and run Puppet (varnish configuration will be updated, haproxy configuration will be updated and haproxy service reloaded)
  4. Start Varnish
  5. Test that haproxy is actually listening on port 80 and performs the correct redirect
  6. Repool the host

Change 922844 had a related patch set uploaded (by Fabfur; author: Fabfur):

[operations/cookbooks@master] Add a new cookbook that allows to run puppet configuration while restarting Varnish

https://gerrit.wikimedia.org/r/922844

Change 922844 merged by Vgutierrez:

[operations/cookbooks@master] SRE: Add a new cookbook that allows to run puppet configuration while restarting Varnish

https://gerrit.wikimedia.org/r/922844

Change 924444 had a related patch set uploaded (by Fabfur; author: Fabfur):

[operations/puppet@production] cache::upload: Add hieradata to switch HTTPS redirection from Varnish to HAProxy

https://gerrit.wikimedia.org/r/924444

As the cookbook is ready for testing we can try to merge the hieradata and do the puppet disable on the codfw hosts.

Change 924527 had a related patch set uploaded (by Fabfur; author: Fabfur):

[operations/cookbooks@master] run-puppet-restart-varnish: fix _custom_action signature

https://gerrit.wikimedia.org/r/924527

Change 924527 merged by jenkins-bot:

[operations/cookbooks@master] run-puppet-restart-varnish: fix _custom_action signature

https://gerrit.wikimedia.org/r/924527

Change 924590 had a related patch set uploaded (by Fabfur; author: Fabfur):

[operations/cookbooks@master] run-puppet-restart-varnish: Add dry_run support to check function

https://gerrit.wikimedia.org/r/924590

Change 924590 merged by jenkins-bot:

[operations/cookbooks@master] run-puppet-restart-varnish: Add dry_run support to check function

https://gerrit.wikimedia.org/r/924590

Change 924444 merged by Fabfur:

[operations/puppet@production] cache::upload: Switch HTTPS redirection from Varnish to HAProxy only on cp2042

https://gerrit.wikimedia.org/r/924444

Change 924894 had a related patch set uploaded (by Fabfur; author: Fabfur):

[operations/puppet@production] hiera: Applying port 80 redirection on upload cluster in codfw

https://gerrit.wikimedia.org/r/924894

Change 924894 merged by Fabfur:

[operations/puppet@production] hiera: Swap port 80 from varnish to haproxy on codfw upload cluster

https://gerrit.wikimedia.org/r/924894

Change 924919 had a related patch set uploaded (by Vgutierrez; author: Vgutierrez):

[operations/puppet@production] hiera: Swap port 80 from varnish to haproxy on codfw@text

https://gerrit.wikimedia.org/r/924919

Change 924919 merged by Vgutierrez:

[operations/puppet@production] hiera: Swap port 80 from varnish to haproxy on text@codfw

https://gerrit.wikimedia.org/r/924919

Change 925779 had a related patch set uploaded (by Fabfur; author: Fabfur):

[operations/puppet@production] hiera: Swap port 80 from varnish to haproxy on all drmrs clusters

https://gerrit.wikimedia.org/r/925779

Mentioned in SAL (#wikimedia-operations) [2023-06-01T14:14:12Z] <fabfur> Disabled puppet on A:cp-drmrs for T323557

Change 925779 merged by Fabfur:

[operations/puppet@production] hiera: Swap port 80 from varnish to haproxy on drmrs caching clusters

https://gerrit.wikimedia.org/r/925779

Change 927580 had a related patch set uploaded (by Fabfur; author: Fabfur):

[operations/puppet@production] hiera: Swap port 80 from varnish to haproxy on drmrs upload cluster

https://gerrit.wikimedia.org/r/927580

Change 927580 merged by Fabfur:

[operations/puppet@production] hiera: Swap port 80 from varnish to haproxy on drmrs upload cluster

https://gerrit.wikimedia.org/r/927580

Change 927591 had a related patch set uploaded (by Fabfur; author: Fabfur):

[operations/puppet@production] hiera: Swap port 80 from varnish to haproxy on drmrs text cluster

https://gerrit.wikimedia.org/r/927591

Change 927591 merged by Fabfur:

[operations/puppet@production] hiera: Swap port 80 from varnish to haproxy on drmrs text cluster

https://gerrit.wikimedia.org/r/927591

Change 927715 had a related patch set uploaded (by Fabfur; author: Fabfur):

[operations/puppet@production] hiera: Swap port 80 from varnish to haproxy in eqiad

https://gerrit.wikimedia.org/r/927715

Fabfur updated the task description. (Show Details)
Fabfur updated the task description. (Show Details)

Change 927715 merged by Fabfur:

[operations/puppet@production] hiera: Swap port 80 from varnish to haproxy in eqiad

https://gerrit.wikimedia.org/r/927715

vgutierrez@cumin1001:~$ sudo -i cumin A:cp "ss --listen -t -p '( sport = :http )'  |grep haproxy |wc -l"
96 hosts will be targeted:
cp[2027-2042].codfw.wmnet,cp[6001-6016].drmrs.wmnet,cp[1075-1090].eqiad.wmnet,cp[5017-5032].eqsin.wmnet,cp[3050-3065].esams.wmnet,cp[4037-4052].ulsfo.wmnet
OK to proceed on 96 hosts? Enter the number of affected hosts to confirm or "q" to quit: 96
===== NODE GROUP =====
(96) cp[2027-2042].codfw.wmnet,cp[6001-6016].drmrs.wmnet,cp[1075-1090].eqiad.wmnet,cp[5017-5032].eqsin.wmnet,cp[3050-3065].esams.wmnet,cp[4037-4052].ulsfo.wmnet
----- OUTPUT of 'ss --listen -t -...p haproxy |wc -l' -----
2

thanks @Fabfur

All cp* hosts are now updated with HAProxy listening on port 80

Change 929989 had a related patch set uploaded (by Fabfur; author: Fabfur):

[operations/puppet@production] hiera: Consolidate http redirection directive across all DCs

https://gerrit.wikimedia.org/r/929989

Change 929989 merged by Fabfur:

[operations/puppet@production] hiera: Consolidate http redirection directive across all DCs

https://gerrit.wikimedia.org/r/929989

Change 933881 had a related patch set uploaded (by Fabfur; author: Fabfur):

[operations/puppet@production] cache: Setting port 80 as default redirection port in haproxy

https://gerrit.wikimedia.org/r/933881

Change 933881 merged by Fabfur:

[operations/puppet@production] cache: Setting port 80 as default redirection port in haproxy

https://gerrit.wikimedia.org/r/933881

Change 934328 had a related patch set uploaded (by Fabfur; author: Fabfur):

[operations/puppet@production] varnish: Remove http/https redirection

https://gerrit.wikimedia.org/r/934328

Change 934328 merged by Fabfur:

[operations/puppet@production] varnish: Remove http/https redirection

https://gerrit.wikimedia.org/r/934328

The HAProxy configuration on all DCs has been updated to apply silent-drop to abusive clients hitting port 80, as been already done for port 443.

To check (eg. from cumin) if HAProxy is "silent-dropping" connections:

For port 443:
sudo cumin --ignore-exit-codes A:cp 'journalctl -u haproxy --since=-1h | grep silent-drop_for'

For port 80:
sudo cumin --ignore-exit-codes A:cp 'journalctl -u haproxy --since=-1h | grep silent-drop_port80_for'