Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ DASHBOARD_DEV_SERVER=1
DASHBOARD_SSL=1
DASHBOARD_URL=
RGW_MULTISITE=0
NUMBER_OF_CLUSTERS=1

# Sanity checks' options
#APPLITOOLS_API_KEY=
Expand Down
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ services:
- PYTHONDONTWRITEBYTECODE=1
- RGW
- RGW_MULTISITE=${RGW_MULTISITE:-0}
- NUMBER_OF_CLUSTERS=${NUMBER_OF_CLUSTERS:-1}
cap_add:
- ALL
entrypoint: /docker/entrypoint.sh
Expand Down
9 changes: 7 additions & 2 deletions docker/ceph/ci/sanity-checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

set -e

source /docker/set-mstart-env.sh

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 [shellcheck] reported by reviewdog 🐶
Not following: /docker/set-mstart-env.sh: openBinaryFile: does not exist (No such file or directory) SC1091


REPO_DIR=/ceph
[[ "$IS_UPSTREAM" == 1 && "$CEPH_VERSION" -le '14' ]] && PYTHON_VERSION=2 || PYTHON_VERSION=3
TRANSLATION_FILE=src/pybind/mgr/dashboard/frontend/src/locale/messages.xlf
Expand Down Expand Up @@ -244,7 +246,7 @@ run_frontend_e2e_tests() {
echo 'Running frontend E2E tests...'

cd "$REPO_DIR"/src/pybind/mgr/dashboard/frontend
npm ci
npm i
npx --no-install cypress -v && WITH_CYPRESS=1 || WITH_CYPRESS=0
E2E_CMD="npm run e2e:dev"
if [[ "${WITH_CYPRESS}" == 1 ]]; then
Expand All @@ -264,12 +266,15 @@ run_frontend_e2e_tests() {

DASHBOARD_URL=null
while [[ "${DASHBOARD_URL}" == 'null' ]]; do
export DASHBOARD_URL=$("$CEPH_BIN"/ceph mgr services | jq -r .dashboard)
export DASHBOARD_URL=$(CEPH_CLI mgr services | jq -r .dashboard)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [shellcheck] reported by reviewdog 🐶
Declare and assign separately to avoid masking return values. SC2155

export DASHBOARD2_URL=$(CEPH2_CLI mgr services | jq -r .dashboard)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [shellcheck] reported by reviewdog 🐶
Declare and assign separately to avoid masking return values. SC2155

sleep 1
done
if [[ "${WITH_CYPRESS}" == 1 ]]; then
export CYPRESS_BASE_URL="${DASHBOARD_URL}"
export CYPRESS_CEPH2_URL="${DASHBOARD2_URL}"
fi

cd "$REPO_DIR"/src/pybind/mgr/dashboard/frontend
ANGULAR_VERSION=$(npm run ng version | grep 'Angular: ' | awk '{ print substr($2,1,1) }')
# In nautilus this flag is required because BASE_URL is not read in protractor config.
Expand Down
15 changes: 8 additions & 7 deletions docker/ceph/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,23 @@ export_var() {
export_var IS_CEPH_RPM="$(command -v ceph-mgr 2>/dev/null | wc -l)"

# Env. vars used in vstart.
export_var CEPH_ASOK_DIR=/ceph/build."${HOSTNAME}"/out
export_var CEPH_CONF=/ceph/build."${HOSTNAME}"/ceph.conf
export_var CEPH_CONF_PATH=/ceph/build."${HOSTNAME}"
export_var CEPH_DEV_DIR=/ceph/build."${HOSTNAME}"/dev
export_var CEPH_OUT_DIR=/ceph/build."${HOSTNAME}"/out
export_var CEPH_ASOK_DIR=/ceph/build.ceph-dev/run/"${HOSTNAME}"/asok
export_var CEPH_CONF=/ceph/build.ceph-dev/run/"${HOSTNAME}"/ceph.conf
export_var CEPH_CONF_PATH=/ceph/build.ceph-dev/run/"${HOSTNAME}"
export_var CEPH_DEV_DIR=/ceph/build.ceph-dev/run/"${HOSTNAME}"/dev
export_var CEPH_OUT_DIR=/ceph/build.ceph-dev/run/"${HOSTNAME}"/out
export_var CEPH_PORT="${CEPH_PORT:-10000}"

rm -rf /ceph/build

mkdir -p "${CEPH_CONF_PATH}"

if [[ "${IS_CEPH_RPM}" == 1 ]]; then
export_var CEPH_BIN=/usr/bin
export_var CEPH_BIN=/usr/bin/
export_var CEPH_LIB=/usr/lib64/ceph
export_var EC_PATH="$CEPH_LIB"/erasure-code
export_var OBJCLASS_PATH=/usr/lib64/rados-classes

ln -sf "$EC_PATH"/* "$CEPH_LIB"
ln -sf "$OBJCLASS_PATH"/* "$CEPH_LIB"

Expand Down
11 changes: 5 additions & 6 deletions docker/ceph/set-monitoring.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
#!/bin/bash

set -e
source /docker/set-mstart-env.sh

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 [shellcheck] reported by reviewdog 🐶
Not following: /docker/set-mstart-env.sh: openBinaryFile: does not exist (No such file or directory) SC1091


echo $CEPH1

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 [shellcheck] reported by reviewdog 🐶
Double quote to prevent globbing and word splitting. SC2086

# Configure grafana
set_grafana_api_url() {
while true; do
GRAFANA_IP=$(getent ahosts grafana | tail -1 | awk '{print $1}')
if [[ -n "$GRAFANA_IP" ]]; then
"$CEPH_BIN"/ceph dashboard set-grafana-api-url "https://$GRAFANA_IP:$GRAFANA_HOST_PORT"

CEPH_CLI dashboard set-grafana-api-url "https://$GRAFANA_IP:$GRAFANA_HOST_PORT"
return
fi

Expand All @@ -22,8 +23,7 @@ set_alertmanager_api_host() {
while true; do
ALERTMANAGER_IP=$(getent ahosts alertmanager | tail -1 | awk '{print $1}')
if [[ -n "$ALERTMANAGER_IP" ]]; then
"$CEPH_BIN"/ceph dashboard set-alertmanager-api-host "http://$ALERTMANAGER_IP:$ALERTMANAGER_HOST_PORT"

CEPH_CLI dashboard set-alertmanager-api-host "http://$ALERTMANAGER_IP:$ALERTMANAGER_HOST_PORT"
return
fi

Expand All @@ -37,8 +37,7 @@ set_prometheus_api_host() {
while true; do
PROMETHEUS_IP=$(getent ahosts prometheus | tail -1 | awk '{print $1}')
if [[ -n "$PROMETHEUS_IP" ]]; then
"$CEPH_BIN"/ceph dashboard set-prometheus-api-host "http://$PROMETHEUS_IP:$PROMETHEUS_HOST_PORT"

CEPH_CLI dashboard set-prometheus-api-host "http://$PROMETHEUS_IP:$PROMETHEUS_HOST_PORT"
return
fi

Expand Down
39 changes: 39 additions & 0 deletions docker/ceph/set-mstart-env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash

set -e

export_var() {
export "${1?}"
echo "export $1" >> /root/.bashrc
}

echo $NUMBER_OF_CLUSTERS

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 [shellcheck] reported by reviewdog 🐶
Double quote to prevent globbing and word splitting. SC2086

declare -a CEPH_BIN_LIST
declare -a CEPH_CLUSTERS
for (( cluster=1; cluster<=$NUMBER_OF_CLUSTERS; cluster++ )); do

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[shellcheck] reported by reviewdog 🐶
$/${} is unnecessary on arithmetic variables. SC2004

CEPH_CLUSTERS[cluster]="CEPH${cluster}"
CEPH_BIN_LIST[cluster]=${CEPH_CLUSTERS[cluster]}
echo ${CEPH_CLUSTERS[cluster]}
export_var ${CEPH_BIN_LIST[cluster]}="/ceph/src/mrun ${CEPH_CLUSTERS[cluster]} ceph"
done

CEPH_CLI() {
export_var CEPH_CONF_PATH=/ceph/build.ceph-dev/run/CEPH1/
/ceph/src/mrun CEPH1 ceph "$@"
}

CEPH2_CLI() {
export_var CEPH_CONF_PATH=/ceph/build.ceph-dev/run/CEPH2/
/ceph/src/mrun CEPH2 ceph "$@"
}

CEPH_CLI_ALL() {
for cluster in ${CEPH_BIN_LIST[@]}; do

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [shellcheck] reported by reviewdog 🐶
Double quote array expansions to avoid re-splitting elements. SC2068

export_var CEPH_BIN=/usr/bin/
export_var BUILD_DIR=/ceph/build.ceph-dev/
export_var CEPH_CONF_PATH=/ceph/build.ceph-dev/run/"${cluster}/"

cd /ceph/build.ceph-dev
${!cluster} $@

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [shellcheck] reported by reviewdog 🐶
Double quote array expansions to avoid re-splitting elements. SC2068

done
}
2 changes: 2 additions & 0 deletions docker/ceph/set-start-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

set -e

source /docker/set-mstart-env.sh

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 [shellcheck] reported by reviewdog 🐶
Not following: /docker/set-mstart-env.sh: openBinaryFile: does not exist (No such file or directory) SC1091


[[ -z "$MGR" ]] && export MGR=1
[[ -z "$MGR_PYTHON_PATH" ]] && export MGR_PYTHON_PATH=/ceph/src/pybind/mgr
[[ -d "$MGR_PYTHON_PATH"/dashboard/frontend ]] && export IS_UPSTREAM_LUMINOUS=0
Expand Down
41 changes: 28 additions & 13 deletions docker/ceph/start-ceph.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ set -e

source /docker/set-start-env.sh

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 [shellcheck] reported by reviewdog 🐶
Not following: /docker/set-start-env.sh: openBinaryFile: does not exist (No such file or directory) SC1091


# Build frontend:
#Build frontend:
if [[ "$FRONTEND_BUILD_REQUIRED" == 1 ]]; then
cd "$MGR_PYTHON_PATH"/dashboard/frontend

# Set dev server proxy:
TARGET_URL="${HTTP_PROTO}://${HOSTNAME}:${CEPH_MGR_DASHBOARD_PORT}"
echo "target" $TARGET_URL

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 [shellcheck] reported by reviewdog 🐶
Double quote to prevent globbing and word splitting. SC2086

[[ -n "${DASHBOARD_URL}" ]] && TARGET_URL=${DASHBOARD_URL}
jq "(.[] | .target)=\""${TARGET_URL}"\"" proxy.conf.json.sample > proxy.conf.json

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [shellcheck] reported by reviewdog 🐶
The surrounding quotes actually unquote this. Remove or escape them. SC2027

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 [shellcheck] reported by reviewdog 🐶
Double quote to prevent globbing and word splitting. SC2086


Expand All @@ -18,7 +19,7 @@ if [[ "$FRONTEND_BUILD_REQUIRED" == 1 ]]; then
npm update @angular/cli
fi

npm ci
npm i

if [[ -z "${DASHBOARD_URL}" ]]; then
# Required to run dashboard python module.
Expand All @@ -40,14 +41,28 @@ fi

rm -rf "$CEPH_CONF_PATH"/*

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [shellcheck] reported by reviewdog 🐶
Use "${var:?}" to ensure this never expands to /* . SC2115


cd /ceph/build
../src/vstart.sh ${VSTART_OPTIONS}
for cluster in ${CEPH_CLUSTERS[@]}; do

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [shellcheck] reported by reviewdog 🐶
Double quote array expansions to avoid re-splitting elements. SC2068

cd /ceph/build
echo ${cluster}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 [shellcheck] reported by reviewdog 🐶
Double quote to prevent globbing and word splitting. SC2086

# Env. vars used in vstart.
export_var CEPH_ASOK_DIR=/ceph/build.ceph-dev/run/"${cluster}"/asok
export_var CEPH_CONF=/ceph/build.ceph-dev/run/"${cluster}"/ceph.conf
export_var CEPH_CONF_PATH=/ceph/build.ceph-dev/run/"${cluster}"
export_var CEPH_DEV_DIR=/ceph/build.ceph-dev/run/"${cluster}"/dev
export_var CEPH_OUT_DIR=/ceph/build.ceph-dev/run/"${cluster}"/out
export VSTART_DEST=/ceph/build.ceph-dev/run/"${cluster}"
export CEPH_MGR_DASHBOARD_PORT=$(($CEPH_PORT + 1000))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[shellcheck] reported by reviewdog 🐶
$/${} is unnecessary on arithmetic variables. SC2004


../src/mstart.sh ${cluster} ${VSTART_OPTIONS}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 [shellcheck] reported by reviewdog 🐶
Double quote to prevent globbing and word splitting. SC2086

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 [shellcheck] reported by reviewdog 🐶
Double quote to prevent globbing and word splitting. SC2086


export CEPH_PORT=$(($CEPH_PORT + 100))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[shellcheck] reported by reviewdog 🐶
$/${} is unnecessary on arithmetic variables. SC2004

done

echo 'vstart.sh completed!'

# Create rbd pool:
"$CEPH_BIN"/ceph osd pool create rbd 8 8 replicated
"$CEPH_BIN"/ceph osd pool application enable rbd rbd
CEPH_CLI_ALL osd pool create rbd 8 8 replicated
CEPH_CLI_ALL osd pool application enable rbd rbd

# Configure Object Gateway:
if [[ "$RGW" -gt 0 || "$RGW_MULTISITE" == 1 ]]; then
Expand All @@ -56,7 +71,7 @@ fi

# Enable prometheus module
if [[ "$IS_FIRST_CLUSTER" == 1 ]]; then
"$CEPH_BIN"/ceph mgr module enable prometheus
CEPH_CLI mgr module enable prometheus
echo 'Prometheus mgr module enabled.'
fi

Expand All @@ -75,8 +90,8 @@ if [[ "$DASHBOARD_SSL" == 0 && "$VSTART_HAS_SSL_FLAG" == 0 && "$IS_FIRST_CLUSTER
SSL_OPTIONS=''
fi

"$CEPH_BIN"/ceph config set mgr mgr/dashboard/ssl false $SSL_OPTIONS
"$CEPH_BIN"/ceph config set mgr mgr/dashboard/x/server_port "$CEPH_MGR_DASHBOARD_PORT" $SSL_OPTIONS
CEPH_CLI_ALL config set mgr mgr/dashboard/ssl false $SSL_OPTIONS

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 [shellcheck] reported by reviewdog 🐶
Double quote to prevent globbing and word splitting. SC2086

CEPH_CLI_ALL config set mgr mgr/dashboard/x/server_port "$CEPH_MGR_DASHBOARD_PORT" $SSL_OPTIONS

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 [shellcheck] reported by reviewdog 🐶
Double quote to prevent globbing and word splitting. SC2086

/docker/restart-dashboard.sh

echo "SSL disabled."
Expand All @@ -90,12 +105,12 @@ fi
create_test_user() {
DASHBOARD_TEST_USER_SECRET_FILE="/tmp/dashboard-test-user-secret.txt"
printf 'test' > "${DASHBOARD_TEST_USER_SECRET_FILE}"
"$CEPH_BIN"/ceph dashboard ac-user-create test -i "${DASHBOARD_TEST_USER_SECRET_FILE}" "${DASHBOARD_USER_CREATE_OPTIONS}"
CEPH_CLI_ALL dashboard ac-user-create test -i "${DASHBOARD_TEST_USER_SECRET_FILE}" "${DASHBOARD_USER_CREATE_OPTIONS}"
}
create_test_user || "$CEPH_BIN"/ceph dashboard ac-user-create test test "${DASHBOARD_USER_CREATE_OPTIONS}"
create_test_user || CEPH_CLI_ALL dashboard ac-user-create test test "${DASHBOARD_USER_CREATE_OPTIONS}"

# Enable debug mode.
"$CEPH_BIN"/ceph dashboard debug enable
CEPH_CLI_ALL dashboard debug enable

# Set monitoring stack:
/docker/set-monitoring.sh
Expand All @@ -104,4 +119,4 @@ create_test_user || "$CEPH_BIN"/ceph dashboard ac-user-create test test "${DASHB
[[ "$CEPH_VERSION" -le '14' ]] && exit 0

# Set dashboard log level.
"$CEPH_BIN"/ceph config set mgr mgr/dashboard/log_level debug
CEPH_CLI_ALL config set mgr mgr/dashboard/log_level debug