CircleCI-Archived / enterprise-setup

Installation resources for CircleCI Enterprise
MIT License
107 stars 170 forks source link

Detect private IP address by routing table #176

Closed makotom closed 4 years ago

makotom commented 4 years ago

Description

This PR intends to change the logic to detect a private IP address for a Nomad client, so that the programme detects the address by checking the source address it will use to communicate with its Nomad server.

Background

Originally, it was designed to guess the private IP address by getting an address which is bound to ens3. It is not a good thing to do because:

Impact without this change

Without this change, installation of CircleCI Server will fail under certain circumstances, especially if AWS VPCs with enableDnsHostnames disabled. Note that this situation can happen very easily because it is disabled by default for the VPCs created with "Create new" button in the "Your VPCs" view.

Justification for the approach of this code change

Unlike the approach suggested in #135, the change in this PR tries to detect IP addresses by using generic features provided by the Linux kernel (i.e. iproute2). That should increase interoperability and robustness against possible spec changes in AWS.

Fixed Issues

135

Contribution checklist

☑️ I have read the Contributing Guidelines ☑️ Commits have been made with meaningful commit messages ☑️ All automated tests have passed successfully

MikeyYeahYeah commented 4 years ago

Thank you for looking into this and proposing this change. In this particular instance, I believe it would be better if we take advantage of the AWS "Magic IP" as we did for the Instance ID in the line following your change. This repo is exclusively used to create Server within AWS environments so it is reasonable to assume that the Magic IP will be available. Would love to get the opinion from someone else on @circleci/release-engineering though.

MikeyYeahYeah commented 4 years ago

Created Ticket for RE-399 to address this. Will reopen when we can.