Coder Social home page Coder Social logo

azure-purge's Introduction

Microsoft Azure CDN Adapter for TYPO3

When TYPO3 is behind an Azure's CDN Profile, this extension is a perfect companion for you.

This extension hides the complexity of Azure's CDN API to purge caches.

Installation

You can install this extension by using composer:

composer req b13/azure-purge

Usage

By default, EXT:azure-purge ships with a azure:cdnpurge CLI command to purge a full CDN profile or a specific URL within the CDN profile.

It is possible to purge a single or multiple URLs

./vendor/bin/typo3 azure:cdnpurge --url=/page1 --url=/page2

or purge a whole CDN Profile

./vendor/bin/typo3 azure:cdnpurge --profile=abcdef

Integration into TYPO3 Backend

EXT:azure-purge can be used in conjunction with TYPO3's Proxy Cache Manager Extension.

Using the Azure CDN Adapter for EXT:proxycachemanager flushes page caches directly when modifying a page. This is perfect if you're dealing with Azure CDN that not just caches your static assets but also your pages.

For this, ensure to set the class \B13\AzurePurge\Provider\AzureProxyProvider in the settings of EXT:proxycachemanager.

Configuration

This extension purges CDN caches via cURL requests wrapped in the Guzzle API (bundled in TYPO3) instead of using the CLI binary az as requested by most examples.

For this reason, a OAuth Client with a Client ID, Tenant ID and a Secret must be created within Azure Portal first.

TYPO3 then creates an Access Token (oauth2/authorize), which is then used to purge content on the Azure CDN Profile.

Azure thus requires:

  • Azure App ID / Client ID
  • Azure Tenant ID
  • Azure Client Secret

Then:

  • Azure Subscription
  • Azure Resource Group
  • Azure CDN Profile
  • Azure CDN Endpoint
  • Optional: FrontDoor ID

All need to be provided via Environment variables:

  • AZURE_CLIENT_ID
  • AZURE_TENANT_ID
  • AZURE_CLIENT_SECRET
  • AZURE_SUBSCRIPTION_ID
  • AZURE_RESOURCE_GROUP
  • AZURE_CDN_PROFILE
  • AZURE_CDN_ENDPOINT
  • AZURE_FRONTDOOR

Support for Azure FrontDoors

See https://docs.microsoft.com/de-de/rest/api/frontdoorservice/frontdoor/endpoints/purge-content

Ensure to set the environment variable AZURE_FRONTDOOR to the Front Door Name.

Using multiple sections / CDN endpoints in Site Configuration

This isn't implemented yet.

License

The extension is licensed under GPL v2+, same as the TYPO3 Core. For details see the LICENSE file in this repository.

Icon courtesy of Microsoft Azure Icon Pack. https://docs.microsoft.com/de-de/azure/architecture/icons/

Open Issues

If you find an issue, feel free to create an issue on GitHub or a pull request.

Credits

This extension was created by Benni Mack in 2022 for b13 GmbH.

Find more TYPO3 extensions we have developed that help us deliver value in client projects. As part of the way we work, we focus on testing and best practices to ensure long-term performance, reliability, and results in all our code.

azure-purge's People

Contributors

bmack avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.