Fix Timezone Handling for Containers#375
Fix Timezone Handling for Containers#375LSI-ZuagrastaWastl wants to merge 3 commits intoMISP:masterfrom
Conversation
Add timezone setting option to template.env
- Add timezone environment variable to all services - Setting Default to "UTC"
- Add timezone configuration for PHP in docker-compose file. - Replace PHP timezone in misp-core with the new config-file tzone.ini Perhaps there are better solutions for changing the time zone from PHP during runtime.
| retries: 3 | ||
| start_period: 10s | ||
|
|
||
| configs: |
There was a problem hiding this comment.
Could you move this to a separate file and edit Dockerfile to COPY it at build time and run sed in there (like we do with the PHP files?
Your solution is much cleaner, but not everybody is using docker-compose.yml.
There was a problem hiding this comment.
In fact, I had primarily focused on the fact that when using docker-compose.yml, you have the option of setting the time zone everywhere. And as far as I can see, configs: must therefore remain in docker-compose.yml for the PHP-Settings.
As far as I can see, for the build-time is the timezone setting via ${PHP_TIMEZONE}.
misp-docker/core/files/entrypoint_fpm.sh
Line 50 in b12a20c
Therefore, in my opinion, no additional file would be necessary.
However, this variable has no effect on a finished image via
docker-Compose.yml.
I could imagine that you could ensure that either ${PHP_TIMEZONE} or ${TZ:-UTC} is used. This means you only have to set it once in .env in example like this
sed -i "s/;?date.timezone = .*/date.timezone = ${PHP_TIMEZONE:-${TZ:-UTC}}/" "$FILE"
And probably here
Line 116 in b12a20c
would be better
ENV TZ= ${TZ:-UTC}.
What do you think about it @ostefano ?
This PR standardizes timezone handling across all MISP Docker containers.
The timezone can now be set optionally via the
TZenvironment variable.If defined, it is applied globally and consistently across all containers and all processes, including system services, supervisord, background jobs, logs, and the MISP web interface.
If
TZis not set, the default remainsUTC.Changes
UTCBenefits
Best Regards from Bayern-CERT