Skip to content

If web-php changes then bust Bunny CDN Cache#57

Open
svpernova09 wants to merge 1 commit into
php:mainfrom
svpernova09:bust-cache-if-web-php-changes
Open

If web-php changes then bust Bunny CDN Cache#57
svpernova09 wants to merge 1 commit into
php:mainfrom
svpernova09:bust-cache-if-web-php-changes

Conversation

@svpernova09

Copy link
Copy Markdown
Contributor

Depends on #56 before running this playbook.

Captures the output of the /local/systems/update-www script and, if there are changes, we bust the Bunny CDN cache.

Currently, this only affects the specified URL https://www.php.net/pre-release-builds.php*' but can be easily extended.

Running locally:

$ ansible-playbook initServiceStaticSites.yml

PLAY [static] ***********************************************************************************

TASK [Gather facts for rsync server] ************************************************************
ok: [service7 -> rsync0(192.168.1.52)] => (item=rsync0)

TASK [Install common software and configuration] ************************************************
included: install_common_software for service7

<SNIP>

TASK [properties/www : Create local directory to store www content] *****************************
ok: [service7]

TASK [properties/www : Copy update-www script to the server] ************************************
changed: [service7]

TASK [properties/www : Create a cron job to run every 5 minutes] ********************************
ok: [service7]

<SNIP>

TASK [properties/windows : Put robots.txt in document root] *************************************
ok: [service7]

PLAY RECAP **************************************************************************************
service7 : ok=115  changed=2    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0

ansible-playbook initServiceStaticSites.yml: 00:44

Any URLS we should go ahead and add now?

@svpernova09
svpernova09 requested a review from derickr July 17, 2026 20:52
# rsync actually pulled new content (avoids purging on every 5-minute run)
if [ -n "$CHANGES" ]; then
curl --fail --silent --show-error --request POST \
--url 'https://api.bunny.net/purge?url=https://www.php.net/pre-release-builds.php*' \

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This probably works for now as a single item, but I do think it would be better to define these in a list in a config file, with a loop here, if we add even a single extra line — or, perhaps right from the start.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, we could maintain that list in the vars and loop over to make this less static.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants