Skip to content

Commit 8f108ca

Browse files
committed
doc: Update nginx runbook for new infra
1 parent 10b6c59 commit 8f108ca

File tree

1 file changed

+29
-38
lines changed

1 file changed

+29
-38
lines changed

doc/runbook-nginx-debug.md

Lines changed: 29 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,47 @@
11
# Runbook: Nginx debugging
22

3+
## Local curl
4+
5+
Use `--connect-to` to bypass any CDN and test the origin directly.
6+
7+
```
8+
you@laptop$ curl -I 'https://view.jquery.com/bar' --connect-to '::miscweb-01.ops.jquery.net'
9+
```
10+
11+
You can also do this from the origin itself over SSH
12+
13+
```
14+
krinkle@miscweb-01:~$ curl -v -I 'https://view.jquery.com/bar' --connect-to ::localhost
15+
```
16+
317
## Staging and testing
418

5-
* Push to `puppet-stage`.
6-
* Apply on **wp-01.stage**.ops by running `sudo puppet agent -tv` there.
19+
For nginx changes to WordPress hosts, you can use staging:
20+
21+
* Push edits to `staging` branch.
22+
* SSH to a stage host (e.g. **wp-03.stage**.ops) and run `sudo run-puppet-agent` there.
723
* If there are errors, especially the `Nginx[refresh]` line, then stop and fix the patch.
824
* To get more details on the error, use `sudo service nginx configtest` and `sudo nginx -t`.
9-
* Push to `puppet-master`.
10-
* Apply on `wp-02.ops` by running `sudo puppet agent -tv` there. Confirm content sites (besides releases/codeorigin) are fine.
11-
* Apply on `wp-03.ops` by running `sudo puppet agent -tv` there. Confirm codeorigin is fine.
25+
* Once happy, forward to `production`.
26+
* Apply on relevant prod (e.g. wp-05 for jqueryui, wp-04 for jquery) by running `sudo run-puppet-agent` there and confirming the behaviour afterwards. Use local curl (example below) instead of the public Clouflare-cached URL if caching might be at play.
1227

1328
## Live hacking
1429

15-
To test and **debug Nginx changes** for jQuery content sites hosted on wp-01, wp-02, or wp03.
30+
Sometimes iterating through the staging branch is tedious, or there might not be a staging version (e.g. miscweb). To iterate, debug, or preview Nginx changes you can do the following on any wp-stage, codeorigin-stage, or miscweb host.
1631

17-
The staging server is **wp-01.stage** (for all sites, including codeorigin).
18-
19-
1. Edit the appropriate file under `/tmp/nginx.d/`, e.g. using `sudo nano` (vim isn't installable currently).
20-
2. Then perform the same notify command as Puppet would do:
21-
```
22-
sudo sh -c '/bin/cat /tmp/nginx.d/* > /etc/nginx/conf.d/vhost_autogen.conf'
23-
```
24-
3. Then reload the nginx service:
32+
1. Edit the appropriate file under `/etc/nginx/sites-available/`, e.g. using `sudo nano myfile.txt`.
33+
2. Perform reload nginx, just as Puppet would do:
2534
```
2635
sudo service nginx reload
2736
```
28-
4. Perform your test against HTTP localhost using `curl` and a Host header. Remember that on the staging server, the hostnames have a `stage.` prefix, for example:
29-
```
30-
wp-01.stage$ curl -i 'http://localhost/color/jquery.color-2.2.0.min.js' -H 'Host: stage.codeorigin.jquery.com'
31-
32-
wp-01.stage$ curl -i 'http://localhost/git/example-git.js' -H 'Host: stage.releases.jquery.com'
33-
34-
wp-01.stage$ curl -i 'http://localhost/purge/?uri=/qunit/' -H 'Host: stage.releases.jquery.com'
35-
wp-01.stage$ curl -i 'http://localhost/purge/?site=code&uri=/jquery-3.6.0.js' -H 'Host: stage.releases.jquery.com'
36-
wp-01.stage$ curl -i 'http://localhost/purge/?site=code&uri=/color/jquery.color-2.2.0.min.js' -H 'Host: stage.releases.jquery.com'
37-
38-
wp-03$ curl -i 'http://localhost/git/color/jquery.color-git.min.js' -H 'Host: releases.jquery.com'
39-
wp-03$ curl -i 'http://localhost/git/color/jquery.color-git.min.js' -H 'Host: codeorigin.jquery.com'
40-
wp-03$ curl -i 'http://localhost/color/color/jquery.color-2.2.0.min.js' -H 'Host: codeorigin.jquery.com'
41-
37+
3. Perform your test against HTTP localhost using `curl` and a Host header. Remember that on the staging server, the hostnames have a `stage.` prefix in the URL hostname:
4238
```
43-
Or, to test from the outside, use `--connect-to` to bypass Cloudflare and simulate a direct request:
44-
```
45-
curl -I 'https://view.jquery.com/bar' --connect-to '::wp-01.ops.jquery.net'
39+
curl -I 'https://view.jquery.com/bar' --connect-to '::wp-05.ops.jquery.net'
4640
```
4741

48-
Beware that Puppet will run every 30 minutes and may overwrite these changes.
49-
* Check `sudo tail -n100 /var/log/syslog`, to see when Puppet last ran.
50-
* To temporarily disable puppet: `puppet agent --disable "message here"`
42+
Beware that Puppet will run every 30 minutes and may overwrite your changes while you're live hacking.
43+
* Check `sudo journalctl -u puppet -n 20`, to see when Puppet last ran.
44+
* To temporarily pause puppet: `puppet agent --disable "message here"`
5145
* When done, re-enable puppet: `puppet agent --enable`
52-
* To undo your changes, run puppet so that it restores the state: `puppet agent -tv`.
53-
54-
## See also
46+
* To undo your changes, simply run puppet: `sudo run-puppet-agent`.
5547

56-
Ref https://github.com/jquery/infrastructure/commit/79ae864005a12dab9affa502fd5dc5291fff504c

0 commit comments

Comments
 (0)