4

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

  1. dev and prod will use the identical setup
  2. file changes are reflected as soon as we commit/deploy the files
  3. ideally only the files affected get a new version

Please keep in mind that dev commits from our SVN are very frequent and we are looking for an automated system that will take care of the versioning without replicating entire directories, etc.

Would love suggestions on the most effective way to implement the above since we are new to using a CDN.

cdeszaq
  • 30,869
  • 25
  • 117
  • 173
user627474
  • 71
  • 4
  • Are you looking for a way to version the files out _on the cdn_, or a way to version the files being linked to from the code that _references the cdn_? – cdeszaq Sep 14 '11 at 16:02
  • Refer this : http://stackoverflow.com/questions/9509069/versioning-in-a-cdn – siddhusingh Dec 17 '13 at 10:37

1 Answers1

0

Some frameworks, like Grails, have plugins that can take care of static resource versioning for you, taking care of linking the version-named files correctly into where you use the file, and only bumping the version of files that have changed.

If you are in an environment like that, those plugins are fantastic and usually work very well, but if not, the most generally applicable thing you can do would be to put together a series of scripts that get triggered by a pre-commit SVN hook script. The scripts would need to take care of version-stamping the files that have changed. Depending on what framework(s) you are using, reflecting the name of the resource files in the code will be more problematic, but you could either write a plugin that can figure it out on the fly, based on non-versioned file-name pattern matching, or simply updates the reference directly in the code (something like sed or awk could do this, in theory, though it would probably take some 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 version the changed files and then search/replace your codebase for places where those filenames need to be updated and make the change.

cdeszaq
  • 30,869
  • 25
  • 117
  • 173