Skip to content

Commit bd08fca

Browse files
Purge Cloudflare Cache On Deploy (#619)
* Purge Cloudflare Cache On Deploy * lock version to 2.8 * Update .env.example Add Cloudflare vars to .env.example --------- Co-authored-by: Jim Ciallella <1777776+allella@users.noreply.github.com>
1 parent 6c02e93 commit bd08fca

File tree

5 files changed

+119
-1
lines changed

5 files changed

+119
-1
lines changed

.env.example

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,3 +104,9 @@ EVENTS_API_DEFAULT_DAYS=1
104104
#VITE_SERVER_HMR_HOST=
105105

106106
# EVENT_DEBUG_LOGGING_ENABLED=0
107+
108+
# Cloudfare - primary use case is clearing the live / production website's cache
109+
# CLOUDFLARE_TOKEN=
110+
# CLOUDFLARE_KEY=
111+
# CLOUDFLARE_EMAIL=
112+
# CLOUDFLARE_PRODUCTION_ZONE_ID=

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"laravel/tinker": "^2.0",
2727
"malzariey/filament-daterangepicker-filter": "^2.7",
2828
"scyllaly/hcaptcha": "^4.4",
29+
"sebdesign/artisan-cloudflare": "^2.8",
2930
"spatie/icalendar-generator": "^2.9",
3031
"spatie/laravel-data": "*"
3132
},

composer.lock

Lines changed: 63 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/cloudflare.php

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?php
2+
3+
return [
4+
5+
/*
6+
* API token generated from the User Profile 'My Profile > Api Tokens > API Tokens' page.
7+
* create token > Edit zone DNS > "Permissions" Zone:Cache Purge:Purge
8+
*/
9+
'token' => env('CLOUDFLARE_TOKEN'),
10+
11+
/*
12+
* Global API Key on the "My Profile > Api Tokens > API Keys" page.
13+
*/
14+
'key' => env('CLOUDFLARE_KEY'),
15+
16+
/*
17+
* Email address associated with your account.
18+
*/
19+
'email' => env('CLOUDFLARE_EMAIL'),
20+
21+
/*
22+
* Array of zones.
23+
*
24+
* Each zone must have its identifier as a key. The value is an
25+
* associated array with *optional* arrays of files and/or tags.
26+
*
27+
* you can find your zoneId under 'Account Home > site > Api'.
28+
*
29+
* E.g.
30+
*
31+
* '023e105f4ecef8ad9ca31a8372d0c353' => [
32+
* 'files' => [
33+
* 'http://example.com/css/app.css',
34+
* ],
35+
* 'tags' => [
36+
* 'styles',
37+
* 'scripts',
38+
* ],
39+
* 'hosts' => [
40+
* 'www.example.com',
41+
* 'images.example.com',
42+
* ],
43+
* ],
44+
*/
45+
'zones' => [
46+
env('CLOUDFLARE_PRODUCTION_ZONE_ID') => [],
47+
],
48+
];

scripts/handle-deploy-update.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ php artisan view:cache
3131
php artisan event:cache
3232
php artisan icons:cache
3333
php artisan filament:cache-components
34+
php artisan cloudflare:cache:purge
3435
echo "Laravel optimization completed."
3536

3637
# Bundle and optimize assets

0 commit comments

Comments
 (0)