Sometimes it's necessary to deploy front-end code directly into the running application.
Create the ticket
First thing is to create a ticket for the required task. This should include as much details as possible like any files that need to be synced with the CDN, file structure etc. Here's a set of rules to help with that process.
- Provide a deadline for the deployment task.
- Include clear guidance on what files need to change and where they reside within the application file structure.
- Be as explicit as possible to avoid confusion.
Packaging the hot-fix
To make the deployment as low risk as possible, files should be provided to the Ops team packed within a ZIP archive following the correct layout as they need to reside within the running applications filesystem. For example If we need to update the file
/vwshop/src/main/webapp/skin/js/zinc/pages/checkout.js within the mantiki project we would package the file as follow.
As you can see, I've packed up the checkout.js file a ZIP archive. The archive contains two folders. Once for the main virginwines.co.uk site and the other for mailwineclub.co.uk.
Deploying the hot-fix
Once everything has been provided to the appropriate people and the release has been approved, the Ops team should
- Deploy the archive file to /vwnfs/mantiki/hot_fix/${CURRENT_DEPLOYED_VERSION}/ (e.g., /vwnfs/mantiki/hot_fix/8.3.4/hotfix.zip)
- Unpack the archive to a containing directory (e.g., /vwnfs/mantiki/hot_fix/8.3.4/unpacked)
Generate an invalidation CSS statement. Here's a one liner to run on the command line
$> find unpacked/ -type f | tr "\n" "," | sed 's/,/*,/g' | sed 's|^./||' > invalidation.csv
- Deploy files to all existing application servers.
- Run invalidation on Cloudfront using the generated CSV.