Skip to content

Commit fd86755

Browse files
committed
improve multicluster support
When the `docker-compose up -d ceph --scale ceph2=1` cmd is run, the first and second deployment consequently tries to run the npm ci which deletes the node_modules/ and breaks the dashboard if the path provided for both cluster is the same. This PR is an approach that tries to address that issue. The only issue with this approach is that the dev server will not work properly for the second cluster if the path is same. Otherwise everything is good. Signed-off-by: Nizamudeen A <nia@redhat.com>
1 parent 7eb323c commit fd86755

3 files changed

Lines changed: 27 additions & 3 deletions

File tree

docker-compose.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ services:
1414
- CEPH_DEBUG=${CEPH_DEBUG:-0}
1515
- CEPH_PORT
1616
- CEPH_REPO_DIR
17+
- CEPH2_REPO_DIR
1718
- CHECK_MYPY=${CHECK_MYPY:-0}
1819
- CYPRESS_CACHE_FOLDER=/ceph/build.cypress
1920
- DASHBOARD_DEV_SERVER=${DASHBOARD_DEV_SERVER:-1}
@@ -67,6 +68,8 @@ services:
6768
image: ${CEPH2_IMAGE:-rhcsdashboard/ceph-rpm:main}
6869
container_name: ceph2
6970
hostname: ceph2
71+
command:
72+
- '-ceph2'
7073
ports: ['${CEPH2_PROXY_HOST_PORT:-4202}:4200','${CEPH2_HOST_PORT:-11002}:11000']
7174
volumes:
7275
- ${CEPH2_REPO_DIR}:/ceph

docker/ceph/entrypoint.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ export_var CEPH_OUT_DIR=/ceph/build."${HOSTNAME}"/out
1818
export_var CEPH_PORT="${CEPH_PORT:-10000}"
1919

2020
rm -rf /ceph/build
21+
22+
if [[ "$@" == *"ceph2"* ]]; then
23+
export_var CEPH_MULTICLUSTER="1"
24+
set -- "/docker/start.sh"
25+
fi
26+
2127
mkdir -p "${CEPH_CONF_PATH}"
2228

2329
if [[ "${IS_CEPH_RPM}" == 1 ]]; then

docker/ceph/start-ceph.sh

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,30 @@ if [[ "$FRONTEND_BUILD_REQUIRED" == 1 ]]; then
1818
npm update @angular/cli
1919
fi
2020

21-
npm ci
21+
if [[ "$CEPH_MULTICLUSTER" != '1' ]]; then
22+
npm ci
23+
fi
2224

23-
if [[ -z "${DASHBOARD_URL}" ]]; then
25+
if [[ -z "${DASHBOARD_URL}" && "$CEPH_MULTICLUSTER" != '1' ]]; then
2426
# Required to run dashboard python module.
2527
npm run build
2628
fi
2729

30+
if [[ "$CEPH_MULTICLUSTER" == '1' ]]; then
31+
if [[ "$CEPH_REPO_DIR" != "$CEPH2_REPO_DIR" ]]; then
32+
npm ci
33+
npm run build
34+
# Start dev server.
35+
npm run start &
36+
else
37+
# Wait until the npm is finished for first cluster
38+
echo "Waiting for npm to finish..."
39+
sleep 180
40+
fi
41+
fi
42+
2843
# Start dev server
29-
if [[ "$DASHBOARD_DEV_SERVER" == 1 || -n "${DASHBOARD_URL}" ]]; then
44+
if [[ "$DASHBOARD_DEV_SERVER" == 1 || -n "${DASHBOARD_URL}" && "$CEPH_MULTICLUSTER" != '1' ]]; then
3045
npm run start &
3146
elif [[ -z "${E2E_CMD}" ]]; then
3247
npm run build -- ${FRONTEND_BUILD_OPTIONS} --watch &

0 commit comments

Comments
 (0)