Local network binding
gdk.testis the standard hostname for referring to the local GDK instance.registry.testis the standard hostname for referring to a local container registry.
We recommend
mapping these to a loopback interface because it’s more flexible, but they can also be mapped to 127.0.0.1.
Local interface
To set up gdk.test and registry.test as hostnames using 127.0.0.1:
Add the following to the end of
/etc/hosts(you must usesudoto save the changes):127.0.0.1 gdk.test registry.testSet
hostnametogdk.test:gdk config set hostname gdk.testReconfigure GDK:
gdk reconfigureRestart GDK to use the new configuration:
gdk restart
Create loopback interface
Some functionality may not work if GDK processes listen on localhost or 127.0.0.1 (for example,
services
running under Docker). Therefore, an IP address on a different private network should be
used.
172.16.123.1 is a useful
private network address
that can avoid clashes with localhost and 127.0.0.1.
To set up gdk.test and registry.test as hostnames using 172.16.123.1:
Create an internal interface.
For macOS, create an alias to the loopback adapter:
sudo ifconfig lo0 alias 172.16.123.1For Linux, create a dummy interface:
sudo ip link add dummy0 type dummy sudo ip address add 172.16.123.1 dev dummy0 sudo ip link set dummy0 upAdd the following to the end of
/etc/hosts(you must usesudoto save the changes):172.16.123.1 gdk.test registry.test
Make sure you remove previous entries for gdk.test, otherwise the hosts file will respect the first entry.
Set
hostnametogdk.test:gdk config set hostname gdk.testSet
listen_addressto172.16.123.1:gdk config set listen_address 172.16.123.1Reconfigure GDK:
gdk reconfigureRestart GDK to use the new configuration:
gdk restartOptional. Make the loopback alias persist across reboots.
Create loopback device on startup
For the loopback alias to work across reboots, the aliased IP address must be setup upon system boot.
macOS
To automate this on macOS, create a file called org.gitlab1.ifconfig.plist at /Library/LaunchDaemons/ containing:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>org.gitlab1.ifconfig</string>
<key>RunAtLoad</key>
<true/>
<key>Nice</key>
<integer>10</integer>
<key>ProgramArguments</key>
<array>
<string>/sbin/ifconfig</string>
<string>lo0</string>
<string>alias</string>
<string>172.16.123.1</string>
</array>
</dict>
</plist>Ensure the created file has the correct permissions:
sudo chown root:wheel /Library/LaunchDaemons/org.gitlab1.ifconfig.plist
sudo chmod 644 /Library/LaunchDaemons/org.gitlab1.ifconfig.plistLinux
The method to persist this dummy interface on Linux varies between distributions.
Ubuntu
On Ubuntu, you can run:
sudo nmcli connection add type dummy ifname dummy0 ip4 172.16.123.1Access GDK on private IP address
You can access the GDK server through your computer’s private IP address. Use this method when you test on multiple devices on the same IP range or network.
Important
You must install the gdk instance in the default ~ location for these commands to work correctly.
Find your local IP address (Mac or Linux)
From a terminal, run the following command:
# On macOS or Linux systems with net-tools installed
ifconfig -a
# On macOS using the default ethernet port or WiFi
# ethernet use `en1`. WiFi use `en0`.
ipconfig getifaddr en0
# On modern Linux systems where ifconfig is unavailable
ip addrThe command provides a list of all wired and wireless adapters that are available on your computer.
Look for the entry with status: active and note its inet address (like 192.168.1.100).
If you know your network’s IP range, you can find your IP address by typing the following
command on your terminal:
# If your IP range is 192.168.xxx.xxx
ifconfig -a | grep 192.168The command output displays your local IP address:
inet 192.168.1.100 netmask 0xffffff00 broadcast 192.168.1.255Update configuration files
Update
gdk.yml:listen_address: 192.168.1.100 # Replace with your actual IP addressReconfigure GDK:
gdk reconfigureTest for IP address connectivity:
# Should print your IP address and port when server starts gdk start
Map your local IP address to gdk.test
To set up gdk.test and registry.test as hostnames by using your local IP address:
Add the following to the end of
/etc/hosts(you must usesudoto save the changes):192.168.1.100 gdk.test registry.test # Replace 192.168.1.100 with your actual IP addressSet
hostnametogdk.test:gdk config set hostname gdk.testReconfigure GDK:
gdk reconfigureTest
gdk.testconnectivity:# Should print gdk.test and port when server starts gdk restart
Troubleshooting
- If your router’s dynamic host configuration protocol (DHCP) assigned your computer’s IP address, you might need to update your configuration files if you change internet connections. This issue can happen if you switch from ethernet to a Wi-Fi connection. It can also happen if your router assigns a new IP address because your lease expired.
- If you try to load GDK by using the IP address from a Windows PC, check that your internet connection is set to private. Only make this change if your PC is fully updated, and you are on a trusted network.
- If you can load your GDK instance by IP address but stylesheets, images, and scripts don’t load,
check the Network tab of your browser for
404errors. You might need to update your local/etc/hostsfile to match the GDK host’s file configuration.