-
Notifications
You must be signed in to change notification settings - Fork 102
Conversation
@@ -3,11 +3,11 @@ DIG=/opt/rancher/bin/dig | |||
|
|||
function cluster_init { | |||
sleep 10 | |||
MYIP=$(ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1 | sed -n 2p) | |||
MYIP=$(ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you use giddyup ip myip in a new'ish version it returns the container ip from metadata.
$DIG A $MONGO_SERVICE_NAME +short > ips.tmp | ||
mongo --eval "printjson(rs.initiate())" | ||
for member in $(cat ips.tmp); do | ||
if [ $member != $MYIP ]; then | ||
if [ "$member" != $MYIP ]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you need quotes on MYIP as well?
f07bd5d
to
bfe83c6
Compare
@cloudnautique I removed the use of |
labels: | ||
io.rancher.container.hostname_override: container_name | ||
io.rancher.container.start_once: true | ||
image: rancher/mongodb-conf:v0.1.0 | ||
image: husseingalal/mongodb-conf:v0.2.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since it lives here.. should be rancher.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cloudnautique yeah that's wrong, I was testing with my image and forgot to change it
bfe83c6
to
b195b4f
Compare
@@ -16,6 +19,6 @@ function scaleup { | |||
} | |||
|
|||
# Script starts here | |||
if [ $($DIG A $MONGO_SERVICE_NAME +short | wc -l) -gt 3 ]; then | |||
if [ $($GIDDYUP ip stringify --delimiter " " | wc -w) -gt 3 ]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you are just getting the set scale? giddyup service scale
should do it I think.
@@ -27,7 +30,7 @@ function find_master { | |||
} | |||
# Script starts here | |||
# wait for mongo to start | |||
while [ `$DIG A $MONGO_SERVICE_NAME +short | wc -l` -lt 3 ]; do | |||
while [ `$GIDDYUP ip stringify --delimiter " " | wc -w` -lt 3 ]; do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you want giddyup service wait scale
... check the docs.. but essentially it gates until set scale and the number of containers that exist are equal.
b195b4f
to
fcdb3a0
Compare
@@ -1,13 +1,16 @@ | |||
#!/bin/bash | |||
DIG=/opt/rancher/bin/dig | |||
|
|||
set -x |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typically we don't deploy with -x.. if you want it, maybe put it behind a debug env var or something. CATTLE_SCRIPT_DEBUG I think is the convention...
MYIP=$(ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1 | sed -n 2p) | ||
$DIG A $MONGO_SERVICE_NAME +short > ips.tmp | ||
MYIP=$($GIDDYUP ip myip) | ||
$GIDDYUP ip stringify --delimiter " " > ips.tmp | ||
mongo --eval "printjson(rs.initiate())" | ||
for member in $(cat ips.tmp); do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
something more like this, to avoid writing/reading a file
for member in $(giddyup ip stringify --delimiter " "); do
if [ "$member" != "$MYIP" ]; then
...
fi
done
@@ -1,5 +1,7 @@ | |||
#!/bin/bash | |||
|
|||
set -x |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above.
@@ -1,10 +1,13 @@ | |||
#!/bin/bash | |||
|
|||
set -x |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above.
fcdb3a0
to
e65f0fb
Compare
please merge this!! :) right now the mongo catalog item is broken |
Fix the way to fetch local IP address of the container.