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

Option to use Instance Private IPs #8

Closed
neilgroat opened this issue Aug 1, 2017 · 7 comments
Closed

Option to use Instance Private IPs #8

neilgroat opened this issue Aug 1, 2017 · 7 comments
Assignees

Comments

@neilgroat
Copy link

neilgroat commented Aug 1, 2017

This isn't necessarily an issue but adding a flag or environment variable to choose if the script will collect gru and the minion's private IPs vs public would be useful.

For example, my environment is entirely in Amazon including where lucy would run from. Having the instances within a vpc and security group that is locked down so the systems can only talk to each other and reach the internet allows for better overall security versus opening up port 22 to the entire world, along with the other necessary ports.

I modified the script and rebuilt lucy to give this a try and it worked just fine:

# Step 7 - Get private IP addresses from Gru and Minions
GRU_HOST=$(aws ec2 describe-instances --instance-ids $GRU_INSTANCE_ID \
      --query 'Reservations[*].Instances[*].[PrivateIpAddress]' --output text | tr -d '\n')
echo "Gru at $GRU_HOST"

MINION_HOSTS=$(aws ec2 describe-instances --instance-ids $MINION_INSTANCE_IDS \
      --query 'Reservations[*].Instances[*].[PrivateIpAddress]' --output text | tr '\n' ',')
echo "Minions at at $MINION_HOSTS"

Again not necessarily an issue as the package currently works as is, but would be a nice feature.

@dsperling
Copy link
Member

Great suggestion. I am wondering if there is a way that Lucy could be smart enough to auto-detect if it was running in the VPC? I remember seeing an AWS whitepaper showing how an instance can discover its environment within AWS, but I am not sure how it world work if Lucy would run outside the VPC.

@neilgroat
Copy link
Author

neilgroat commented Aug 1, 2017

Possibly use the AWS API like the entrypoint.sh script for the jmeter container does?

  # AWS Public HOSTNAME API
  echo "Detecting an AWS Environment"
  PUBLIC_HOSTNAME=$(curl -s --max-time 5 http://169.254.169.254/latest/meta-data/public-hostname)

  if [ "$PUBLIC_HOSTNAME" = '' ]; then
    echo "Not running in AWS.  Using Gru HOSTNAME $HOSTNAME"
  else
    HOSTNAME=$PUBLIC_HOSTNAME
    echo "Using Gru AWS Public HOSTNAME $HOSTNAME"
  fi

http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html

Possibly have lucy check what her ami-id is?
curl -s --max-time 5 http://169.254.169.254/latest/meta-data/public-hostname

Assuming a value is returned she is in AWS if nothing is returned she is not.

Sent from my Samsung SM-G920W8 using FastHub

@dsperling
Copy link
Member

That should work.

@dsperling dsperling self-assigned this Jan 8, 2018
dsperling added a commit that referenced this issue Jan 9, 2018
@dsperling
Copy link
Member

@neilgroat - I started looking at this issue today as I am also working on feature #10. It occurred to me that we always runs Gru and the minions in the same VPC, so we can always use the private IPs for the Minions. We do need to auto-detect if Lucy is in running in AWS as you suggested. Take a look at the issue-10 branch and test it out. I have a test Lucy here:

docker pull smithmicro/lucy:2.0b1

@dsperling
Copy link
Member

I decided on a simpler approach and not try to have Lucy auto-detect her settings. This allows user to run Lucy in a different VPC, or the same. To tell Lucy to use Gru's Private IP, pass"

--env GRU_PRIVATE_IP=true

To test:
docker pull smithmicro/lucy:2.0b2

@dsperling
Copy link
Member

Fixed in PR #11

@dsperling
Copy link
Member

I have taken down the beta Docker images. You can now test with:

smithmicro/lucy:2.0 or smithmicro/lucy:latest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants