Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support multisite in ceph2 setup #84

Merged
merged 2 commits into from
Jun 3, 2024
Merged
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
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -308,14 +308,14 @@ docker-compose exec ceph /docker/sso/sso-disable.sh
RGW_MULTISITE=1
```

* Start ceph (cluster 1) + ceph cluster 2:
* Start ceph (cluster 1) + ceph2 (cluster 2):
```
docker-compose up -d --scale ceph-cluster2=1
docker-compose up -d --scale ceph2=1 --scale prometheus2=1
```

* Run 100s duration [benchmark](https://github.com/markhpc/hsbench#usage):
```
docker-compose exec ceph-cluster2 bash
docker-compose exec ceph2 bash
hsbench -a <rgw-user-access-key> -s <rgw-user-secret-key> -u http://127.0.0.1:8000 -z 4K -d 100 -t 10 -b 10
```

Expand Down
6 changes: 0 additions & 6 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,6 @@ services:
ports: ['${CEPH_PROXY_HOST_PORT:-4200}:4200','${CEPH_HOST_PORT:-11000}:11000']
scale: 1

ceph-cluster2:
extends:
service: ceph-base
container_name: ceph-cluster2
hostname: ceph-cluster2

ceph-host2:
extends:
service: ceph-base
Expand Down
2 changes: 1 addition & 1 deletion docker/ceph/set-rgw.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
readonly RGW_REALM_USER_ACCESS_KEY_FILE="/tmp/rgw-user-access-key.txt"
readonly RGW_REALM_USER_SECRET_KEY=('xSZUdYky0bTctAdCEEW8ikhfBVKsBV5LFYL82vvh' 'GsOwxjOfxAwM2It2mBiB5A5CJFxu73GjpNjCROvx')
readonly RGW_REALM_USER_SECRET_KEY_FILE="/tmp/rgw-user-secret-key.txt"
readonly RGW_REALM_USER_NUM=1

Check warning on line 11 in docker/ceph/set-rgw.sh

View workflow job for this annotation

GitHub Actions / runner / shellcheck

[shellcheck] reported by reviewdog 🐶 RGW_REALM_USER_NUM appears unused. Verify use (or export if used externally). [SC2034](https://github.com/koalaman/shellcheck/wiki/SC2034) Raw Output: ./docker/ceph/set-rgw.sh:11:10:warning:RGW_REALM_USER_NUM appears unused. Verify use (or export if used externally). [SC2034](https://github.com/koalaman/shellcheck/wiki/SC2034)
RGW_DAEMON_PORT=8000

truncate -s0 ${RGW_REALM_USER_ACCESS_KEY_FILE}
Expand All @@ -30,11 +30,11 @@
"$CEPH_BIN"/radosgw-admin user create --uid "${USER_UID}" \
--display-name "${RGW_REALM_USER_NAME}${USER_NUM}" \
--access-key "${RGW_REALM_USER_ACCESS_KEY[${SECRET_INDEX}]}" --secret "${RGW_REALM_USER_SECRET_KEY[${SECRET_INDEX}]}" \
${NAMESPACE_OPTIONS} --system

Check warning on line 33 in docker/ceph/set-rgw.sh

View workflow job for this annotation

GitHub Actions / runner / shellcheck

[shellcheck] reported by reviewdog 🐶 Double quote to prevent globbing and word splitting. [SC2086](https://github.com/koalaman/shellcheck/wiki/SC2086) Raw Output: ./docker/ceph/set-rgw.sh:33:9:info:Double quote to prevent globbing and word splitting. [SC2086](https://github.com/koalaman/shellcheck/wiki/SC2086)

# Create MFA TOTP token.
"$CEPH_BIN"/radosgw-admin mfa create --uid="${USER_UID}" --totp-serial=1 --totp-seed=23456723 --totp-seed-type=base32 \
${NAMESPACE_OPTIONS}

Check warning on line 37 in docker/ceph/set-rgw.sh

View workflow job for this annotation

GitHub Actions / runner / shellcheck

[shellcheck] reported by reviewdog 🐶 Double quote to prevent globbing and word splitting. [SC2086](https://github.com/koalaman/shellcheck/wiki/SC2086) Raw Output: ./docker/ceph/set-rgw.sh:37:9:info:Double quote to prevent globbing and word splitting. [SC2086](https://github.com/koalaman/shellcheck/wiki/SC2086)
}

add_placement_targets_and_storage_classes() {
Expand Down Expand Up @@ -74,7 +74,7 @@

rm -f "$RGW_DAEMON_PID_FILE"

if [[ $(grep "\[$RGW_DAEMON_NAME\]" "$CEPH_CONF" | grep -v grep | wc -l) == 0 ]]; then

Check warning on line 77 in docker/ceph/set-rgw.sh

View workflow job for this annotation

GitHub Actions / runner / shellcheck

[shellcheck] reported by reviewdog 🐶 Consider using 'grep -c' instead of 'grep|wc -l'. [SC2126](https://github.com/koalaman/shellcheck/wiki/SC2126) Raw Output: ./docker/ceph/set-rgw.sh:77:56:style:Consider using 'grep -c' instead of 'grep|wc -l'. [SC2126](https://github.com/koalaman/shellcheck/wiki/SC2126)
"$CEPH_BIN"/ceph -c "$CEPH_CONF" auth get-or-create "$RGW_DAEMON_NAME" \
mon 'allow rw' osd 'allow rwx' mgr 'allow rw' \
>> "$CEPH_CONF_PATH"/keyring
Expand Down Expand Up @@ -146,7 +146,7 @@
echo -n "{$(cat ${RGW_REALM_USER_ACCESS_KEY_FILE} | sed 's/,$//')}" > "${RGW_REALM_USER_ACCESS_KEY_FILE}"
echo -n "{$(cat ${RGW_REALM_USER_SECRET_KEY_FILE} | sed 's/,$//')}" > "${RGW_REALM_USER_SECRET_KEY_FILE}"
else
readonly FIRST_CLUSTER_HOSTNAME=$(hostname | sed -e 's/-cluster.//')
readonly FIRST_CLUSTER_HOSTNAME=$(hostname | sed -e 's/2//g')

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

readonly CLUSTER2_PULL_REALM="${REALM_NAME_PREFIX}1"
readonly CLUSTER2_ZONEGROUP="${ZONEGROUP_NAME_PREFIX}1-${CLUSTER2_PULL_REALM}"
readonly CLUSTER2_ZONE="${ZONE_NAME_PREFIX}3-${CLUSTER2_ZONEGROUP}"
Expand Down
11 changes: 2 additions & 9 deletions docker/ceph/set-start-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,14 @@
[[ -d "$MGR_PYTHON_PATH"/dashboard/frontend ]] && export IS_UPSTREAM_LUMINOUS=0
[[ -z "$RGW" ]] && export RGW=1

export IS_FIRST_CLUSTER=$(hostname | grep -v cluster | wc -l)
export IS_FIRST_CLUSTER=$(hostname | grep -v ceph2 | wc -l)

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

Choose a reason for hiding this comment

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

[shellcheck] reported by reviewdog 🐶
Consider using 'grep -c' instead of 'grep|wc -l'. SC2126


[[ ("$IS_CEPH_RPM" == 0 || -n "$CEPH_REPO_DIR") && "$IS_UPSTREAM_LUMINOUS" == 0 && "$IS_FIRST_CLUSTER" == 1 ]] \
[[ ("$IS_CEPH_RPM" == 0 || -n "$CEPH_REPO_DIR") && "$IS_UPSTREAM_LUMINOUS" == 0 ]] \
&& export FRONTEND_BUILD_REQUIRED=1
FRONTEND_BUILD_OPTIONS=${FRONTEND_BUILD_OPTIONS:-"--deleteOutputPath=false"}

if [[ "$RGW_MULTISITE" == 1 ]]; then
export RGW=0 # Required to prevent vstart from starting any rgw daemon.

if [[ "$IS_FIRST_CLUSTER" == 0 ]]; then
export FS=0
export MDS=0
export MGR=0
export MON=1
fi
fi

RGW_DEBUG=''
Expand All @@ -38,4 +31,4 @@
HTTP_PROTO='https'
fi
export HTTP_PROTO
export CEPH_MGR_DASHBOARD_PORT=$(($CEPH_PORT + 1000))

Check warning on line 34 in docker/ceph/set-start-env.sh

View workflow job for this annotation

GitHub Actions / runner / shellcheck

[shellcheck] reported by reviewdog 🐶 $/${} is unnecessary on arithmetic variables. [SC2004](https://github.com/koalaman/shellcheck/wiki/SC2004) Raw Output: ./docker/ceph/set-start-env.sh:34:35:style:$/${} is unnecessary on arithmetic variables. [SC2004](https://github.com/koalaman/shellcheck/wiki/SC2004)
10 changes: 4 additions & 6 deletions docker/ceph/start-ceph.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -e

source /docker/set-start-env.sh

Check warning on line 5 in docker/ceph/start-ceph.sh

View workflow job for this annotation

GitHub Actions / runner / shellcheck

[shellcheck] reported by reviewdog 🐶 Not following: /docker/set-start-env.sh: openBinaryFile: does not exist (No such file or directory) [SC1091](https://github.com/koalaman/shellcheck/wiki/SC1091) Raw Output: ./docker/ceph/start-ceph.sh:5:8:info:Not following: /docker/set-start-env.sh: openBinaryFile: does not exist (No such file or directory) [SC1091](https://github.com/koalaman/shellcheck/wiki/SC1091)

# Build frontend:
if [[ "$FRONTEND_BUILD_REQUIRED" == 1 ]]; then
Expand All @@ -11,7 +11,7 @@
# Set dev server proxy:
TARGET_URL="${HTTP_PROTO}://${HOSTNAME}:${CEPH_MGR_DASHBOARD_PORT}"
[[ -n "${DASHBOARD_URL}" ]] && TARGET_URL=${DASHBOARD_URL}
jq "(.[] | .target)=\""${TARGET_URL}"\"" proxy.conf.json.sample > proxy.conf.json

Check warning on line 14 in docker/ceph/start-ceph.sh

View workflow job for this annotation

GitHub Actions / runner / shellcheck

[shellcheck] reported by reviewdog 🐶 The surrounding quotes actually unquote this. Remove or escape them. [SC2027](https://github.com/koalaman/shellcheck/wiki/SC2027) Raw Output: ./docker/ceph/start-ceph.sh:14:28:warning:The surrounding quotes actually unquote this. Remove or escape them. [SC2027](https://github.com/koalaman/shellcheck/wiki/SC2027)

Check warning on line 14 in docker/ceph/start-ceph.sh

View workflow job for this annotation

GitHub Actions / runner / shellcheck

[shellcheck] reported by reviewdog 🐶 Double quote to prevent globbing and word splitting. [SC2086](https://github.com/koalaman/shellcheck/wiki/SC2086) Raw Output: ./docker/ceph/start-ceph.sh:14:28:info:Double quote to prevent globbing and word splitting. [SC2086](https://github.com/koalaman/shellcheck/wiki/SC2086)

if [[ "$CEPH_VERSION" == '13' ]]; then
rm -rf package-lock.json node_modules/@angular/cli
Expand Down Expand Up @@ -45,10 +45,10 @@
exit 0
fi

rm -rf "$CEPH_CONF_PATH"/*

Check warning on line 48 in docker/ceph/start-ceph.sh

View workflow job for this annotation

GitHub Actions / runner / shellcheck

[shellcheck] reported by reviewdog 🐶 Use "${var:?}" to ensure this never expands to /* . [SC2115](https://github.com/koalaman/shellcheck/wiki/SC2115) Raw Output: ./docker/ceph/start-ceph.sh:48:8:warning:Use "${var:?}" to ensure this never expands to /* . [SC2115](https://github.com/koalaman/shellcheck/wiki/SC2115)

cd /ceph/build
../src/vstart.sh ${VSTART_OPTIONS}

Check warning on line 51 in docker/ceph/start-ceph.sh

View workflow job for this annotation

GitHub Actions / runner / shellcheck

[shellcheck] reported by reviewdog 🐶 Double quote to prevent globbing and word splitting. [SC2086](https://github.com/koalaman/shellcheck/wiki/SC2086) Raw Output: ./docker/ceph/start-ceph.sh:51:18:info:Double quote to prevent globbing and word splitting. [SC2086](https://github.com/koalaman/shellcheck/wiki/SC2086)

echo 'vstart.sh completed!'

Expand All @@ -58,10 +58,8 @@
fi

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

#Enable and set test_orchestrator module
if [[ "$TEST_ORCHESTRATOR" == 1 ]]; then
Expand All @@ -75,7 +73,7 @@

# Disable ssl (if selected)
readonly VSTART_HAS_SSL_FLAG=$(cat /ceph/src/vstart.sh | grep DASHBOARD_SSL | wc -l)

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

Choose a reason for hiding this comment

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

[shellcheck] reported by reviewdog 🐶
Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead. SC2002

Choose a reason for hiding this comment

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

[shellcheck] reported by reviewdog 🐶
Consider using 'grep -c' instead of 'grep|wc -l'. SC2126

if [[ "$DASHBOARD_SSL" == 0 && "$VSTART_HAS_SSL_FLAG" == 0 && "$IS_FIRST_CLUSTER" == 1 ]]; then
if [[ "$DASHBOARD_SSL" == 0 && "$VSTART_HAS_SSL_FLAG" == 0 ]]; then

Choose a reason for hiding this comment

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

📝 [shellcheck] reported by reviewdog 🐶
Possible misspelling: DASHBOARD_SSL may not be assigned. Did you mean DASHBOARD_URL? SC2153

echo "Disabling SSL..."

SSL_OPTIONS='--force'
Expand All @@ -91,7 +89,7 @@
fi

# Secondary cluster start (or upstream mimic start) ends here.
[[ "$IS_FIRST_CLUSTER" == 0 || "$CEPH_VERSION" -le '13' ]] && exit 0
[[ "$CEPH_VERSION" -le '13' ]] && exit 0

# Create dashboard "test" user:
[[ "$CEPH_VERSION" -gt '14' ]] && DASHBOARD_USER_CREATE_OPTIONS='--force-password'
Expand Down