diff --git a/README.md b/README.md index ed02790..72d167b 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,7 @@ For other methods to install SaltStack please refer to the [Official SaltStack I - [Available Configuration Parameters](#available-configuration-parameters) - [Usage](#usage) - [Shell Access](#shell-access) +- [Restart Services](#restart-services) - [References](#references) ## Installation @@ -355,6 +356,16 @@ For debugging and maintenance purposes you may want access the container shell. docker exec -it salt_master bash ``` +## Restart Services + +You can restart containers services by running the following command: + +```sh +docker exec -it salt_master entrypoint.sh app:restart [salt-service] +``` + +Where `salt-service` is one of: `salt-master` os `salt-api` (if `SALT_API_SERVICE_ENABLED` is set to `true`) + ## References - https://docs.saltstack.com/en/latest/topics/installation/index.html diff --git a/entrypoint.sh b/entrypoint.sh index 9bdf20a..72b6009 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,18 +1,20 @@ -#!/usr/bin/env bash +#!/bin/bash set -e +set -o pipefail + source "${SALT_RUNTIME_DIR}/functions.sh" [[ ${DEBUG} == true ]] && set -x case ${1} in - app:start|app:init|app:gen-signed-keys) + app:start|app:gen-signed-keys) initialize_system case ${1} in app:start) - echo "Starting salt-master..." + echo "Starting supervisord ..." exec /usr/bin/supervisord -nc /etc/supervisor/supervisord.conf ;; app:gen-signed-keys) @@ -21,9 +23,23 @@ case ${1} in ;; esac ;; + app:restart) + shift 1 + case ${1} in + salt-master|salt-api) + echo "Restarting ${1} service ..." + exec pkill ${1} + ;; + *) + log_error "Unable to restart ${1} serice. Service is unknown" + exit 1 + ;; + esac + ;; app:help) echo "Available options:" - echo " app:start - Start salt-master service. (default)" + echo " app:start - Start configured services. (default)" + echo " app:restart - Restart the specified service on a running container. Choices: salt-master, salt-api" echo " app:gen-signed-keys - Create a master_sign key pair and its signature inside ${SALT_KEYS_DIR}/generated/" echo " app:help - Displays this help." echo " [command] - Execute the specified command, eg. bash."