Add options to entrypoint.sh
This commit is contained in:
@@ -59,3 +59,4 @@ RUN chmod +x /sbin/entrypoint.sh
|
|||||||
WORKDIR ${SALT_DOCKER_DIR}
|
WORKDIR ${SALT_DOCKER_DIR}
|
||||||
|
|
||||||
ENTRYPOINT [ "/sbin/entrypoint.sh" ]
|
ENTRYPOINT [ "/sbin/entrypoint.sh" ]
|
||||||
|
CMD [ "app:start" ]
|
||||||
|
|||||||
26
README.md
26
README.md
@@ -2,11 +2,9 @@
|
|||||||
|
|
||||||
Dockerfile to build a [SaltStack](https://www.saltstack.com) Master image for the Docker opensource container platform.
|
Dockerfile to build a [SaltStack](https://www.saltstack.com) Master image for the Docker opensource container platform.
|
||||||
|
|
||||||
SaltStack Master is set up in the Docker image using the install from git source method as documented
|
SaltStack Master is set up in the Docker image using the install from git source method as documented in the the [official bootstrap](https://docs.saltstack.com/en/latest/topics/tutorials/salt_bootstrap.html) documentation.
|
||||||
in the the [official bootstrap](https://docs.saltstack.com/en/latest/topics/tutorials/salt_bootstrap.html) documentation.
|
|
||||||
|
|
||||||
For other methods to install SaltStack please refer to the
|
For other methods to install SaltStack please refer to the [Official SaltStack Installation Guide](https://docs.saltstack.com/en/latest/topics/installation/index.html).
|
||||||
[Official SaltStack Installation Guide](https://docs.saltstack.com/en/latest/topics/installation/index.html).
|
|
||||||
|
|
||||||
## Table of Contents
|
## Table of Contents
|
||||||
|
|
||||||
@@ -22,8 +20,7 @@ For other methods to install SaltStack please refer to the
|
|||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
Automated builds of the image are available on [Dockerhub](https://hub.docker.com/r/cdalvaro/saltstack-master/)
|
Automated builds of the image are available on [Dockerhub](https://hub.docker.com/r/cdalvaro/saltstack-master/) and is the recommended method of installation.
|
||||||
and is the recommended method of installation.
|
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
docker pull cdalvaro/saltstack-master:2018.3.2
|
docker pull cdalvaro/saltstack-master:2018.3.2
|
||||||
@@ -46,7 +43,7 @@ docker build -t cdalvaro/saltstack-master github.com/cdalvaro/saltstack-master
|
|||||||
The quickest way to get started is using [docker-compose](https://docs.docker.com/compose/).
|
The quickest way to get started is using [docker-compose](https://docs.docker.com/compose/).
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
wget https://gitlab.com/cdalvaro/saltstack-master/raw/master/docker-compose.yml
|
wget https://raw.githubusercontent.com/cdalvaro/saltstack-master/master/docker-compose.yml
|
||||||
```
|
```
|
||||||
|
|
||||||
Start SaltStack master using:
|
Start SaltStack master using:
|
||||||
@@ -75,8 +72,7 @@ But it is necessary to mount the `/srv/` volume ir order to provide your custom
|
|||||||
|
|
||||||
### Minion Keys
|
### Minion Keys
|
||||||
|
|
||||||
Minion keys can be added automatically on startup to SaltStack master by mounting the volume `/etc/salt-docker/keys`
|
Minion keys can be added automatically on startup to SaltStack master by mounting the volume `/etc/salt-docker/keys` and copying the minion keys inside `keys/minions/` directory:
|
||||||
and copying the minion keys inside `keys/minions/` directory:
|
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
mkdir -p keys/minions
|
mkdir -p keys/minions
|
||||||
@@ -90,10 +86,9 @@ docker run --name salt_master -d \
|
|||||||
cdalvaro/saltstack-master:2018.3.2
|
cdalvaro/saltstack-master:2018.3.2
|
||||||
```
|
```
|
||||||
|
|
||||||
## Available Configuration Parameters
|
### Available Configuration Parameters
|
||||||
|
|
||||||
Please refer the docker run command options for the `--env-file` flag where you can specify all required environment variables in a single file.
|
Please refer the docker run command options for the `--env-file` flag where you can specify all required environment variables in a single file. This will save you from writing a potentially long docker run command. Alternatively you can use docker-compose.
|
||||||
This will save you from writing a potentially long docker run command. Alternatively you can use docker-compose.
|
|
||||||
|
|
||||||
Below is the list of available options that can be used to customize your SaltStack master installation.
|
Below is the list of available options that can be used to customize your SaltStack master installation.
|
||||||
|
|
||||||
@@ -102,9 +97,7 @@ Below is the list of available options that can be used to customize your SaltSt
|
|||||||
| `SALT_LOG_LEVEL` | The level of messages to send to the console. One of 'garbage', 'trace', 'debug', info', 'warning', 'error', 'critical'. Default: 'warning' |
|
| `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_LEVEL_LOGFILE` | The level of messages to send to the log file. One of 'garbage', 'trace', 'debug', info', 'warning', 'error', 'critical'. Default: 'warning' |
|
||||||
|
|
||||||
Any parameter not listed in the table and available in the next
|
Any parameter not listed in the above table and available in the following [link](https://docs.saltstack.com/en/latest/ref/configuration/examples.html#configuration-examples-master), can be set by creating the directory `confs` and adding into it a `.conf` file with the desired parameters:
|
||||||
[link](https://docs.saltstack.com/en/latest/ref/configuration/examples.html#configuration-examples-master)
|
|
||||||
can be set by creating the directory `confs` and adding into it configurations files with the desired parameters:
|
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
mkdir confs
|
mkdir confs
|
||||||
@@ -139,8 +132,7 @@ docker-compose exec master salt '*' state.apply
|
|||||||
|
|
||||||
## Shell Access
|
## Shell Access
|
||||||
|
|
||||||
For debugging and maintenance purposes you may want access the container shell.
|
For debugging and maintenance purposes you may want access the container shell. If you are using docker version 1.3.0 or higher you can access a running container shell using docker exec command.
|
||||||
If you are using docker version 1.3.0 or higher you can access a running container shell using docker exec command.
|
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
docker exec -it salt_master bash
|
docker exec -it salt_master bash
|
||||||
|
|||||||
@@ -10,5 +10,5 @@ services:
|
|||||||
- "4505:4505/tcp"
|
- "4505:4505/tcp"
|
||||||
- "4506:4506/tcp"
|
- "4506:4506/tcp"
|
||||||
environment:
|
environment:
|
||||||
|
- DEBUG=false
|
||||||
- SALT_LOG_LEVEL=info
|
- SALT_LOG_LEVEL=info
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +1,30 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
source "${SALT_RUNTIME_DIR}/functions.sh"
|
source "${SALT_RUNTIME_DIR}/functions.sh"
|
||||||
|
|
||||||
# Copy minion keys
|
[[ ${DEBUG} == true ]] && set -x
|
||||||
copy_minion_keys
|
|
||||||
|
case ${1} in
|
||||||
|
app:start)
|
||||||
|
|
||||||
# Configure salt-master
|
|
||||||
configure_salt_master
|
configure_salt_master
|
||||||
|
|
||||||
|
case ${1} in
|
||||||
|
app:start)
|
||||||
|
copy_minion_keys
|
||||||
echo "Starting salt-master..."
|
echo "Starting salt-master..."
|
||||||
exec salt-master
|
exec salt-master
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
app:help)
|
||||||
|
echo "Available options:"
|
||||||
|
echo " app:start - Start salt-master service. (default)"
|
||||||
|
echo " app:help - Displays this help."
|
||||||
|
echo " [command] - Execute the specified command, eg. bash."
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
exec "$@"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|||||||
Reference in New Issue
Block a user