Skip to content

Commit

Permalink
Merge pull request #49 from malscent/MB-47142-SpecifyDisk
Browse files Browse the repository at this point in the history
Fix issue where we were calling Amazon Metadata service
  • Loading branch information
malscent authored May 24, 2022
2 parents 39794cf + 8112b11 commit 03a8890
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/StackTests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
- name: Docker containers running?
run: docker ps
- name: Test
run: while ! curl http://localhost:8081/ui/index.html; do sleep 10; done;
run: while ! curl http://localhost:8091/ui/index.html; do sleep 10; done;
timeout-minutes: 15
- name: Teardown
run: docker-compose -f ./compose-files/UbuntuClusterCompose.yml down
12 changes: 6 additions & 6 deletions compose-files/UbuntuClusterCompose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ services:
hostname: 'clusterhost'
tty: true
ports:
- "8080:8091"
- "8091:8091"
networks:
- cb-net-ubuntu
container_name: ubuntu-clusterhost
Expand All @@ -23,7 +23,7 @@ services:
networks:
- cb-net-ubuntu
ports:
- "8081:8091"
- "9091:8091"
container_name: ubuntu-node-one
command: --version 7.0.2 -u couchbase -p foo123! -ch ubuntu-clusterhost -d -os UBUNTU -r
privileged: true
Expand All @@ -36,7 +36,7 @@ services:
networks:
- cb-net-ubuntu
ports:
- "8082:8091"
- "9092:8091"
container_name: ubuntu-node-two
command: --version 7.0.2 -u couchbase -p foo123! -ch ubuntu-clusterhost -d -os UBUNTU -r
privileged: true
Expand All @@ -49,7 +49,7 @@ services:
networks:
- cb-net-ubuntu
ports:
- "8083:8091"
- "9093:8091"
container_name: ubuntu-no-cluster
command: --version 7.0.2 -u couchbase -p foo123! -ch ubuntu-clusterhost -d -os UBUNTU -r --no-cluster --services data,index,query,analytics,eventing,fts -dm 256 -im 256 -qm 256 -am 1024 -em 256 -sm 256
privileged: true
Expand All @@ -62,8 +62,8 @@ services:
networks:
- cb-net-ubuntu
ports:
- "8085:4985"
- "8086:4984"
- "9095:4985"
- "9096:4984"
container_name: gateway
command: --version 2.8.2 -u couchbase -p foo123! -ch ubuntu-clusterhost -d -os UBUNTU -g -r
privileged: true
Expand Down
17 changes: 7 additions & 10 deletions main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -291,24 +291,21 @@ fi
#installing prerequisites from installer
__install_prerequisites "$OS" "$ENV" "$SYNC_GATEWAY"

PUBLIC_HOSTNAME=""
#Getting information to determine whether this is the cluster host or not.
if [[ "$OS" == "AMAZON" ]]; then
LOCAL_IP=$(ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1')
HOST=$(hostname) || hostnamectl
PUBLIC_HOSTNAME=$(wget -O - http://169.254.169.254/latest/meta-data/public-hostname -q) || PUBLIC_HOSTNAME=$(hostname)
else
LOCAL_IP=$(ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1')
HOST=$(hostname) || hostnamectl
fi
LOCAL_IP=$(ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1')
HOST=$(hostname) || hostnamectl
# Do a reverse DNS lookup on the cluster host and see if it is this local ip
PUBLIC_HOST_IP=$(dig +short "$CLUSTER_HOST")

__log_debug "Hostname: ${HOST}"
__log_debug "Local IP: ${LOCAL_IP}"

# Check if host is cluster host, or local ip, or if the clusterhost contains the host for FQDN on GCP

if [[ "$CLUSTER_HOST" == "$HOST" ]] ||
[[ "$CLUSTER_HOST" == "$LOCAL_IP" ]] ||
[[ "$CLUSTER_HOST" == *"$HOST"* ]] ||
[[ "$CLUSTER_HOST" == "$PUBLIC_HOSTNAME" ]]; then
[[ "$PUBLIC_HOST_IP" == "$LOCAL_IP" ]]; then
__log_info "${CLUSTER_HOST} is host and is this machine"
DO_CLUSTER=1
fi
Expand Down
2 changes: 1 addition & 1 deletion test_scripts/ubuntu/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM ubuntu:18.04
RUN apt-get update && apt-get install -y python procps && apt-get clean
RUN apt-get update && apt-get install -y python procps dnsutils && apt-get clean
COPY . /app
COPY ./test_scripts/docker/systemctl.py /usr/bin/systemctl
RUN chmod +x /usr/bin/systemctl
Expand Down

0 comments on commit 03a8890

Please sign in to comment.