-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🐛 Set timezone to Europe/London (successfully, this time) #229
Conversation
We are currently running the application on UTC timezone because there isn't any `/etc/localtime` file on the server This change adds a (currently failing) build-time check for existence of the timezone file we are trying to use
Fixes the build check introduced in the previous commit
@@ -7,7 +7,10 @@ FROM node:14-alpine3.13 as base | |||
LABEL maintainer="HMPPS Digital Studio <[email protected]>" | |||
|
|||
ENV TZ=Europe/London | |||
RUN ln -snf "/usr/share/zoneinfo/$TZ" /etc/localtime && echo "$TZ" > /etc/timezone | |||
RUN apk add --no-cache tzdata && \ | |||
test -e "/usr/share/zoneinfo/$TZ" && \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of this line, we could also add a "docker build test" that would test the timezone by running the date
command:
$ docker run --rm -ti <built_tag> date | egrep "(GMT|BST)"
Thu Apr 8 15:55:29 BST 2021
# exit status 0
vs
$ k exec -ti hmpps-interventions-ui-5fc67cffcd-z4kgx -- date | egrep "(GMT|BST)"
# exit status 1, thus failing the build
However, this isn't trivial to chain after the docker build, before the push at the moment
What impact does this have on the application? Do you have an example of how the container's time zone is affecting its behaviour? Edit: I guess that from this you mean it doesn't affect the UI app?
|
without properly understanding the context - it doesn't seem appropriate to rely on the TZ of the container for anything at all. we have libraries already in use in this repo that allow formatting in whatever TZ you like. e.g.
|
Apologies, I skimmed over a few important points
I'm perfectly happy to switch this to be explicitly UTC (and open a similar in the service) -- what do you prefer? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agree with your comments david. we shouldn't rely on this, but setting it correctly can't be a bad thing.
What does this pull request do?
This PR fixes a 🐛 about setting the timezone to Europe/London in the Docker build.
As part of a set of conversations with @mahalrmoj we've discovered that the UI app is currently running on UTC:
How?
Result:
What is the intent behind these changes?
To make sure the service is running in Europe/London timezone. It has no material impact on our APIs, but it's the least surprising default :) -- At least it doesn't look like we're setting the timezone when we aren't.