Best Way to Make CDN Versioning

We currently have a development server (dev) and a production server, and we will soon start using CDN for our static resources. As a result, we would like to implement the most effective version control system, which will meet the following requirements:

  • dev and prod will use the same setting
  • file changes are reflected as soon as we commit / deploy files
  • ideally, only the files affected by the files receive the new version

Please keep in mind that dev performs our SVNs very often, and we are looking for an automated system that will take care of the version without replicating all directories, etc.

I would like to express my wishes on the most effective way to implement the above, since we are new to using CDN.

+4
source share
1 answer

Some frameworks, such as Grails, have plugins that can take care of static version control for you, taking care of correctly linking files called versions to where you use this file, and only overload the version of files that have been changed.

If you are in such an environment, these plugins are fantastic and usually work very well, but if not, the most common thing you can do would be to put together a series of scripts that are run using a pre- bind SVN script. Scripts will have to take care to format files that have been modified. Depending on which framework you use, displaying the name of the resource files in the code will be more problematic, but you can either write a plug-in that can understand it on the fly, based on an unidentified file name, pattern matching, or simply update the link directly in the code (something like sed or awk can do this, theoretically, although it will probably require impressive scripting skills)

So, the best solution would be to find a plugin for your framework that can handle it transparently for you. The next best option would be a series of pre-commit hook scripts that will update the modified files and then search / replace your codebase for the places where these file names should be updated and make changes.

0
source

Source: https://habr.com/ru/post/1340718/


All Articles