diff --git a/README.md b/README.md index cb903f331..f42089b31 100644 --- a/README.md +++ b/README.md @@ -781,13 +781,14 @@ Below is the complete list of available options that can be used to customize yo | Parameter | Description | |-----------|-------------| | `DEBUG` | Set this to `true` to enable entrypoint debugging. | +| `TZ` | Set the container timezone. Defaults to `UTC`. Values are expected to be in Canonical format. Example: `Europe/Amsterdam` See the list of [acceptable values](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). For configuring the timezone of gitlab see variable `GITLAB_TIMEZONE`. | | `GITLAB_HOST` | The hostname of the GitLab server. Defaults to `localhost` | | `GITLAB_CI_HOST` | If you are migrating from GitLab CI use this parameter to configure the redirection to the GitLab service so that your existing runners continue to work without any changes. No defaults. | | `GITLAB_PORT` | The port of the GitLab server. This value indicates the public port on which the GitLab application will be accessible on the network and appropriately configures GitLab to generate the correct urls. It does not affect the port on which the internal nginx server will be listening on. Defaults to `443` if `GITLAB_HTTPS=true`, else defaults to `80`. | | `GITLAB_SECRETS_DB_KEY_BASE` | Encryption key for GitLab CI secret variables, as well as import credentials, in the database. Ensure that your key is at least 32 characters long and that you don't lose it. You can generate one using `pwgen -Bsv1 64`. If you are migrating from GitLab CI, you need to set this value to the value of `GITLAB_CI_SECRETS_DB_KEY_BASE`. No defaults. | | `GITLAB_SECRETS_SECRET_KEY_BASE` | Encryption key for session secrets. Ensure that your key is at least 64 characters long and that you don't lose it. This secret can be rotated with minimal impact - the main effect is that previously-sent password reset emails will no longer work. You can generate one using `pwgen -Bsv1 64`. No defaults. | | `GITLAB_SECRETS_OTP_KEY_BASE` | Encryption key for OTP related stuff with GitLab. Ensure that your key is at least 64 characters long and that you don't lose it. **If you lose or change this secret, 2FA will stop working for all users.** You can generate one using `pwgen -Bsv1 64`. No defaults. | -| `GITLAB_TIMEZONE` | Configure the timezone for the gitlab application. This configuration does not effect cron jobs. Defaults to `UTC`. See the list of [acceptable values](http://api.rubyonrails.org/classes/ActiveSupport/TimeZone.html). | +| `GITLAB_TIMEZONE` | Configure the timezone for the gitlab application. This configuration does not effect cron jobs. Defaults to `UTC`. See the list of [acceptable values](http://api.rubyonrails.org/classes/ActiveSupport/TimeZone.html). For settings the container timezone which will effect cron, see variable `TZ` | | `GITLAB_ROOT_PASSWORD` | The password for the root user on firstrun. Defaults to `5iveL!fe`. GitLab requires this to be at least **8 characters long**. | | `GITLAB_ROOT_EMAIL` | The email for the root user on firstrun. Defaults to `admin@example.com` | | `GITLAB_EMAIL` | The email address for the GitLab server. Defaults to value of `SMTP_USER`, else defaults to `example@example.com`. | diff --git a/assets/runtime/env-defaults b/assets/runtime/env-defaults index a2967a53f..ad1ebc18f 100644 --- a/assets/runtime/env-defaults +++ b/assets/runtime/env-defaults @@ -1,6 +1,8 @@ #!/bin/bash +# CONTAINER DEBUG=${DEBUG:-$DEBUG_ENTRYPOINT} +TIMEZONE=${TZ:-UTC} ## GITLAB CORE GITLAB_TEMP_DIR="${GITLAB_DATA_DIR}/tmp" diff --git a/assets/runtime/functions b/assets/runtime/functions index 18bc8d524..c0561674e 100644 --- a/assets/runtime/functions +++ b/assets/runtime/functions @@ -1561,6 +1561,21 @@ EOF chmod +x /usr/local/sbin/healthcheck } +configure_container_timezone() { + # Perform sanity check of provided timezone value + if [ -e /usr/share/zoneinfo/${TIMEZONE} ]; then + # Configured timezone is available + + # Set localtime + ln -snf /usr/share/zoneinfo/${TIMEZONE} /etc/localtime + + # Set timezone + echo ${TIMEZONE} > /etc/timezone + + echo "Container TimeZone -> ${TIMEZONE}" + fi +} + initialize_system() { map_uidgid initialize_logdir @@ -1568,6 +1583,7 @@ initialize_system() { update_ca_certificates generate_ssh_host_keys update_ssh_listen_port + configure_container_timezone install_configuration_templates rm -rf /var/run/supervisor.sock }