mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-06 10:59:59 +00:00
Tooling integration
* add .markdownlint-cli2.jsonc, .ansible-lint, .ansible-lint-ignore
configs (permissive day-1: cosmetic rules disabled, semantic ones on)
* extend scripts/install/lint.sh with generic install_pip_pkg helper +
ensure_ansible_lint / ensure_galaxy_importer / ensure_markdownlint_cli2
ensure_* functions (pip / npm with sudo / --user / --break-system-packages
fallbacks). install_ansible_tools now also pulls ansible-lint and
galaxy-importer; new `markdown` install group.
* extend scripts/lint/ansible.sh to run ansible-lint after the existing
syntax-check.
* add scripts/lint/markdown.sh and scripts/lint/galaxy.sh runners. The
galaxy runner parallelizes via xargs (-P=$(nproc)), prints OK/FAIL per
role, and treats `bare-name dependency` errors as success since our
roles/ tree is not a Galaxy collection layout. All other Galaxy schema
errors still fail.
* Makefile: new lint-markdown and lint-galaxy targets, both wired into
`make lint`.
* CI: new workflows lint-markdown.yml and lint-galaxy.yml; lint-ansible.yml
now installs ansible-core + ansible-lint; ci-orchestrator wires both
new lint workflows into lint-gate.
Galaxy schema fixes
* shorten the canonical `galaxy_info.company` block from three lines to
two ("Kevin Veen-Birkenbach\nhttps://www.veen.world", 45 chars) so it
stays under Galaxy's hard 50-char limit. Updated everywhere: 229 role
meta/main.yml plus _CANONICAL_COMPANY in
tests/lint/repository/test_role_meta_main_galaxy_schema.py.
* shorten 19 over-long role descriptions to <=255 chars.
* add stub READMEs for sys-svc-compose-ca and sys-utils-service-loader.
Markdown baseline fixes
* markdownlint-cli2 --fix run repo-wide (formatting normalization
across CHANGELOG, role READMEs, docs).
* manual MD041 fixes: prepend H1 in 15 files (CHANGELOG, LICENSE,
TODO.md helpers, role README templates, etc.).
* MD025 / MD003 / MD001 / MD032 manual fixes for heading-style and
list-spacing edge cases.
* role README content polish: "## Single Point of Truth (SPOT)" headings
renamed to "## User data resolution" (D3 self-label rule).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
64 lines
2.9 KiB
Markdown
64 lines
2.9 KiB
Markdown
# Caching in OpenResty and Cloudflare
|
||
|
||
## Overview
|
||
|
||
When deploying OpenResty as a reverse proxy, content may be cached at multiple layers:
|
||
|
||
- **Local Proxy Cache:** If you configure NGINX/OpenResty with a cache zone (using directives like `proxy_cache`), responses can be stored locally on disk and served to future clients.
|
||
- **Browser Cache:** Browsers cache responses based on HTTP headers like `Cache-Control` or `Expires`.
|
||
- **CDN Cache (Cloudflare):** If your domain is proxied through Cloudflare, Cloudflare may cache your content at their edge servers and serve it from there, often without requests reaching your origin server.
|
||
|
||
## Troubleshooting Cache Issues
|
||
|
||
Caching can cause problems, especially when you update your web content or configuration but still receive outdated responses. Typical symptoms include:
|
||
|
||
- Changes to HTML/CSS/JS are not visible immediately.
|
||
- Old redirects or headers persist even after config changes.
|
||
- Assets do not update after a deployment.
|
||
|
||
If this happens, always consider all caching layers:
|
||
|
||
1. **Browser:** Clear the browser cache or use a private window.
|
||
2. **OpenResty:** If using a proxy cache, purge or clear the cache directory, or temporarily disable the cache zone.
|
||
3. **Cloudflare:** Purge the CDN cache as described below.
|
||
|
||
## Purging Cloudflare Cache
|
||
|
||
Cloudflare aggressively caches static content by default. Even after you deploy new files or update your proxy configuration, users may continue to see cached versions until the cache expires.
|
||
|
||
### Manual Purge via Cloudflare Dashboard
|
||
|
||
1. Log into your [Cloudflare dashboard](https://dash.cloudflare.com).
|
||
2. Select your domain.
|
||
3. Go to **Caching** → **Configuration**.
|
||
4. Click **Purge Cache**.
|
||
- Choose **Purge Everything** to delete all cached files (recommended after a deployment).
|
||
- Or use **Custom Purge** to specify individual URLs.
|
||
|
||
### Purge with Cloudflare API
|
||
|
||
You can also purge the cache programmatically with Cloudflare’s API:
|
||
|
||
```bash
|
||
curl -X POST "https://api.cloudflare.com/client/v4/zones/<ZONE_ID>/purge_cache" \
|
||
-H "Authorization: Bearer <YOUR_API_TOKEN>" \
|
||
-H "Content-Type: application/json" \
|
||
--data '{"purge_everything":true}'
|
||
````
|
||
|
||
- Replace `<ZONE_ID>` with your Cloudflare Zone ID.
|
||
- Replace `<YOUR_API_TOKEN>` with a valid API token with cache purge permissions.
|
||
|
||
To find your Zone ID, go to the overview page for your domain in the Cloudflare dashboard.
|
||
**Note:** It can take a few seconds for the cache to be purged globally.
|
||
|
||
## Recommendations
|
||
|
||
- Always purge the Cloudflare cache after significant changes to your website or OpenResty/NGINX configuration.
|
||
- If you use custom cache rules in OpenResty, consider providing cache-busting mechanisms (e.g., versioned URLs).
|
||
- Test changes in a private/incognito window to rule out browser cache.
|
||
|
||
## Further Reading
|
||
|
||
- [Cloudflare Purge Cache Documentation](https://developers.cloudflare.com/cache/how-to/purge-cache/)
|