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

PMM3 fix docker compose changes #80

Merged
merged 1 commit into from
Sep 18, 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
16 changes: 8 additions & 8 deletions pmm_psmdb-pbm_setup/configure-agents.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ nodes="rs101 rs102 rs103"
for node in $nodes
do
echo "congiguring pbm agent on $node"
docker compose -f docker compose-rs.yaml exec -T $node bash -c "echo \"PBM_MONGODB_URI=mongodb://${pbm_user}:${pbm_pass}@127.0.0.1:27017\" > /etc/sysconfig/pbm-agent"
docker compose -f docker-compose-rs.yaml exec -T $node bash -c "echo \"PBM_MONGODB_URI=mongodb://${pbm_user}:${pbm_pass}@127.0.0.1:27017\" > /etc/sysconfig/pbm-agent"
echo "restarting pbm agent on $node"
docker compose -f docker compose-rs.yaml exec -T $node systemctl restart pbm-agent
docker compose -f docker-compose-rs.yaml exec -T $node systemctl restart pbm-agent
done

if [[ $mongo_setup_type == "psa" ]]; then
echo "stop pbm agent for arbiter node"
docker compose -f docker compose-rs.yaml exec -T rs103 systemctl stop pbm-agent
docker compose -f docker-compose-rs.yaml exec -T rs103 systemctl stop pbm-agent
fi
echo
echo "configuring pmm agents"
Expand All @@ -29,17 +29,17 @@ nodes="rs101 rs102 rs103"
for node in $nodes
do
echo "congiguring pmm agent on $node"
docker compose -f docker compose-rs.yaml exec -T -e PMM_AGENT_SETUP_NODE_NAME=${node}._${random_number} $node pmm-agent setup
docker compose -f docker-compose-rs.yaml exec -T -e PMM_AGENT_SETUP_NODE_NAME=${node}._${random_number} $node pmm-agent setup
if [[ $mongo_setup_type == "psa" && $node == "rs103" ]]; then
docker compose -f docker compose-rs.yaml exec -T $node pmm-admin add mongodb --enable-all-collectors --cluster=replicaset --replication-set=rs ${node}_${random_number} 127.0.0.1:27017
docker compose -f docker-compose-rs.yaml exec -T $node pmm-admin add mongodb --enable-all-collectors --cluster=replicaset --replication-set=rs ${node}_${random_number} 127.0.0.1:27017
else
docker compose -f docker compose-rs.yaml exec -T $node pmm-admin add mongodb --enable-all-collectors --cluster=replicaset --replication-set=rs --username=${pmm_mongo_user} --password=${pmm_mongo_user_pass} ${node}_${random_number} 127.0.0.1:27017
docker compose -f docker-compose-rs.yaml exec -T $node pmm-admin add mongodb --enable-all-collectors --cluster=replicaset --replication-set=rs --username=${pmm_mongo_user} --password=${pmm_mongo_user_pass} ${node}_${random_number} 127.0.0.1:27017
fi
done
echo
echo "adding some data"
docker compose -f docker compose-rs.yaml exec -T rs101 mgodatagen -f /etc/datagen/replicaset.json --uri=mongodb://${pmm_mongo_user}:${pmm_mongo_user_pass}@127.0.0.1:27017/?replicaSet=rs
docker compose -f docker compose-rs.yaml exec -T rs101 mongo "mongodb://${pmm_mongo_user}:${pmm_mongo_user_pass}@localhost/?replicaSet=rs" --quiet << EOF
docker compose -f docker-compose-rs.yaml exec -T rs101 mgodatagen -f /etc/datagen/replicaset.json --uri=mongodb://${pmm_mongo_user}:${pmm_mongo_user_pass}@127.0.0.1:27017/?replicaSet=rs
docker compose -f docker-compose-rs.yaml exec -T rs101 mongo "mongodb://${pmm_mongo_user}:${pmm_mongo_user_pass}@localhost/?replicaSet=rs" --quiet << EOF
use students;
db.students.insertMany([
{
Expand Down
12 changes: 6 additions & 6 deletions pmm_psmdb-pbm_setup/configure-extra-agents.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ nodes="rs201 rs202 rs203"
for node in $nodes
do
echo "configuring pbm agent on $node"
docker compose -f docker compose-rs.yaml exec -T $node bash -c "echo \"PBM_MONGODB_URI=mongodb://${pbm_user}:${pbm_pass}@127.0.0.1:27017\" > /etc/sysconfig/pbm-agent"
docker compose -f docker-compose-rs.yaml exec -T $node bash -c "echo \"PBM_MONGODB_URI=mongodb://${pbm_user}:${pbm_pass}@127.0.0.1:27017\" > /etc/sysconfig/pbm-agent"
echo "restarting pbm agent on $node"
docker compose -f docker compose-rs.yaml exec -T $node systemctl restart pbm-agent
docker compose -f docker-compose-rs.yaml exec -T $node systemctl restart pbm-agent
done

if [[ $mongo_setup_type == "psa" ]]; then
echo "stop pbm agent for arbiter node rs203"
docker compose -f docker compose-rs.yaml exec -T rs203 systemctl stop pbm-agent
docker compose -f docker-compose-rs.yaml exec -T rs203 systemctl stop pbm-agent
fi
echo
echo "configuring pmm agents"
Expand All @@ -29,10 +29,10 @@ nodes="rs201 rs202 rs203"
for node in $nodes
do
echo "configuring pmm agent on $node"
docker compose -f docker compose-rs.yaml exec -T -e PMM_AGENT_SETUP_NODE_NAME=${node}._${random_number} $node pmm-agent setup
docker compose -f docker-compose-rs.yaml exec -T -e PMM_AGENT_SETUP_NODE_NAME=${node}._${random_number} $node pmm-agent setup
if [[ $mongo_setup_type == "psa" && $node == "rs203" ]]; then
docker compose -f docker compose-rs.yaml exec -T $node pmm-admin add mongodb --enable-all-collectors --cluster=replicaset --replication-set=rs1 ${node}_${random_number} 127.0.0.1:27017
docker compose -f docker-compose-rs.yaml exec -T $node pmm-admin add mongodb --enable-all-collectors --cluster=replicaset --replication-set=rs1 ${node}_${random_number} 127.0.0.1:27017
else
docker compose -f docker compose-rs.yaml exec -T $node pmm-admin add mongodb --enable-all-collectors --cluster=replicaset --replication-set=rs1 --username=${pmm_mongo_user} --password=${pmm_mongo_user_pass} ${node}_${random_number} 127.0.0.1:27017
docker compose -f docker-compose-rs.yaml exec -T $node pmm-admin add mongodb --enable-all-collectors --cluster=replicaset --replication-set=rs1 --username=${pmm_mongo_user} --password=${pmm_mongo_user_pass} ${node}_${random_number} 127.0.0.1:27017
fi
done
10 changes: 5 additions & 5 deletions pmm_psmdb-pbm_setup/configure-extra-psa.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pbm_pass=${PBM_PASS:-pbmpass}

echo
echo "configuring extra PSA replicaset with members priorities"
docker compose -f docker compose-rs.yaml exec -T rs201 mongo --quiet << EOF
docker compose -f docker-compose-rs.yaml exec -T rs201 mongo --quiet << EOF
config = {
"_id" : "rs",
"members" : [
Expand All @@ -35,12 +35,12 @@ echo
sleep 60
echo
echo "configuring root user on primary"
docker compose -f docker compose-rs.yaml exec -T rs201 mongo --quiet << EOF
docker compose -f docker-compose-rs.yaml exec -T rs201 mongo --quiet << EOF
db.getSiblingDB("admin").createUser({ user: "root", pwd: "root", roles: [ "root", "userAdminAnyDatabase", "clusterAdmin" ] });
EOF
echo
echo "configuring pbm and pmm roles"
docker compose -f docker compose-rs.yaml exec -T rs201 mongo "mongodb://root:root@localhost/?replicaSet=rs" --quiet << EOF
docker compose -f docker-compose-rs.yaml exec -T rs201 mongo "mongodb://root:root@localhost/?replicaSet=rs" --quiet << EOF
db.getSiblingDB("admin").createRole({
"role": "pbmAnyAction",
"privileges": [{
Expand Down Expand Up @@ -70,7 +70,7 @@ db.getSiblingDB("admin").createRole({
EOF
echo
echo "creating pbm user"
docker compose -f docker compose-rs.yaml exec -T rs201 mongo "mongodb://root:root@localhost/?replicaSet=rs" --quiet << EOF
docker compose -f docker-compose-rs.yaml exec -T rs201 mongo "mongodb://root:root@localhost/?replicaSet=rs" --quiet << EOF
db.getSiblingDB("admin").createUser({
user: "${pbm_user}",
pwd: "${pbm_pass}",
Expand All @@ -85,7 +85,7 @@ db.getSiblingDB("admin").createUser({
EOF
echo
echo "creating pmm user"
docker compose -f docker compose-rs.yaml exec -T rs201 mongo "mongodb://root:root@localhost/?replicaSet=rs" --quiet << EOF
docker compose -f docker-compose-rs.yaml exec -T rs201 mongo "mongodb://root:root@localhost/?replicaSet=rs" --quiet << EOF
db.getSiblingDB("admin").createUser({
user: "${pmm_mongo_user}",
pwd: "${pmm_mongo_user_pass}",
Expand Down
10 changes: 5 additions & 5 deletions pmm_psmdb-pbm_setup/configure-extra-replset.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pbm_pass=${PBM_PASS:-pbmpass}

echo
echo "configuring replicaset with members priorities"
docker compose -f docker compose-rs.yaml exec -T rs201 mongo --quiet << EOF
docker compose -f docker-compose-rs.yaml exec -T rs201 mongo --quiet << EOF
config = {
"_id" : "rs",
"members" : [
Expand All @@ -35,12 +35,12 @@ echo
sleep 60
echo
echo "configuring root user on primary"
docker compose -f docker compose-rs.yaml exec -T rs201 mongo --quiet << EOF
docker compose -f docker-compose-rs.yaml exec -T rs201 mongo --quiet << EOF
db.getSiblingDB("admin").createUser({ user: "root", pwd: "root", roles: [ "root", "userAdminAnyDatabase", "clusterAdmin" ] });
EOF
echo
echo "configuring pbm and pmm roles"
docker compose -f docker compose-rs.yaml exec -T rs201 mongo "mongodb://root:root@localhost/?replicaSet=rs" --quiet << EOF
docker compose -f docker-compose-rs.yaml exec -T rs201 mongo "mongodb://root:root@localhost/?replicaSet=rs" --quiet << EOF
db.getSiblingDB("admin").createRole({
"role": "pbmAnyAction",
"privileges": [{
Expand Down Expand Up @@ -70,7 +70,7 @@ db.getSiblingDB("admin").createRole({
EOF
echo
echo "creating pbm user"
docker compose -f docker compose-rs.yaml exec -T rs201 mongo "mongodb://root:root@localhost/?replicaSet=rs" --quiet << EOF
docker compose -f docker-compose-rs.yaml exec -T rs201 mongo "mongodb://root:root@localhost/?replicaSet=rs" --quiet << EOF
db.getSiblingDB("admin").createUser({
user: "${pbm_user}",
pwd: "${pbm_pass}",
Expand All @@ -85,7 +85,7 @@ db.getSiblingDB("admin").createUser({
EOF
echo
echo "creating pmm user"
docker compose -f docker compose-rs.yaml exec -T rs201 mongo "mongodb://root:root@localhost/?replicaSet=rs" --quiet << EOF
docker compose -f docker-compose-rs.yaml exec -T rs201 mongo "mongodb://root:root@localhost/?replicaSet=rs" --quiet << EOF
db.getSiblingDB("admin").createUser({
user: "${pmm_mongo_user}",
pwd: "${pmm_mongo_user_pass}",
Expand Down
10 changes: 5 additions & 5 deletions pmm_psmdb-pbm_setup/configure-psa.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pbm_pass=${PBM_PASS:-pbmpass}

echo
echo "configuring PSA replicaset with members priorities"
docker compose -f docker compose-rs.yaml exec -T rs101 mongo --quiet << EOF
docker compose -f docker-compose-rs.yaml exec -T rs101 mongo --quiet << EOF
config = {
"_id" : "rs",
"members" : [
Expand All @@ -35,12 +35,12 @@ echo
sleep 60
echo
echo "configuring root user on primary"
docker compose -f docker compose-rs.yaml exec -T rs101 mongo --quiet << EOF
docker compose -f docker-compose-rs.yaml exec -T rs101 mongo --quiet << EOF
db.getSiblingDB("admin").createUser({ user: "root", pwd: "root", roles: [ "root", "userAdminAnyDatabase", "clusterAdmin" ] });
EOF
echo
echo "configuring pbm and pmm roles"
docker compose -f docker compose-rs.yaml exec -T rs101 mongo "mongodb://root:root@localhost/?replicaSet=rs" --quiet << EOF
docker compose -f docker-compose-rs.yaml exec -T rs101 mongo "mongodb://root:root@localhost/?replicaSet=rs" --quiet << EOF
db.getSiblingDB("admin").createRole({
"role": "pbmAnyAction",
"privileges": [{
Expand Down Expand Up @@ -70,7 +70,7 @@ db.getSiblingDB("admin").createRole({
EOF
echo
echo "creating pbm user"
docker compose -f docker compose-rs.yaml exec -T rs101 mongo "mongodb://root:root@localhost/?replicaSet=rs" --quiet << EOF
docker compose -f docker-compose-rs.yaml exec -T rs101 mongo "mongodb://root:root@localhost/?replicaSet=rs" --quiet << EOF
db.getSiblingDB("admin").createUser({
user: "${pbm_user}",
pwd: "${pbm_pass}",
Expand All @@ -85,7 +85,7 @@ db.getSiblingDB("admin").createUser({
EOF
echo
echo "creating pmm user"
docker compose -f docker compose-rs.yaml exec -T rs101 mongo "mongodb://root:root@localhost/?replicaSet=rs" --quiet << EOF
docker compose -f docker-compose-rs.yaml exec -T rs101 mongo "mongodb://root:root@localhost/?replicaSet=rs" --quiet << EOF
db.getSiblingDB("admin").createUser({
user: "${pmm_mongo_user}",
pwd: "${pmm_mongo_user_pass}",
Expand Down
10 changes: 5 additions & 5 deletions pmm_psmdb-pbm_setup/configure-replset.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pbm_pass=${PBM_PASS:-pbmpass}

echo
echo "configuring replicaset with members priorities"
docker compose -f docker compose-rs.yaml exec -T rs101 mongo --quiet << EOF
docker compose -f docker-compose-rs.yaml exec -T rs101 mongo --quiet << EOF
config = {
"_id" : "rs",
"members" : [
Expand All @@ -35,12 +35,12 @@ echo
sleep 60
echo
echo "configuring root user on primary"
docker compose -f docker compose-rs.yaml exec -T rs101 mongo --quiet << EOF
docker compose -f docker-compose-rs.yaml exec -T rs101 mongo --quiet << EOF
db.getSiblingDB("admin").createUser({ user: "root", pwd: "root", roles: [ "root", "userAdminAnyDatabase", "clusterAdmin" ] });
EOF
echo
echo "configuring pbm and pmm roles"
docker compose -f docker compose-rs.yaml exec -T rs101 mongo "mongodb://root:root@localhost/?replicaSet=rs" --quiet << EOF
docker compose -f docker-compose-rs.yaml exec -T rs101 mongo "mongodb://root:root@localhost/?replicaSet=rs" --quiet << EOF
db.getSiblingDB("admin").createRole({
"role": "pbmAnyAction",
"privileges": [{
Expand Down Expand Up @@ -70,7 +70,7 @@ db.getSiblingDB("admin").createRole({
EOF
echo
echo "creating pbm user"
docker compose -f docker compose-rs.yaml exec -T rs101 mongo "mongodb://root:root@localhost/?replicaSet=rs" --quiet << EOF
docker compose -f docker-compose-rs.yaml exec -T rs101 mongo "mongodb://root:root@localhost/?replicaSet=rs" --quiet << EOF
db.getSiblingDB("admin").createUser({
user: "${pbm_user}",
pwd: "${pbm_pass}",
Expand All @@ -85,7 +85,7 @@ db.getSiblingDB("admin").createUser({
EOF
echo
echo "creating pmm user"
docker compose -f docker compose-rs.yaml exec -T rs101 mongo "mongodb://root:root@localhost/?replicaSet=rs" --quiet << EOF
docker compose -f docker-compose-rs.yaml exec -T rs101 mongo "mongodb://root:root@localhost/?replicaSet=rs" --quiet << EOF
db.getSiblingDB("admin").createUser({
user: "${pmm_mongo_user}",
pwd: "${pmm_mongo_user_pass}",
Expand Down
6 changes: 3 additions & 3 deletions pmm_psmdb-pbm_setup/start-rs-only.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ docker network create pmm2-ui-tests_pmm-network || true
export COMPOSE_PROFILES=${profile}
export MONGO_SETUP_TYPE=${mongo_setup_type}

docker compose -f docker compose-rs.yaml down -v --remove-orphans
docker compose -f docker compose-rs.yaml build --no-cache
docker compose -f docker compose-rs.yaml up -d
docker compose -f docker-compose-rs.yaml down -v --remove-orphans
docker compose -f docker-compose-rs.yaml build --no-cache
docker compose -f docker-compose-rs.yaml up -d
echo
echo "waiting 60 seconds for replica set members to start"
sleep 60
Expand Down
16 changes: 8 additions & 8 deletions pmm_psmdb-pbm_setup/start-rs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ docker network create pmm2-ui-tests_pmm-network || true
export COMPOSE_PROFILES=${profile}
export MONGO_SETUP_TYPE=${mongo_setup_type}

docker compose -f docker compose-rs.yaml -f docker compose-pmm.yaml down -v --remove-orphans
docker compose -f docker compose-rs.yaml -f docker compose-pmm.yaml build
docker compose -f docker compose-pmm.yaml -f docker compose-rs.yaml up -d
docker compose -f docker-compose-rs.yaml -f docker-compose-pmm.yaml down -v --remove-orphans
docker compose -f docker-compose-rs.yaml -f docker-compose-pmm.yaml build
docker compose -f docker-compose-pmm.yaml -f docker-compose-rs.yaml up -d
echo
echo "waiting 30 seconds for pmm-server to start"
sleep 30
echo "configuring pmm-server"
docker compose -f docker compose-pmm.yaml exec -T pmm-server change-admin-password $pmm_server_admin_pass
docker compose -f docker-compose-pmm.yaml exec -T pmm-server change-admin-password $pmm_server_admin_pass
echo "restarting pmm-server"
docker compose -f docker compose-pmm.yaml restart pmm-server
docker compose -f docker-compose-pmm.yaml restart pmm-server
echo "waiting 30 seconds for pmm-server to start"
sleep 30
if [ $mongo_setup_type == "pss" ]; then
Expand All @@ -36,8 +36,8 @@ tests=${TESTS:-yes}
if [ $tests != "no" ]; then
echo
echo "running tests"
docker compose -f docker compose-pmm.yaml run test pytest -s -x --verbose test.py
docker compose -f docker compose-pmm.yaml run test chmod -R 777 .
docker compose -f docker-compose-pmm.yaml run test pytest -s -x --verbose test.py
docker compose -f docker-compose-pmm.yaml run test chmod -R 777 .
else
echo
echo "skipping tests"
Expand All @@ -46,7 +46,7 @@ cleanup=${CLEANUP:-yes}
if [ $cleanup != "no" ]; then
echo
echo "cleanup"
docker compose -f docker compose-rs.yaml -f docker compose-pmm.yaml down -v --remove-orphans
docker compose -f docker-compose-rs.yaml -f docker-compose-pmm.yaml down -v --remove-orphans
else
echo
echo "skipping cleanup"
Expand Down
Loading
Loading