Set NGINX to bind on TINKERBELL_HOST_IP:8080

Signed-off-by: Michael Richard <michael.richard.ing@gmail.com>
This commit is contained in:
Michael Richard 2021-01-25 11:47:26 -05:00
parent cc39216b67
commit c7b84264af
3 changed files with 12 additions and 33 deletions

View File

@ -124,7 +124,7 @@ services:
PACKET_VERSION: ${PACKET_VERSION:-ignored}
ROLLBAR_TOKEN: ${ROLLBAR_TOKEN:-ignored}
ROLLBAR_DISABLE: ${ROLLBAR_DISABLE:-1}
MIRROR_HOST: ${TINKERBELL_NGINX_IP:-127.0.0.1}
MIRROR_HOST: ${TINKERBELL_HOST_IP:-127.0.0.1}:8080
DNS_SERVERS: 8.8.8.8
PUBLIC_IP: $TINKERBELL_HOST_IP
BOOTP_BIND: $TINKERBELL_HOST_IP:67
@ -151,7 +151,7 @@ services:
restart: unless-stopped
tty: true
ports:
- $TINKERBELL_NGINX_IP:80:80/tcp
- $TINKERBELL_HOST_IP:8080:80/tcp
volumes:
- ./state/webroot:/usr/share/nginx/html/

View File

@ -78,9 +78,6 @@ export TINKERBELL_CIDR=29
# should be the second address.
export TINKERBELL_HOST_IP=192.168.1.1
# NGINX IP is used by provisioner to serve files required for iPXE boot
export TINKERBELL_NGINX_IP=192.168.1.2
# Tink server username and password
export TINKERBELL_TINK_USERNAME=admin
export TINKERBELL_TINK_PASSWORD="$tink_password"

View File

@ -59,17 +59,12 @@ get_distro_version() (
)
is_network_configured() (
# Require the provisioner interface have both the host and nginx IP
# Require the provisioner interface have the host IP
if ! ip addr show "$TINKERBELL_NETWORK_INTERFACE" |
grep -q "$TINKERBELL_HOST_IP"; then
return 1
fi
if ! ip addr show "$TINKERBELL_NETWORK_INTERFACE" |
grep -q "$TINKERBELL_NGINX_IP"; then
return 1
fi
return 0
)
@ -144,15 +139,13 @@ setup_networking_netplan() (
--arg interface "$TINKERBELL_NETWORK_INTERFACE" \
--arg cidr "$TINKERBELL_CIDR" \
--arg host_ip "$TINKERBELL_HOST_IP" \
--arg nginx_ip "$TINKERBELL_NGINX_IP" \
'{
network: {
renderer: "networkd",
ethernets: {
($interface): {
addresses: [
"\($host_ip)/\($cidr)",
"\($nginx_ip)/\($cidr)"
"\($host_ip)/\($cidr)"
]
}
}
@ -179,33 +172,24 @@ setup_networking_ubuntu_legacy() (
echo ""
echo "$BLANK Then run the following commands:"
echo "$BLANK ip link set $TINKERBELL_NETWORK_INTERFACE nomaster"
echo "$BLANK ifdown $TINKERBELL_NETWORK_INTERFACE:0"
echo "$BLANK ifdown $TINKERBELL_NETWORK_INTERFACE:1"
echo "$BLANK ifup $TINKERBELL_NETWORK_INTERFACE:0"
echo "$BLANK ifup $TINKERBELL_NETWORK_INTERFACE:1"
echo "$BLANK ifdown $TINKERBELL_NETWORK_INTERFACE"
echo "$BLANK ifup $TINKERBELL_NETWORK_INTERFACE"
exit 1
else
generate_iface_config >>/etc/network/interfaces
ip link set "$TINKERBELL_NETWORK_INTERFACE" nomaster
ifdown "$TINKERBELL_NETWORK_INTERFACE:0"
ifdown "$TINKERBELL_NETWORK_INTERFACE:1"
ifup "$TINKERBELL_NETWORK_INTERFACE:0"
ifup "$TINKERBELL_NETWORK_INTERFACE:1"
ifdown "$TINKERBELL_NETWORK_INTERFACE"
ifup "$TINKERBELL_NETWORK_INTERFACE"
fi
)
generate_iface_config() (
cat <<EOF
auto $TINKERBELL_NETWORK_INTERFACE:0
iface $TINKERBELL_NETWORK_INTERFACE:0 inet static
auto $TINKERBELL_NETWORK_INTERFACE
iface $TINKERBELL_NETWORK_INTERFACE inet static
address $TINKERBELL_HOST_IP/$TINKERBELL_CIDR
pre-up sleep 4
auto $TINKERBELL_NETWORK_INTERFACE:1
iface $TINKERBELL_NETWORK_INTERFACE:1 inet static
address $TINKERBELL_NGINX_IP/$TINKERBELL_CIDR
pre-up sleep 4
EOF
)
@ -221,10 +205,8 @@ ONBOOT=yes
HWADDR=$HWADDRESS
BOOTPROTO=static
IPADDR0=$TINKERBELL_HOST_IP
PREFIX0=$TINKERBELL_CIDR
IPADDR1=$TINKERBELL_NGINX_IP
PREFIX1=$TINKERBELL_CIDR
IPADDR=$TINKERBELL_HOST_IP
PREFIX=$TINKERBELL_CIDR
EOF
)