Skip to content

Commit 4b2cfe9

Browse files
authored
PMM-7 Integration setup for PMM + PSMDB
1 parent dc5e0be commit 4b2cfe9

File tree

1 file changed

+90
-0
lines changed

1 file changed

+90
-0
lines changed

pmm_psmdb_setup/pmm_psmdb_setup.sh

+90
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
#!/bin/sh
2+
3+
# Internal variables
4+
declare PSMDB_VERSION CLIENT_VERSION PSMDB_VERSION PSMDB_CONTAINER PMM_CONTAINER_NAME PSMDB_TARBALL PMM_CONTAINER_PORT PMM_CONTAINER_IMAGE PMM_UI_BRANCH PMM_QA_GIT_BRANCH
5+
export CLIENT_VERSION=dev-latest
6+
export PSMDB_CONTAINER=''
7+
export PMM_CONTAINER_NAME=pmm-server
8+
export PMM_CONTAINER_PORT=443
9+
export PMM_CONTAINER_IMAGE=perconalab/pmm-server:dev-latest
10+
export PMM_UI_BRANCH=main
11+
export PMM_QA_GIT_BRANCH=main
12+
export PSMDB_TARBALL=''
13+
export PSMDB_VERSION=4.4
14+
15+
while [ $# -gt 0 ]; do
16+
case "$1" in
17+
--psmdb-version=*)
18+
export PSMDB_VERSION="${1#*=}"
19+
;;
20+
--client-version=*)
21+
export CLIENT_VERSION="${1#*=}"
22+
;;
23+
--pmm-container-name=*)
24+
export PMM_CONTAINER_NAME="${1#*=}"
25+
;;
26+
--pmm-container-port=*)
27+
export PMM_CONTAINER_PORT="${1#*=}"
28+
;;
29+
--pmm-container-image=*)
30+
export PMM_CONTAINER_IMAGE="${1#*=}"
31+
;;
32+
--pmm-ui-branch=*)
33+
export PMM_UI_BRANCH="${1#*=}"
34+
;;
35+
--pmm-qa-branch=*)
36+
export PMM_QA_GIT_BRANCH="${1#*=}"
37+
;;
38+
--psmdb-tarball=*)
39+
export PSMDB_TARBALL="${1#*=}"
40+
;;
41+
*)
42+
printf "***************************\n"
43+
printf "Invalid Argument Passed, usage of this script:\n"
44+
echo "--psmdb-version=4.4 Pass PSMDB Version that needs to be setup for monitoring, default is 4.4"
45+
echo "--client-version=dev-latest Pass the pmm2-client version, acceptable values are dev-latest (Default, if no value passed), pmm2-latest, 2.x.x, or a binary tarball http url"
46+
echo "--psmdb-container=psmdb PSMDB & PMM-CLient Docker container name prefix, default value is psmdb"
47+
echo "--pmm-container-name=pmm-server Pass the pmm-server name, default container name is pmm-server"
48+
echo "--pmm-container-port=443 Pass the pmm-server port, default https port number is 443, http port is 8081"
49+
echo "--pmm-container-image=perconalab/pmm-server:dev-latest Pass the pmm-server image tag, default image is dev-latest"
50+
echo "--psmdb-tarball='' Pass the psmdb tarball, default tarball is fetched for the version from Download Helper in pmm-qa"
51+
echo "--pmm-qa-branch=main Pass the pmm-ui-tests repo branch, default using the main branch"
52+
echo "--pmm-ui-branch=main Pass the pmm-qa repo branch, default using the main branch"
53+
printf "***************************\n"
54+
exit 1
55+
esac
56+
shift
57+
done
58+
59+
declare pmm_server_data=${PMM_CONTAINER_NAME}-data
60+
61+
## Start creating pmm-server docker container, cleanup if one is already running with same name
62+
docker ps -a --filter "name=${PMM_CONTAINER_NAME}" | grep -q . && docker stop ${PMM_CONTAINER_NAME} && docker rm -fv ${PMM_CONTAINER_NAME} || true
63+
docker ps -a --filter "name=${pmm_server_data}" | grep -q . && docker stop ${pmm_server_data} && docker rm -fv ${pmm_server_data} || true
64+
docker create -v /srv --name ${pmm_server_data} ${PMM_CONTAINER_IMAGE}
65+
docker run -d -p 8081:80 -p ${PMM_CONTAINER_PORT}:443 -e PMM_DEBUG=1 --volumes-from ${pmm_server_data} --name ${PMM_CONTAINER_NAME} ${PMM_CONTAINER_IMAGE}
66+
67+
68+
69+
## Fetch PMM-QA Repo, this contains pgsql_pmm_setup scripts, playbook for
70+
sudo rm -r pmm-qa || true ## Delete if the Repo already checkedout
71+
git clone -b ${PMM_QA_GIT_BRANCH} https://github.com/percona/pmm-qa/
72+
pushd pmm-qa/pmm-tests
73+
## Setup a Replica 3 node
74+
export PSMDB_CONTAINER=psmdb_pmm_${PSMDB_VERSION}_replica
75+
bash -x ./pmm-framework.sh --addclient=mo,1 --with-replica --mongomagic --pmm2 --download
76+
sleep 30
77+
## Setup a regular single mongoDB instance
78+
export PSMDB_CONTAINER=psmdb_pmm_${PSMDB_VERSION}_regular
79+
bash -x ./pmm-framework.sh --addclient=mo,1 --mongomagic --pmm2 --download
80+
popd
81+
82+
83+
## Fetch PMM-UI-Tests Repo, this contains all the e2e tests present at path tests/qa-integration/pmm_pgsm_integration_test.js
84+
sudo rm -r pmm-ui-tests || true ## Delete if the Repo already checkedout
85+
git clone -b ${PMM_UI_BRANCH} https://github.com/percona/pmm-ui-tests
86+
pushd pmm-ui-tests
87+
npm install --force
88+
export PMM_UI_URL="http://127.0.0.1:8081/"
89+
./node_modules/.bin/codeceptjs run --debug --steps -c pr.codecept.js --grep '@pmm-psmdb-integration'
90+
popd

0 commit comments

Comments
 (0)