8.8.0-debian-10-r11 release

This commit is contained in:
Bitnami Bot 2021-02-19 11:26:41 +00:00
parent f4f781639f
commit 757a9dd09d
6 changed files with 125 additions and 14 deletions

View File

@ -17,7 +17,7 @@ RUN chmod g+rwX /opt/bitnami
COPY rootfs /
RUN /opt/bitnami/scripts/solr/postunpack.sh
ENV BITNAMI_APP_NAME="solr" \
BITNAMI_IMAGE_VERSION="8.8.0-debian-10-r10" \
BITNAMI_IMAGE_VERSION="8.8.0-debian-10-r11" \
PATH="/opt/bitnami/java/bin:/opt/bitnami/solr/bin:/opt/bitnami/common/bin:$PATH" \
SOLR_CORE="" \
SOLR_CORE_CONF_DIR="_default" \

View File

@ -61,22 +61,50 @@ solr_validate() {
error_code=1
}
! is_yes_no_value "$SOLR_ENABLE_AUTHENTICATION" && print_validation_error "SOLR_ENABLE_AUTHENTICATION posible values are yes or no"
! is_yes_no_value "$SOLR_ENABLE_AUTHENTICATION" && print_validation_error "SOLR_ENABLE_AUTHENTICATION possible values are yes or no"
if is_boolean_yes "$SOLR_ENABLE_AUTHENTICATION"; then
[[ -z "$SOLR_ADMIN_USERNAME" ]] && print_validation_error "You need to provide an username in SOLR_USERNAME"
[[ -z "$SOLR_ADMIN_PASSWORD" ]] && print_validation_error "You need to provide a password for the user: ${SOLR_ADMIN_USERNAME}"
fi
! is_yes_no_value "$SOLR_SSL_ENABLED" && print_validation_error "SOLR_SSL_ENABLED possible values are yes or no"
if is_boolean_yes "$SOLR_SSL_ENABLED"; then
[[ -z "$SOLR_SSL_KEY_STORE" ]] && print_validation_error "You need to provide a key store file in SOLR_SSL_KEY_STORE"
[[ -z "$SOLR_SSL_TRUST_STORE" ]] && print_validation_error "You need to provide a trust store file in SOLR_SSL_TRUST_STORE"
[[ -z "$SOLR_SSL_KEY_STORE_PASSWORD" ]] && print_validation_error "You need to provide a password in SOLR_SSL_KEY_STORE_PASSWORD"
[[ -z "$SOLR_SSL_TRUST_STORE_PASSWORD" ]] && print_validation_error "You need to provide a password file in SOLR_SSL_TRUST_STORE_PASSWORD"
fi
! is_yes_no_value "$SOLR_ENABLE_CLOUD_MODE" && print_validation_error "SOLR_ENABLE_CLOUD_MODE posible values are yes or no"
is_boolean_yes "$SOLR_ENABLE_CLOUD_MODE" && [[ -z "$SOLR_ZK_HOSTS" ]] && print_validation_error "You need to provide the Zookeper node list in SOLR_ZK_HOSTS"
! is_boolean_yes "$SOLR_CLOUD_BOOTSTRAP" && is_boolean_yes "$SOLR_ENABLE_CLOUD_MODE" && [[ -n "$SOLR_CORE" ]] && info "This node is not a boostrap node and will not create the collection"
! is_true_false_value "$SOLR_SSL_CHECK_PEER_NAME" && print_validation_error "SOLR_SSL_CHECK_PEER_NAME possible values are true or false"
[[ "$SOLR_NUMBER_OF_NODES" -lt $(( "$SOLR_COLLECTION_REPLICAS" * "$SOLR_COLLECTION_SHARDS" )) ]] && print_validation_error "Not enough nodes for the replicas and shards indicated"
[[ "$error_code" -eq 0 ]] || exit "$error_code"
}
########################
# Wait for solr root to exists in zookeeper
# Globals:
# SOLR_*
# Arguments:
# None
# Returns:
# None
#########################
solr_wait_for_zk_root() {
info "Waiting for solr root in zookeeper"
if ! retry_while solr_zk_root_exists; then
error "Failed to connect to the zookeeper"
exit 1
fi
}
########################
# Wait for Zookeeper to be up
# Globals:
@ -118,13 +146,16 @@ solr_create_core() {
local -r core="${1:?Missing core}"
local -r exec="curl"
local command_args=("--silent")
local protocol="http"
is_boolean_yes "$SOLR_SSL_ENABLED" && protocol="https" && command_args+=("-k")
is_boolean_yes "$SOLR_ENABLE_AUTHENTICATION" && command_args+=("--user" "${SOLR_ADMIN_USERNAME}:${SOLR_ADMIN_PASSWORD}")
mkdir -p "${SOLR_SERVER_DIR}/solr/${core}/data"
cp -r "${SOLR_SERVER_DIR}"/solr/configsets/_default/* "${SOLR_SERVER_DIR}/solr/${core}/"
command_args+=( "http://localhost:${SOLR_PORT_NUMBER}/solr/admin/cores?action=CREATE&name=${SOLR_CORE}&instanceDir=${SOLR_CORE}&config=solrconfig.xml&schema=schema.xml&dataDir=data" )
command_args+=( "${protocol}://localhost:${SOLR_PORT_NUMBER}/solr/admin/cores?action=CREATE&name=${SOLR_CORE}&instanceDir=${SOLR_CORE}&config=solrconfig.xml&schema=schema.xml&dataDir=data" )
info "Creating solr core: ${SOLR_CORE}"
@ -151,7 +182,12 @@ solr_update_password() {
local -r default_password="SolrRocks"
local -r username="${1:?user is required}"
local -r password="${2:?password is required}"
local command_args=("--silent" "--user" "${username}:${default_password}" "http://localhost:${SOLR_PORT_NUMBER}/api/cluster/security/authentication" "-H" "'Content-type:application/json'" "-d" "{\"set-user\":{\"${username}\":\"${password}\"}}" )
local protocol="http"
local command_args=( )
is_boolean_yes "$SOLR_SSL_ENABLED" && protocol="https" && command_args+=("-k")
command_args+=("--silent" "--user" "${username}:${default_password}" "${protocol}://localhost:${SOLR_PORT_NUMBER}/api/cluster/security/authentication" "-H" "'Content-type:application/json'" "-d" "{\"set-user\":{\"${username}\":\"${password}\"}}" )
info "Updating user password"
@ -199,12 +235,16 @@ solr_create_cloud_user() {
# None
#########################
solr_create_collection() {
local -r exec="${SOLR_BIN_DIR}/solr"
local command_args=("create_collection" "-c" "$SOLR_COLLECTION" "-replicationFactor" "$SOLR_COLLECTION_REPLICAS" "-shards" "$SOLR_COLLECTION_SHARDS")
local -r exec="curl"
local command_args=("--silent")
local protocol="http"
info "Creating collection:${SOLR_COLLECTION} with ${SOLR_COLLECTION_REPLICAS} replicas and ${SOLR_COLLECTION_SHARDS} shards"
[[ -n "$SOLR_PORT_NUMBER" ]] && command_args+=("-p" "$SOLR_PORT_NUMBER")
is_boolean_yes "$SOLR_ENABLE_AUTHENTICATION" && command_args+=("--user" "${SOLR_ADMIN_USERNAME}:${SOLR_ADMIN_PASSWORD}")
is_boolean_yes "$SOLR_SSL_ENABLED" && protocol="https" && command_args+=("-k")
command_args+=( "${protocol}://localhost:${SOLR_PORT_NUMBER}/solr/admin/collections?action=CREATE&name=${SOLR_COLLECTION}&numShards=${SOLR_COLLECTION_SHARDS}&replicationFactor=${SOLR_COLLECTION_REPLICAS}" )
#Check if the collection exists before creating it
if ! solr_collection_exists "$SOLR_COLLECTION"; then
@ -216,7 +256,7 @@ solr_create_collection() {
fi
fi
if ! debug_execute "$exec" "${command_args[@]}"; then
if ! debug_execute "$exec" "${command_args[@]}" > /dev/null; then
error "There was an error when creating the collection"
exit 1
else
@ -227,6 +267,24 @@ solr_create_collection() {
fi
}
#########################
# Check if the root of solr exists in zookeeper
# Globals:
# SOLR_*
# Arguments:
# $1 - Collection name
# Returns:
# None
#########################
solr_zk_root_exists() {
local -r exec="${SOLR_BIN_DIR}/solr"
local command_args=("zk" "ls" "/" "-z" "$SOLR_ZK_HOSTS")
debug "Checking if root of solr exists in zookeeper"
"$exec" "${command_args[@]}" 2> /dev/null | grep -q "solr"
}
#########################
# Check if a collection already exists
# Globals:
@ -334,10 +392,27 @@ solr_zk_initialize() {
info "Zookeeper is already initialized"
else
info "Creating root in zookeeper"
debug_execute "$exec" "${command_args[@]}" || true
debug_execute "$exec" "${command_args[@]}"
fi
}
#########################
# Set cluster properties in zookeeper
# Globals:
# SOLR_*
# Arguments:
# None
# Returns:
# None
#########################
solr_set_ssl_url_scheme() {
info "Initializing configuring Solr HTTPS in Zookeeper"
solr_wait_for_zk_root && "${SOLR_SERVER_DIR}/scripts/cloud-scripts/zkcli.sh" -zkhost "${SOLR_ZK_HOSTS}/solr" -cmd clusterprop -name urlScheme -val https
}
#########################
# Create root in zookeeper
# Globals:
@ -379,6 +454,8 @@ solr_initialize() {
# Check if there is persisted data from old version and migrate it
! is_dir_empty "${SOLR_VOLUME_DIR}/data" && [[ -f "$SOLR_VOLUME_DIR/.initialized" ]] && solr_migrate_old_data
is_boolean_yes "$SOLR_SSL_ENABLED" && export SOLR_SSL_ENABLED=true
# Check if Solr has already been initialized and persisted in a previous run
local -r app_name="solr"
if ! is_app_initialized "$app_name"; then
@ -401,10 +478,18 @@ solr_initialize() {
solr_start_bg "cloud"
is_boolean_yes "$SOLR_SSL_ENABLED" && solr_set_ssl_url_scheme
[[ -n "$SOLR_COLLECTION" ]] && solr_create_collection
is_boolean_yes "$SOLR_ENABLE_AUTHENTICATION" && solr_create_cloud_user "$SOLR_ADMIN_USERNAME" "$SOLR_ADMIN_PASSWORD"
solr_stop
else
if is_boolean_yes "$SOLR_SSL_ENABLED"; then
solr_set_ssl_url_scheme
else
solr_wait_for_zk_root
fi
fi
else
info "Deploying Solr from scratch"

View File

@ -8,6 +8,9 @@
# 3. Environment variables overridden via external files using *_FILE variables (see below)
# 4. Environment variables set externally (i.e. current Bash context/Dockerfile/userdata)
# Load logging library
. /opt/bitnami/scripts/liblog.sh
export BITNAMI_ROOT_DIR="/opt/bitnami"
export BITNAMI_VOLUME_DIR="/bitnami"
@ -32,6 +35,8 @@ solr_env_vars=(
SOLR_ADMIN_PASSWORD
SOLR_CLOUD_BOOTSTRAP
SOLR_CORE_CONF_DIR
SOLR_SSL_ENABLED
SOLR_SSL_CHECK_PEER_NAME
SOLR_ZK_MAX_RETRIES
SOLR_ZK_SLEEP_TIME
SOLR_COLLECTION
@ -39,8 +44,12 @@ solr_env_vars=(
for env_var in "${solr_env_vars[@]}"; do
file_env_var="${env_var}_FILE"
if [[ -n "${!file_env_var:-}" ]]; then
export "${env_var}=$(< "${!file_env_var}")"
unset "${file_env_var}"
if [[ -r "${!file_env_var:-}" ]]; then
export "${env_var}=$(< "${!file_env_var}")"
unset "${file_env_var}"
else
warn "Skipping export of '${env_var}'. '${!file_env_var:-}' is not readable."
fi
fi
done
unset solr_env_vars
@ -76,6 +85,8 @@ export SOLR_ADMIN_USERNAME="${SOLR_ADMIN_USERNAME:-admin}"
export SOLR_ADMIN_PASSWORD="${SOLR_ADMIN_PASSWORD:-bitnami}"
export SOLR_CLOUD_BOOTSTRAP="${SOLR_CLOUD_BOOTSTRAP:-no}"
export SOLR_CORE_CONF_DIR="${SOLR_CORE_CONF_DIR:-_default}"
export SOLR_SSL_ENABLED="${SOLR_SSL_ENABLED:-no}"
export SOLR_SSL_CHECK_PEER_NAME="${SOLR_SSL_CHECK_PEER_NAME:-false}"
# System users (when running with a privileged user)
export SOLR_DAEMON_USER="solr"

View File

@ -22,6 +22,8 @@ if is_boolean_yes "$SOLR_ENABLE_CLOUD_MODE"; then
start_command+=("-cloud" "-z" "$SOLR_ZK_HOSTS/solr")
fi
is_boolean_yes "$SOLR_SSL_ENABLED" && export SOLR_SSL_ENABLED=true
if am_i_root; then
exec gosu "$SOLR_DAEMON_USER" "${start_command[@]}"
else

View File

@ -36,7 +36,7 @@ You can find the available configuration options in the [Environment Variables](
Learn more about the Bitnami tagging policy and the difference between rolling tags and immutable tags [in our documentation page](https://docs.bitnami.com/tutorials/understand-rolling-tags-containers/).
* [`8`, `8-debian-10`, `8.8.0`, `8.8.0-debian-10-r10`, `latest` (8/debian-10/Dockerfile)](https://github.com/bitnami/bitnami-docker-solr/blob/8.8.0-debian-10-r10/8/debian-10/Dockerfile)
* [`8`, `8-debian-10`, `8.8.0`, `8.8.0-debian-10-r11`, `latest` (8/debian-10/Dockerfile)](https://github.com/bitnami/bitnami-docker-solr/blob/8.8.0-debian-10-r11/8/debian-10/Dockerfile)
Subscribe to project updates by watching the [bitnami/solr GitHub repo](https://github.com/bitnami/bitnami-docker-solr).
@ -170,6 +170,14 @@ Authentication related environment variables:
- `SOLR_ADMIN_USERNAME`: Username for the administrator user. Default: **admin**
- `SOLR_ADMIN_PASSWORD`: Password for the administrator user. Default: **Bitnami**
SSL related environment variables:
- `SOLR_SSL_ENABLED`: Indicates if solr is going to enable SSL. Default: **no**
- `SOLR_SSL_KEY_STORE`: Key store file. Default: **null**
- `SOLR_SSL_KEY_STORE_PASSWORD`: Password for the key store file. Default: **null**
- `SOLR_SSL_TRUST_STORE`: Trust store file. Default: **null**
- `SOLR_SSL_TRUST_STORE_PASSWORD`: Password for the trust store file. Default: **null**
- `SOLR_SSL_CHECK_PEER_NAME`: Indicates if the peer name should be checked. Default: **false**
### Specifying Environment Variables using Docker Compose
This requires a minor change to the [`docker-compose.yml`](https://github.com/bitnami/bitnami-docker-solr/blob/master/docker-compose.yml) file present in this repository:
@ -286,6 +294,10 @@ $ docker-compose up solr
```
# Notable Changes
## 8.8.0-debian-10-r11
- Adds SSL support.
## 8.8.0-debian-10-r9
- The Solr container initialization logic has been moved to Bash scripts.

View File

@ -14,7 +14,7 @@ services:
volumes:
- 'solr_data:/bitnami/solr'
zk1:
image: 'docker.io/bitnami/zookeeper:latest'
image: 'docker.io/bitnami/zookeeper:3-debian-10'
ports:
- '2181'
volumes:
@ -23,6 +23,7 @@ services:
- ZOO_SERVER_ID=1
- ALLOW_ANONYMOUS_LOGIN=yes
- ZOO_SERVERS=zk1:2888:3888
- ZOO_4LW_COMMANDS_WHITELIST=srvr,mntr,conf,ruok
volumes:
solr_data:
driver: local