dshoreman / servidor

A modern web application for managing servers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add the guest's LAN IP to list of addresses in installer

dshoreman opened this issue · comments

When installation completes, a success message is shown with a list of links Servidor can be accessed with.

Currently these are servidor.local and the public IP:

info "Servidor is listening at the following addresses:"
info " ${app_url}:8042/"
info " http://$(dig -4 +short myip.opendns.com @resolver1.opendns.com):8042/"

When running Vagrant without one of the hostmanager or hostsupdater plugins however, /etc/hosts isn't updated automatically and so servidor.local won't work. In that case, it's also likely the public IP will not be usable due to lack of port forwarding.

By adding the machine's local IP before the public IP, all our bases are covered.


Note that the Vagrant VM has 3 network adapters. The one we want is likely to be the last one, but that might not be a certainty. Physical servers will vary even more, so it's probably best to add the local IP inside an if is_vagrant block.

Output from ip addr list in my Vagrant install:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 02:95:95:10:ca:f7 brd ff:ff:ff:ff:ff:ff
    inet 10.0.2.15/24 brd 10.0.2.255 scope global dynamic enp0s3
       valid_lft 82462sec preferred_lft 82462sec
    inet6 fe80::95:95ff:fe10:caf7/64 scope link
       valid_lft forever preferred_lft forever
3: enp0s8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 08:00:27:4b:7b:6a brd ff:ff:ff:ff:ff:ff
    inet 192.168.10.100/24 brd 192.168.10.255 scope global enp0s8
       valid_lft forever preferred_lft forever
    inet6 fe80::a00:27ff:fe4b:7b6a/64 scope link
       valid_lft forever preferred_lft forever