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

Commit 6798396

Browse files
authored
Fix ip routing because docker changed the default IP (#17)
* Fix IP routing * Use 65.2 instead * Cleanup old IPs * Cleanup old IP * Detect right IP
1 parent 851ebd3 commit 6798396

File tree

4 files changed

+19
-9
lines changed

4 files changed

+19
-9
lines changed

Makefile

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@ DEVICE := $(shell netstat -rn -f inet | grep -v "link\#" | grep ^default | tr '
77
endif
88

99
start:
10+
ifneq (, $(shell ifconfig | grep "192.168.65.1"))
11+
ifeq ($(UNAME), Linux)
12+
@echo "---- LINUX, CLEANING OLD IP ALIAS ----"
13+
sudo ifconfig $(DEVICE):tugboat 192.168.65.1 down || true
14+
else
15+
@echo "---- MAC, CLEANING OLD IP ALIAS ----"
16+
sudo ifconfig $(DEVICE) -alias 192.168.65.1 || true
17+
endif
18+
endif
1019
docker-compose stop
1120
docker-compose rm -f
1221
docker-compose pull
@@ -16,24 +25,25 @@ ifneq (, $(shell docker info | grep "provider=virtualbox"))
1625
TUGBOAT_IP=192.168.99.100 docker-compose up
1726
else
1827
@echo "---- YOU ARE RUNNING DOCKER FOR MAC/LINUX ----"
19-
ifneq (, $(shell ifconfig | grep "192.168.65.1"))
28+
ifneq (, $(shell ifconfig | grep "192.168.65.2"))
2029
@echo "---- IP FOUND ----"
2130
else
2231
ifeq ($(UNAME), Linux)
2332
@echo "---- LINUX, ADDING IP ALIAS ----"
24-
sudo ifconfig $(DEVICE):tugboat 192.168.65.1 up
33+
sudo ifconfig $(DEVICE):tugboat 192.168.65.2 up
2534
else
2635
@echo "---- MAC, ADDING IP ALIAS ----"
27-
sudo ifconfig $(DEVICE) alias 192.168.65.1 255.255.255.0
36+
sudo ifconfig $(DEVICE) alias 192.168.65.2 255.255.255.0
2837
endif
2938
endif
30-
TUGBOAT_IP=192.168.65.1 docker-compose up
39+
TUGBOAT_IP=192.168.65.2 docker-compose up
3140
endif
3241

3342
stop:
3443
docker-compose stop
44+
docker-compose rm -f
3545
ifeq ($(UNAME), Linux)
36-
sudo ifconfig $(DEVICE):tugboat 192.168.65.1 down
46+
sudo ifconfig $(DEVICE):tugboat 192.168.65.2 down || true
3747
else
38-
sudo ifconfig $(DEVICE) -alias 192.168.65.1
48+
sudo ifconfig $(DEVICE) -alias 192.168.65.2 || true
3949
endif

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ To use a custom configuration (enable SSL, custom SSL cert, custom domain) pleas
5353

5454
`cp docker-compose.override.example.yml docker-compose.override.yml` and then edit to your needs.
5555

56-
**Note:** If you use a custom domain, you need to also setup wildcard DNS to the IP `192.168.65.1`. So if you use the domain `tugboat.ninja`, you need to setup `*.tugboat.ninja` to point to `192.168.65.1`.
56+
**Note:** If you use a custom domain, you need to also setup wildcard DNS to the IP `192.168.65.2`. So if you use the domain `tugboat.ninja`, you need to setup `*.tugboat.ninja` to point to `192.168.65.2`.
5757

5858
We own and have wildcard DNS set up for the following domains:
5959

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.99.100} consul://consul:8500"
18+
command: "-ip ${TUGBOAT_IP:-192.168.65.2} consul://consul:8500"
1919
dns_search: ""
2020
volumes:
2121
- "/var/run/docker.sock:/tmp/docker.sock"

start.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
set TUGBOAT_IP=192.168.65.1
1+
set TUGBOAT_IP=192.168.65.2
22

33
docker-compose stop
44
docker-compose rm -f

0 commit comments

Comments
 (0)