주소 지정이 가능한 여러 domain.local이 포함된 방랑 단일 상자

주소 지정이 가능한 여러 domain.local이 포함된 방랑 단일 상자

저는 현재 Vagrant와 Chef를 활용하여 다양한 앱에 대한 개별 Linux VM을 프로비저닝하고 있습니다.

이러한 앱은 호스트에 다른 설정을 요구하지 않고 호스트에서 도메인 주소를 지정할 수 있습니다. 이는 Linux 게스트에서 avahi를 사용하여 수행됩니다. 그런 다음 호스트는 다음과 같이 게스트의 호스트 이름을 통해 액세스합니다.

myguest1.local -> VM#1
myguest2.local -> VM#2

이제 프로덕션 서버를 복제하기 위해 설치하려는 또 다른 앱이 있습니다. 이 앱에는 하나의 VM 내에서 주소를 지정할 수 있는 다음과 같은 2개의 Apache 가상 호스트가 있어야 합니다.

myguest3.local    
               -> VM#3
myguest4.local    

호스트 시스템을 수정하지 않고도 Vagrant/Chef를 사용하여 이를 완전히 달성할 수 있습니까?

답변1

Avahi.EntryGroup.AddRecord를 사용하여 Avahi API를 통해 별칭을 알릴 수 있습니다.파이썬 예제.

스크립트 사용에 대한 자세한 솔루션은 다음과 같습니다.SO에서 제공

답변2

이를 위한 Vagrant 플러그인이 있습니다: 방랑자 호스트 업데이트

github 페이지에서 추출하세요:

This plugin adds an entry to your /etc/hosts file on the host system.
On up, resume and reload commands, it tries to add the information, if its not already existant in your hosts file. If it needs to be added, you will be asked for an administrator password, since it uses sudo to edit the file.

On halt and destroy, those entries will be removed again.

도 있습니다방랑자 호스트 관리자, Windows 시스템을 지원합니다. 저는 사용해본적이 없어서 피드백 환영합니다.

github 페이지에서 추출하십시오.

vagrant-hostmanager is a Vagrant 1.1+ plugin that manages the /etc/hosts file on guest machines (and optionally the host). Its goal is to enable resolution of multi-machine environments deployed with a cloud provider where IP addresses are not known in advance.

따라서 두 플러그인 모두 항목을 추가하는 프로세스를 자동화하는 것 같습니다./etc/hosts

답변3

확실히 작동하겠지만 호스트의 /etc/hosts 파일에서 가상 호스트에 대한 항목을 수동으로 설정해야 합니다. 이는 호스트 시스템에서 필요한 유일한 단계여야 합니다.

관련 정보