**IP range migration**
TLDR; Core releases 0.2.85 and 0.2.30 will have a breaking change: docker containers will be connected to a docker network with different IP range. Both releases must ensure a network configuration.
- Core release <= 0.2.85:
- docker containers will be connected to docker network `dncore_network` with subnet `172.33.0.0/16`
- Legacy `dns` resolver `172.33.1.2` might still be used by docker containers in runtime (it has been removed from the compose files in .84 core release), ensure every running docker container with legacy `dns` is recreated to remove this configuration.
- The core packages with hardcoded IPs from subnet `172.33.0.0/16` that must persist their hardcoded IP are: dappmanager `172.33.1.7` and bind `172.33.1.2`. There might be other core packages with hardcoded IPs.
- Core release >= 0.2.30
- docker containers will be connected to docker network `dncore_network` with subnet `10.20.0.0/24`
- docker containers must no longer use the legacy `dns` resolver `172.33.1.2` since BIND v2 will be under other subnet and we want to relay on native docker dns instead of BIND for docker container naming resolution. This requirement must be ensured either in runtime and in `docker-compose.yml` files to ensure resilience.
- Core packages with hardcoded IPs are: dappmanager `10.20.0.7` and bind `10.20.0.2`. These IPs must be reserver to these containers. Furthermore, make sure that rest of core containers `docker-compose.yml` files has removed their hardcoded IP from the legacy subnet, otherwise there might be issues on startup.
**Network configuration**
The network configuration that will change from .85 to .30 core release is the following:
```ts
// Docker network parameters
DOCKER_NETWORK_SUBNET: "172.33.0.0/16", // "10.20.0.0/24";
DOCKER_LEGACY_DNS: "172.33.1.2",
BIND_IP: "172.33.1.2", // "10.20.0.2"
DAPPMANAGER_IP: "172.33.1.7", // "10.20.0.7";
```
Changing this config from one release to another will trigger the required migrations to ensure the network configuration required. See https://github.com/dappnode/DNP_DAPPMANAGER/blob/9a06c7aa03a5b5b4672834780ccee5cdb37036fb/packages/params/src/params.ts#L113
**Test**
- [ ] Docker network subnet
```bash=
docker network inspect dncore_network | jq -r '.[].IPAM.Config[].Subnet'
```
- [ ] Before `172.33.0.0/16`
- [ ] After `10.20.0.0/24`
- [ ] Dappmanager and Bind container IPs on runtime
```bash=
docker inspect DAppNodeCore-dappmanager.dnp.dappnode.eth | jq -r '.[].NetworkSettings.Networks[].IPAddress'
docker inspect DAppNodeCore-bind.dnp.dappnode.eth | jq -r '.[].NetworkSettings.Networks[].IPAddress'
```
- [ ] Before
- [ ] Dappmanager `172.33.1.7`
- [ ] Bind `172.33.1.2`
- [ ] After
- [ ] Dappmanager `10.20.0.7`
- [ ] Bind `10.20.0.2`
- [ ] Bind container IP on `docker-compose.yml` files:
```bash
cat /usr/src/dappnode/DNCORE/docker-compose-bind.yml | grep -oE '\b([0-9]{1,3}\.){3}[0-9]{1,3}\b'
```
- [ ] Before
- [ ] Bind `172.33.1.2`
- [ ] After
- [ ] Bind `10.20.0.2`
- [ ] Other core packages hardcoded IPs on `docker-compose.yml` (in the path `/usr/src/dappnode/DNCORE/*.yml`) files. Only the bind should have its IP hardcoded:
```bash=
cat /usr/src/dappnode/DNCORE/*.yml | grep ipv4_address
```
- [ ] Before: could have hardcoded IPs
- [ ] After: should no longer have hardcoded IPs
- [ ] Aliases of dappmanager container:
```bash=
docker inspect DAppNodeCore-dappmanager.dnp.dappnode.eth | jq '.[].NetworkSettings.Networks | to_entries[] | {network: .key, aliases: .value.Aliases}'
```
- [ ] Before AND after:
The output should look something like
```json
{
"network": "dncore_network",
"aliases": [
"3df965021d1b",
"dappmanager.dnp.dappnode.eth.dappmanager.dappnode",
"my.dappnode",
"dappmanager.dappnode",
"dappnode.local"
]
}
```
- [ ] The`dns` from running containers.Some of them should have the legacy `172.33.1.2`
```bash=
docker ps -q | xargs -I {} docker inspect {} | jq '.[].HostConfig.Dns' | sort | uniq
```
- [ ] Before: Some of them can have the legacy `172.33.1.2`
- [ ] After: none of them should have the dns
- [ ] Dappnode access:
- [ ] Before AND after you should be able to access your dappnode through Wireguard AND wifi (TODO: AND Openvpn)
- [ ] Logs: check dappmanager container logs after update
- [ ] Success Migration logs
```bash=
INFO editing service dappmanager.dnp.dappnode.eth ip from 172.33.1.7 to 10.20.0.7
INFO editing service bind.dnp.dappnode.eth ip from 172.33.1.2 to 10.20.0.2
INFO docker network dncore_network exists
INFO docker network dncore_network has invalid subnet 10.20.0.0/24, migrating
INFO disconnecting all containers from dncore_network
INFO removing docker network dncore_network
INFO creating docker networtk dncore_network with valid ip range
INFO connecting dappnode containers to docker network dncore_network
```
- [ ] `dncore_network` not exist. This test must be done AFTER removing the `dncore_network`: **TODO**
- [ ] Disconnect every docker container from the `dncore_network`
- [ ] Remove the `dncore_network`
- [ ] Wait for the host service `check-docker-network.service` to recreate the network and start the containers.
- [ ] Dappmanager should have handle all the configuration on its own
**Hashes**
- IPFS peer http://my.dappnode/system/add-ipfs-peer/%2Fdns4%2F6269a4afa505dee6.dyndns.dappnode.io%2Ftcp%2F4001%2Fipfs%2F12D3KooWJPt4kGrEKa5qMKLgf4SNzfiTKxXQQKEYbB49chhaGqJF
1. Install Core to migrate to public ip range (+ new bind, + new wifi, + new ipfs): `/ipfs/QmfLmGpEAj8Ls5zWsxaSG9CsNFVWsfuJmekVLcxMSgXsXQ` TEST "BEFORE"
2. Install Core to migrate to private ip range (+ new bind): `/ipfs/Qmcyo6ro681URJm4oaieE99hj6noWDoSRCmcQcXThZvP8N` TEST "AFTER"