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

View File

@ -78,9 +78,6 @@ export TINKERBELL_CIDR=29
# should be the second address. # should be the second address.
export TINKERBELL_HOST_IP=192.168.1.1 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 # Tink server username and password
export TINKERBELL_TINK_USERNAME=admin export TINKERBELL_TINK_USERNAME=admin
export TINKERBELL_TINK_PASSWORD="$tink_password" export TINKERBELL_TINK_PASSWORD="$tink_password"

View File

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