Skip to content

Commit

Permalink
Fix browser caching issue in deployment script
Browse files Browse the repository at this point in the history
When extracting the jar file, jar xf restores the timestamp of the file as it was
in the jarfile. This is not ideal, because it artificially sets the change time of
the file to the past, and therefore browser caches will ignore the new file.
  • Loading branch information
steventrouble committed Nov 21, 2023
1 parent d6203ef commit 3719128
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ansible/install-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@
group: iam-dev
mode: 0664
backup: true
register: warfile

# unpack the cs.war file
- name: unpack cs.war
shell: "rm -rf /data/webapps/cs; mkdir /data/webapps/cs; cd /data/webapps/cs; jar xf /data/local/wars/cs.war"
when: warfile.changed
# When unzipping, use -DD to update the last modified time of each extracted file
# Otherwise, the browser cache will not pick up the new version of the file!
shell: "rm -rf /data/webapps/cs; mkdir /data/webapps/cs; cd /data/webapps/cs; unzip -DD /data/local/wars/cs.war"
notify:
- restart tomcat

Expand Down

0 comments on commit 3719128

Please sign in to comment.