diff --git a/CHANGELOG.md b/CHANGELOG.md index 92227c0..95edc74 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ Please refer to the SaltStack [Release Notes](https://docs.saltstack.com/en/deve - Add `PyGit2` support - Expose `/home/salt/data/logs` - Run `salt-master` as `salt` user +- Add support for setting timezone **2018.3.2** diff --git a/LICENSE b/LICENSE index 35fb1ff..ed89c6a 100644 --- a/LICENSE +++ b/LICENSE @@ -19,4 +19,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - diff --git a/README.md b/README.md index 770df63..1e58dc5 100644 --- a/README.md +++ b/README.md @@ -161,7 +161,7 @@ gitfs_privkey: /home/salt/data/keys/gitfs/gitfs_ssh gitfs_pubkey: /home/salt/data/keys/gitfs/gitfs_ssh.pub ``` -**Important Note** +**Important Note** If you get the following error while using `gitfs` with `pygit2` @@ -178,7 +178,9 @@ Please refer the docker run command options for the `--env-file` flag where you Below is the list of available options that can be used to customize your SaltStack master installation. | Parameter | Description | -|-----------|-------------| +|:----------|:------------| +| `DEBUG` | Set this to `true` to enable entrypoint debugging. | +| `TIMEZONE` | Set the container timezone. Defaults to `UTC`. Values are expected to be in Canonical format. Example: `Europe/Madrid`. See the list of [acceptable values](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). | | `SALT_LOG_LEVEL` | The level of messages to send to the console. One of 'garbage', 'trace', 'debug', info', 'warning', 'error', 'critical'. Default: `warning` | | `SALT_LEVEL_LOGFILE` | The level of messages to send to the log file. One of 'garbage', 'trace', 'debug', info', 'warning', 'error', 'critical'. Default: `warning` | | `SALT_MASTER_SIGN_PUBKEY` | Sign the master auth-replies with a cryptographic signature of the master's public key. Possible values: 'True' or 'False'. Default: `False` | diff --git a/assets/runtime/env-defaults.sh b/assets/runtime/env-defaults.sh index 5e7673f..a759859 100755 --- a/assets/runtime/env-defaults.sh +++ b/assets/runtime/env-defaults.sh @@ -1,5 +1,8 @@ #!/usr/bin/env bash +DEBUG=${DEBUG:-false} +TIMEZONE=${TIMEZONE:-UTC} + # https://docs.saltstack.com/en/latest/ref/configuration/master.html ##### Logging settings ##### diff --git a/assets/runtime/functions.sh b/assets/runtime/functions.sh index 708dbcb..352a802 100755 --- a/assets/runtime/functions.sh +++ b/assets/runtime/functions.sh @@ -57,11 +57,31 @@ function update_template() rm -f ${tmp_file} } +# This function configures containers timezone +function configure_timezone() +{ + echo "Configuring container timezone ..." + + # Perform sanity check of provided timezone value + if [ -e /usr/share/zoneinfo/${TIMEZONE} ]; then + echo "Setting TimeZone -> ${TIMEZONE} ..." + + # Set localtime + ln -snf /usr/share/zoneinfo/${TIMEZONE} /etc/localtime + + # Set timezone + echo ${TIMEZONE} > /etc/timezone + else + echo "Timezone: '${TIMEZONE}' is not valid. Check available timezones at: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones" + return 1 + fi +} + # This function generates a master_sign key pair and its signature function gen_signed_keys() { local key_name=${1:-master} - + mkdir -p ${SALT_KEYS_DIR}/generated/ GENERATED_KEYS_DIR=$(mktemp -d -p ${SALT_KEYS_DIR}/generated/ -t ${key_name}.XXXXX) @@ -146,7 +166,7 @@ function configure_salt_master() function initialize_datadir() { echo "Configuring directories ..." - + # This symlink simplifies paths for loading sls files [[ -d /srv ]] && [[ ! -L /srv ]] && rm -rf /srv ln -sfnv ${SALT_BASE_DIR} /srv @@ -174,6 +194,7 @@ function initialize_system() { map_uidgid initialize_datadir + configure_timezone configure_salt_master setup_salt_keys setup_ssh_keys diff --git a/docker-compose.yml b/docker-compose.yml index 3205c43..fe9f6a9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,6 +4,7 @@ services: master: container_name: salt_master image: cdalvaro/saltstack-master:2018.3.3 + restart: always volumes: - "./srv/:/home/salt/data/srv" ports: @@ -11,6 +12,7 @@ services: - "4506:4506/tcp" environment: - DEBUG=false + - TIMEZONE=Europe/Madrid - USERMAP_UID=1000 - USERMAP_GID=1000