# Local Development Tips and Tricks
We've collected a list of tips and tricks for optimizing your local development environment. We invite you to ask questions, collaborate with the community, and share your own favorite practices over on the Entando forum (opens new window).
# Kubernetes
Per the Getting Started guide, we've recommended using Multipass as a way to quickly spin up an Ubuntu VM to host a local Kubernetes cluster for test purposes. There are many times when a local environment is useful but most teams utilize a shared Kubernetes cluster managed by an operations team and installed either on premise or with a cloud provider for full integration testing, CI/CD, DevOps, etc.
# Network issues
A local Entando 6.2 quickstart installation (e.g. what you'll get if you follow the Getting Started guide) uses a set of local domain names to enable accessing Entando services. Your IP address will vary but they will look something like this:
quickstart-entando.192.168.99.1.nip.io
quickstart-kc-entando.192.168.99.1.nip.io
quickstart-eci-entando.192.168.99.1.nip.io
The base domain configured via the ENTANDO_DEFAULT_ROUTING_SUFFIX (e.g. in your entando.yaml) is based on a fixed IP address and that address is configured during the initial installation. That setting is used to generate ingress routes to map incoming URLs to individual services. In production environments there's generally a dedicated network layer to manage IPs/routing (both on premise and cloud) but those options are often not readily available in a local setup. Here are a couple common issues that can prevent Entando from starting in a local environment:
# .nip.io isn't allowed
- This could be because of firewall settings or corporate security policies. The simplest workaround is to manually edit your /etc/hosts file and map the necessary domains to the IP of your local virtual machine.
192.168.99.1 quickstart-kc-entando.192.168.99.1.nip.io
192.168.99.1 quickstart-eci-entando.192.168.99.1.nip.io
192.168.99.1 quickstart-entando.192.168.99.1.nip.io
- If you add microservices to your installation, you may need to add additional mappings for the new ingresses.
- See this section below for detailed steps on Windows.
# The IP address changed after the initial install
- The workaround noted above (e.g. update your /etc/hosts file) can also be used here. Simply update the IP address in the first column to use the current IP of your virtual machine.
- On Windows this can happen simply because your laptop restarted. See Windows Hyper-V IP Changes below.
# Windows development
# Hyper-V IP changes
Q: My Entando installation stops working when I restart Windows. How can I fix this?
A: The basic issue is that Windows Hyper-V makes it difficult to set a static IP for a VM. (See this forum post (opens new window) for details.) As discussed above, Entando's ingress routes rely on an fixed IP address and will break if the IP address changes after initial installation. Here are a few options to solve this issue, short of modifying your router or network switch settings:
# Option 1: Manually update your hosts file
The simplest option to re-enable external access to your cluster is to update your hosts file after each Windows restart.
You need two pieces of information for this workaround and you'll need administrator access to do this.
- Determine the original IP used for your VM. This is included in the
ENTANDO_DEFAULT_ROUTING_SUFFIX
or you can see it included in the ingress names. Runkubectl -n entando get ingress
and you should see something like this:
NAME CLASS HOSTS
quickstart-kc-ingress <none> quickstart-kc-entando.192.168.235.100.nip.io
quickstart-eci-ingress <none> quickstart-eci-entando.192.168.235.100.nip.io
quickstart-ingress <none> quickstart-entando.192.168.235.100.nip.io
- Determine the current IP using
hostname -I
in the VM or by runningmultipass list
from Windows:
$ multipass list
Name State IPv4 Image
primary Running 172.31.118.12 Ubuntu 18.04 LTS
- As a Windows administrator, edit your hosts file
(C:\Windows\System32\drivers\etc\hosts)
to map any needed URLs from the old IP to the new IP. This will bypass .nip.io lookups.
172.31.118.12 quickstart-kc-entando.192.168.235.100.nip.io
172.31.118.12 quickstart-eci-entando.192.168.235.100.nip.io
172.31.118.12 quickstart-entando.192.168.235.100.nip.io
- You should now be able to access your Entando URLs via the new IP. If your Entando installation stalled during startup, it should continue starting up as soon as the external address is functional again.
# Option 2: Add a Windows route
This option is a little more involved the first time but it means repairing your network settings can be done very easily later. In this case you'll pick a static IP, configure a Windows route to map it to the Hyper-V interface, and claim the IP in the Ubuntu VM via a netplan entry.
You'll need to run all of these steps before installing Entando the first time but then just steps #1 and #2 after subsequent Windows restarts.
Determine an IP that is unused on your local network. You can use ping or other tools for this but in the following steps we assume that your selected IP is 192.168.99.1.
Determine the interface address to Hyper-V, e.g. 32 below. Use cmd
route print
and look for the Interface entry for Hyper-V:
Interface List
32...00 15 5d 86 45 20 ......Hyper-V Virtual Ethernet Adapter
- Using elevated privileges, add a persistent route to map your IP to the Hyper-V interface:
route -p add [YOUR-IP] mask 255.255.255.255 0.0.0.0 IF [HYPER-V-INTERFACE]
route -p add 192.168.99.1 mask 255.255.255.255 0.0.0.0 IF 32
Verify the route was added by using
route print 192.168.99.1
. This command is useful after restart to check if the route needs to be created again.Next, configure your VM to claim the same address. Shell into the VM using
winpty multipass shell [YOUR-VM-NAME]
.Change to the root user to make the following steps simpler:
sudo -i
Determine your network adapter via
ip link
, e.g. eth0. You just need the name. It's often second in the list after the loopback adapter.
ubuntu@primary:~$ ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
link/ether 00:15:5d:00:1a:0c brd ff:ff:ff:ff:ff:ff
cd /etc/netplan
Create a netplan entry starting with 0 so it's loaded first:
vi 0-entando.yaml
network:
version: 2
renderer: networkd
ethernets:
[YOUR-NETWORK-ADAPTER]:
dhcp4: no
addresses:
- [YOUR-IP]/24
Example:
network:
version: 2
renderer: networkd
ethernets:
eth0:
dhcp4: no
addresses:
- 192.168.99.1/24
Apply the changes via
netplan apply
Verify connectivity via
ping 192.168.99.1
from the VM. You should get a response rather than a timeout.(Optional) Run a python server to verify you can access the VM from the host at
http://192.168.99.1:8000.
It may take a minute or so before the server is ready.
python3 -m http.server 8000
- You should now be able to install Entando using the static IP. If your Entando installation stalled during startup and was previously configured using the static IP, it should continue starting up as soon as the external address is functional again.
# Option 3: Reinstall Entando
We're including this option because it works and requires no additional configuration. If you plan to regularly work with Entando we recommend developing against a centralized and shared Kubernetes instance rather than running a full stack locally. If you need a cluster locally we recommend using option 1 or 2.
# JHipster
Q: How can I run JHipster on Windows?
A: JHipster requires a TTY interface for its menus to function correctly. Here are a few options to satisfy that requirement on Windows:
- Run
jhipster
under cmd or Powershell - Using Git Bash, run
winpty jhipster.cmd
- Use Ubuntu bash via WSL (1 or 2) or within the Multipass VM
# Multipass with VirtualBox
Multipass supports the use of VirtualBox on Windows as an alternative to using Hyper-V, say if you're using Windows Home. See the Multipass documentation on how to configure it to work with VirtualBox.
In order to get Entando working correctly with this setup you will need to add a port forwarding rule so you can access Entando from your host system.
Create your VM within Multipass.
Go to the Oracle VM VirtualBox Manager and edit the
Network
settings for the VM.Go to the
Advanced
options and clickPort Forwarding Rules
Add a new rule.
Name
: your choiceProtocol
: TCPHost IP
: leave this blankHost Port
: 80Guest IP
: leave this blankGuest Port
: 80- Click OK
At this point any requests to port 80 on your localhost should be forwarded to the VM.
You can now identify the IP of your host and use that to configure the
ENTANDO_DEFAULT_ROUTING_SUFFIX
in your yaml file, e.g.192.168.64.25.nip.io
. You should not use the non-routable address (e.g. 10.0.2.15) identified from within the guest VM itself, but rather use the IP of the host.