Skip to content
This repository was archived by the owner on Jul 9, 2021. It is now read-only.

Commit b9b14c9

Browse files
authored
Move to completely new IP subnet (#19)
* New subnet * Setx * Run in correct shell, use set * No new window, use setx too * Set env properly * always elavate * Avoid logging errors for missing switch/ipaddress, add progress logging, etc. * README section on windows networking no longer needed
1 parent fffe608 commit b9b14c9

File tree

7 files changed

+47
-19
lines changed

7 files changed

+47
-19
lines changed

Makefile

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,15 @@ else
1515
@echo "---- MAC, CLEANING OLD IP ALIAS ----"
1616
sudo ifconfig $(DEVICE) -alias 192.168.65.1 || true
1717
endif
18+
endif
19+
ifneq (, $(shell ifconfig | grep "192.168.65.2"))
20+
ifeq ($(UNAME), Linux)
21+
@echo "---- LINUX, CLEANING OLD IP ALIAS ----"
22+
sudo ifconfig $(DEVICE):tugboat 192.168.65.2 down || true
23+
else
24+
@echo "---- MAC, CLEANING OLD IP ALIAS ----"
25+
sudo ifconfig $(DEVICE) -alias 192.168.65.2 || true
26+
endif
1827
endif
1928
docker-compose stop
2029
docker-compose rm -f
@@ -25,25 +34,25 @@ ifneq (, $(shell docker info | grep "provider=virtualbox"))
2534
TUGBOAT_IP=192.168.99.100 docker-compose up
2635
else
2736
@echo "---- YOU ARE RUNNING DOCKER FOR MAC/LINUX ----"
28-
ifneq (, $(shell ifconfig | grep "192.168.65.2"))
37+
ifneq (, $(shell ifconfig | grep "10.156.156.1"))
2938
@echo "---- IP FOUND ----"
3039
else
3140
ifeq ($(UNAME), Linux)
3241
@echo "---- LINUX, ADDING IP ALIAS ----"
33-
sudo ifconfig $(DEVICE):tugboat 192.168.65.2 up
42+
sudo ifconfig $(DEVICE):tugboat 10.156.156.1 up
3443
else
3544
@echo "---- MAC, ADDING IP ALIAS ----"
36-
sudo ifconfig $(DEVICE) alias 192.168.65.2 255.255.255.0
45+
sudo ifconfig $(DEVICE) alias 10.156.156.1 255.255.255.0
3746
endif
3847
endif
39-
TUGBOAT_IP=192.168.65.2 docker-compose up
48+
TUGBOAT_IP=10.156.156.1 docker-compose up
4049
endif
4150

4251
stop:
4352
docker-compose stop
4453
docker-compose rm -f
4554
ifeq ($(UNAME), Linux)
46-
sudo ifconfig $(DEVICE):tugboat 192.168.65.2 down || true
55+
sudo ifconfig $(DEVICE):tugboat 10.156.156.1 down || true
4756
else
48-
sudo ifconfig $(DEVICE) -alias 192.168.65.2 || true
57+
sudo ifconfig $(DEVICE) -alias 10.156.156.1 || true
4958
endif

README.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,6 @@ Now run `docker-compose up` on your project.
3535

3636
Then simply go to `http://awesome-service.tugboat.zone/` (docker toolbox) or `http://awesome-service.native.tugboat.zone` (docker native) in your browser (because we set the name to be `awesome-service`)
3737

38-
## Docker for Windows
39-
40-
Docker for Windows needs to have its network subnet set to a very specific subnet. Right-click on the docker icon in your system tray, once in settings, edit the Network settings to look like:
41-
42-
![](/windows-network.png)
43-
4438
## SSL Support
4539

4640
This project by default provides SSL support using a self-signed SSL cert for `*.tugboat.zone`

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ services:
1515

1616
registrator:
1717
image: gliderlabs/registrator:latest
18-
command: "-ip ${TUGBOAT_IP:-192.168.65.2} consul://consul:8500"
18+
command: "-ip ${TUGBOAT_IP:-10.156.156.1} consul://consul:8500"
1919
dns_search: ""
2020
volumes:
2121
- "/var/run/docker.sock:/tmp/docker.sock"

start.bat

Lines changed: 0 additions & 6 deletions
This file was deleted.

start.ps1

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
$scriptDir = Split-Path $MyInvocation.MyCommand.Path -Parent
2+
3+
$arguments = "& '" + $scriptDir + "/windows-networking.ps1'"
4+
$p = Start-Process powershell -Verb runas -ArgumentList $arguments -Wait
5+
$p.HasExited
6+
$p.ExitCode
7+
8+
Set-Item Env:TUGBOAT_IP "10.156.156.1"
9+
10+
docker-compose stop
11+
docker-compose rm -f
12+
docker-compose build
13+
docker-compose up

windows-network.png

-49.8 KB
Binary file not shown.

windows-networking.ps1

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
Import-Module Hyper-V
2+
3+
Write-Host Checking tugboat Hyper-V VMSwitch configuration...
4+
5+
if ((Get-VMSwitch -Name Tugboat -ErrorAction SilentlyContinue).Name -eq $null) {
6+
Write-Host No tugboat Hyper-V VMSwitch present. Creating one now...
7+
New-VMSwitch -Name Tugboat -SwitchType Internal -Notes 'Added by tugboat to route your docker containers' | Out-Null
8+
Write-Host SUCCESS!
9+
}
10+
11+
if ((Get-NetIPAddress -IPAddress 10.156.156.1 -ErrorAction SilentlyContinue).InterfaceAlias -eq $null) {
12+
Write-Host Tugboat IP address not configured. Configuring now...
13+
$ifIndex = $(Get-NetAdapter | Where-Object { $_.Name -eq "vEthernet (Tugboat)" } ).ifIndex
14+
New-NetIPAddress -InterfaceIndex $ifIndex -IPAddress 10.156.156.1 -PrefixLength 24 | Out-Null
15+
Write-Host SUCCESS!
16+
}
17+
18+
Write-Host Tugboat Hyper-V VMSwitch configured!

0 commit comments

Comments
 (0)