Skip to content

Commit 6227f00

Browse files
authored
Merge pull request #212 from gravitl/v0.7.1
V0.7.1
2 parents 304698c + ec23953 commit 6227f00

File tree

173 files changed

+11404
-10898
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

173 files changed

+11404
-10898
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
netmaker
22
netclient/netclient
33
netclient/files/netclient
4+
config/dnsconfig/

Dockerfile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ WORKDIR /app
88

99
ENV GO111MODULE=auto
1010

11-
RUN CGO_ENABLED=0 GOOS=linux go build -o app main.go
11+
RUN GOARCH=amd64 CGO_ENABLED=0 GOOS=linux go build -ldflags="-w -s" -o app main.go
1212

1313
WORKDIR /app/netclient
1414

1515
ENV GO111MODULE=auto
1616

17-
RUN CGO_ENABLED=0 GOOS=linux go build -o netclient main.go
17+
RUN GOARCH=amd64 CGO_ENABLED=0 GOOS=linux go build -ldflags="-w -s" -o netclient main.go
1818

1919
#second stage
2020

@@ -34,4 +34,3 @@ EXPOSE 8081
3434
EXPOSE 50051
3535

3636
CMD ["./app"]
37-

Dockerfile-netclient

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#first stage - builder
2+
3+
FROM golang:latest as builder
4+
5+
COPY . /app
6+
7+
WORKDIR /app/netclient
8+
9+
ENV GO111MODULE=auto
10+
11+
RUN CGO_ENABLED=0 GOOS=linux go build -o netclient main.go
12+
13+
#second stage
14+
15+
FROM debian:latest
16+
17+
RUN apt-get update && apt-get -y install systemd procps
18+
19+
WORKDIR /root/
20+
21+
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
22+
23+
COPY --from=builder /app/netclient/netclient .
24+
25+
CMD ["./netclient"]
26+

compose/docker-compose.coredns.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
version: "3.4"
2+
3+
services:
4+
coredns:
5+
image: coredns/coredns
6+
command: -conf /root/dnsconfig/Corefile
7+
container_name: coredns
8+
restart: always
9+
ports:
10+
- "53:53/udp"
11+
volumes:
12+
- /root/netmaker/config/dnsconfig:/root/dnsconfig

compose/docker-compose.nodns.yml

Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,56 @@
11
version: "3.4"
22

3-
volumes:
4-
dnsconfig:
5-
driver: local
63
services:
7-
mongodb:
8-
image: mongo:4.2
9-
ports:
10-
- "27017:27017"
11-
container_name: mongodb
12-
volumes:
13-
- mongovol:/data/db
4+
rqlite:
5+
container_name: rqlite
6+
image: rqlite/rqlite
7+
network_mode: host
148
restart: always
15-
environment:
16-
MONGO_INITDB_ROOT_USERNAME: mongoadmin
17-
MONGO_INITDB_ROOT_PASSWORD: mongopass
9+
volumes:
10+
- sqldata:/rqlite/file/data
1811
netmaker:
12+
depends_on:
13+
- rqlite
1914
privileged: true
2015
container_name: netmaker
21-
depends_on:
22-
- mongodb
23-
image: gravitl/netmaker:v0.5
16+
image: gravitl/netmaker:v0.7
2417
volumes:
2518
- ./:/local
2619
- /etc/netclient:/etc/netclient
27-
- dnsconfig:/root/config/dnsconfig
28-
- /usr/bin/wg:/usr/bin/wg:ro
20+
- /usr/bin/wg:/usr/bin/wg
2921
- /var/run/dbus/system_bus_socket:/var/run/dbus/system_bus_socket
3022
- /run/systemd/system:/run/systemd/system
3123
- /etc/systemd/system:/etc/systemd/system
3224
- /sys/fs/cgroup:/sys/fs/cgroup
33-
cap_add:
25+
cap_add:
3426
- NET_ADMIN
3527
- SYS_MODULE
3628
restart: always
3729
network_mode: host
3830
environment:
31+
SERVER_HOST: "SERVER_PUBLIC_IP"
3932
DNS_MODE: "off"
33+
SERVER_API_CONN_STRING: "api.NETMAKER_BASE_DOMAIN:443"
34+
SERVER_GRPC_CONN_STRING: "grpc.NETMAKER_BASE_DOMAIN:443"
35+
GRPC_SSL: "on"
36+
SERVER_HTTP_HOST: "api.NETMAKER_BASE_DOMAIN"
37+
SERVER_GRPC_HOST: "grpc.NETMAKER_BASE_DOMAIN"
38+
API_PORT: "8081"
39+
GRPC_PORT: "50051"
40+
CLIENT_MODE: "on"
41+
MASTER_KEY: "REPLACE_MASTER_KEY"
42+
SERVER_GRPC_WIREGUARD: "off"
43+
CORS_ALLOWED_ORIGIN: "*"
4044
netmaker-ui:
4145
container_name: netmaker-ui
4246
depends_on:
4347
- netmaker
44-
image: gravitl/netmaker-ui:v0.5
48+
image: gravitl/netmaker-ui:v0.7
4549
links:
4650
- "netmaker:api"
4751
ports:
48-
- "80:80"
52+
- "8082:80"
4953
environment:
50-
BACKEND_URL: "http://HOST_IP:8081"
54+
BACKEND_URL: "https://api.NETMAKER_BASE_DOMAIN"
5155
volumes:
52-
mongovol: {}
53-
dnsconfig: {}
56+
sqldata: {}
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
version: "3.4"
2+
3+
services:
4+
rqlite:
5+
container_name: rqlite
6+
image: rqlite/rqlite
7+
network_mode: host
8+
restart: always
9+
volumes:
10+
- sqldata:/rqlite/file/data
11+
netmaker:
12+
depends_on:
13+
- rqlite
14+
privileged: true
15+
container_name: netmaker
16+
image: gravitl/netmaker:v0.7
17+
volumes:
18+
- ./:/local
19+
- /etc/netclient:/etc/netclient
20+
- dnsconfig:/root/config/dnsconfig
21+
- /usr/bin/wg:/usr/bin/wg
22+
- /var/run/dbus/system_bus_socket:/var/run/dbus/system_bus_socket
23+
- /run/systemd/system:/run/systemd/system
24+
- /etc/systemd/system:/etc/systemd/system
25+
- /sys/fs/cgroup:/sys/fs/cgroup
26+
cap_add:
27+
- NET_ADMIN
28+
- SYS_MODULE
29+
restart: always
30+
network_mode: host
31+
environment:
32+
SERVER_HOST: "SERVER_PUBLIC_IP"
33+
SERVER_API_CONN_STRING: "api.NETMAKER_BASE_DOMAIN:443"
34+
SERVER_GRPC_CONN_STRING: "grpc.NETMAKER_BASE_DOMAIN:1443"
35+
COREDNS_ADDR: "SERVER_PUBLIC_IP"
36+
GRPC_SSL: "on"
37+
DNS_MODE: "on"
38+
SERVER_HTTP_HOST: "api.NETMAKER_BASE_DOMAIN"
39+
SERVER_GRPC_HOST: "grpc.NETMAKER_BASE_DOMAIN"
40+
API_PORT: "8081"
41+
GRPC_PORT: "50051"
42+
CLIENT_MODE: "on"
43+
MASTER_KEY: "REPLACE_MASTER_KEY"
44+
SERVER_GRPC_WIREGUARD: "off"
45+
CORS_ALLOWED_ORIGIN: "*"
46+
netmaker-ui:
47+
container_name: netmaker-ui
48+
depends_on:
49+
- netmaker
50+
image: gravitl/netmaker-ui:v0.7
51+
links:
52+
- "netmaker:api"
53+
ports:
54+
- "8082:80"
55+
environment:
56+
BACKEND_URL: "https://api.NETMAKER_BASE_DOMAIN"
57+
coredns:
58+
depends_on:
59+
- netmaker
60+
image: coredns/coredns
61+
command: -conf /root/dnsconfig/Corefile
62+
container_name: coredns
63+
restart: always
64+
ports:
65+
- "53:53/udp"
66+
volumes:
67+
- dnsconfig:/root/dnsconfig
68+
volumes:
69+
sqldata: {}
70+
dnsconfig: {}
Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
services:
2+
rqlite:
3+
container_name: rqlite
4+
image: rqlite/rqlite
5+
network_mode: host
6+
restart: always
7+
volumes:
8+
- sqldata:/rqlite/file/data
9+
netmaker:
10+
depends_on:
11+
- rqlite
12+
privileged: true
13+
container_name: netmaker
14+
image: gravitl/netmaker:v0.7
15+
volumes:
16+
- ./:/local
17+
- /etc/netclient:/etc/netclient
18+
- dnsconfig:/root/config/dnsconfig
19+
- /usr/bin/wg:/usr/bin/wg
20+
- /var/run/dbus/system_bus_socket:/var/run/dbus/system_bus_socket
21+
- /run/systemd/system:/run/systemd/system
22+
- /etc/systemd/system:/etc/systemd/system
23+
- /sys/fs/cgroup:/sys/fs/cgroup
24+
cap_add:
25+
- NET_ADMIN
26+
- SYS_MODULE
27+
restart: always
28+
network_mode: host
29+
environment:
30+
SERVER_HOST: "SERVER_PUBLIC_IP"
31+
SERVER_API_CONN_STRING: "api.NETMAKER_BASE_DOMAIN:443"
32+
SERVER_GRPC_CONN_STRING: "grpc.NETMAKER_BASE_DOMAIN:443"
33+
COREDNS_ADDR: "SERVER_PUBLIC_IP"
34+
GRPC_SSL: "on"
35+
SERVER_HTTP_HOST: "api.NETMAKER_BASE_DOMAIN"
36+
SERVER_GRPC_HOST: "grpc.NETMAKER_BASE_DOMAIN"
37+
API_PORT: "8081"
38+
GRPC_PORT: "50051"
39+
CLIENT_MODE: "on"
40+
MASTER_KEY: "REPLACE_MASTER_KEY"
41+
SERVER_GRPC_WIREGUARD: "off"
42+
CORS_ALLOWED_ORIGIN: "*"
43+
netmaker-ui:
44+
container_name: netmaker-ui
45+
depends_on:
46+
- netmaker
47+
image: gravitl/netmaker-ui:v0.7
48+
links:
49+
- "netmaker:api"
50+
ports:
51+
- "8082:80"
52+
environment:
53+
BACKEND_URL: "https://api.NETMAKER_BASE_DOMAIN"
54+
coredns:
55+
depends_on:
56+
- netmaker
57+
image: coredns/coredns
58+
command: -conf /root/dnsconfig/Corefile
59+
container_name: coredns
60+
restart: always
61+
ports:
62+
- "53:53/udp"
63+
volumes:
64+
- dnsconfig:/root/dnsconfig
65+
66+
67+
version: "3.4"
68+
69+
services:
70+
rqlite: # The rqlite instance that backs up Netmaker
71+
container_name: rqlite
72+
image: rqlite/rqlite
73+
network_mode: host
74+
restart: always
75+
volumes:
76+
- sqldata:/rqlite/file/data
77+
netmaker: # The Primary Server for running Netmaker
78+
privileged: true # Necessary to run sudo/root level commands on host system. Take out if not running with CLIENT_MODE=on
79+
container_name: netmaker
80+
depends_on:
81+
- mongodb
82+
image: gravitl/netmaker:v0.7
83+
volumes: # Volume mounts necessary for Netmaker to control netclient, wireguard, and networking on host (except dnsconfig, which is where dns config files are stored for use by CoreDNS)
84+
- ./:/local
85+
- /etc/netclient:/etc/netclient
86+
- dnsconfig:/root/config/dnsconfig # Netmaker writes Corefile to this location, which gets mounted by CoreDNS for DNS configuration.
87+
- /usr/bin/wg:/usr/bin/wg
88+
- /var/run/dbus/system_bus_socket:/var/run/dbus/system_bus_socket
89+
- /run/systemd/system:/run/systemd/system
90+
- /etc/systemd/system:/etc/systemd/system
91+
- /sys/fs/cgroup:/sys/fs/cgroup
92+
cap_add: # Necessary for CLIENT_MODE. Should be removed if turned off.
93+
- NET_ADMIN
94+
- SYS_MODULE
95+
restart: always
96+
network_mode: host # Necessary for CLIENT_MODE. Should be removed if turned off, but then need to add port mappings
97+
environment:
98+
GRPC_SSL: "off" # Tells clients to use SSL to connect to GRPC. Switch to on to turn on.
99+
SERVER_API_CONN_STRING: "" # Changes the api connection string. IP:PORT format. By default is empty and uses SERVER_HOST:API_PORT
100+
SERVER_GRPC_CONN_STRING: "" # Changes the grpc connection string. IP:PORT format. By default is empty and uses SERVER_HOST:GRPC_PORT
101+
SERVER_HOST: "" # All the Docker Compose files pre-populate this with HOST_IP, which you replace as part of the install instructions. This will set both HTTP and GRPC host.
102+
API_PORT: 8081 # The HTTP API port for Netmaker. Used for API calls / communication from front end. If changed, need to change port of BACKEND_URL for netmaker-ui.
103+
GRPC_PORT: 50051 # The GRPC port for Netmaker. Used for communications from nodes.
104+
MASTER_KEY: "secretkey" # The admin master key for accessing the API. Change this in any production installation.
105+
CORS_ALLOWED_ORIGIN: "*" # The "allowed origin" for API requests. Change to restrict where API requests can come from.
106+
REST_BACKEND: "on" # Enables the REST backend (API running on API_PORT at SERVER_HTTP_HOST). Change to "off" to turn off.
107+
AGENT_BACKEND: "on" # Enables the AGENT backend (GRPC running on GRPC_PORT at SERVER_GRPC_HOST). Change to "off" to turn off.
108+
DNS_MODE: "on" # Enables DNS Mode, meaning config files will be generated for CoreDNS. Note, turning "off" does not remove CoreDNS. You still need to remove CoreDNS from compose file.
109+
netmaker-ui: # The Netmaker UI Component
110+
container_name: netmaker-ui
111+
depends_on:
112+
- netmaker
113+
image: gravitl/netmaker-ui:v0.7
114+
links:
115+
- "netmaker:api"
116+
ports:
117+
- "8082:80"
118+
environment:
119+
BACKEND_URL: "http://HOST_IP:8081" # URL where UI will send API requests. Change based on SERVER_HOST, SERVER_HTTP_HOST, and API_PORT
120+
coredns: # The DNS Server. Remove this section if DNS_MODE="off"
121+
depends_on:
122+
- netmaker
123+
image: coredns/coredns
124+
command: -conf /root/dnsconfig/Corefile # Config location for Corefile. This is the path of file which is also mounted to Netmaker for modification.
125+
container_name: coredns
126+
restart: always
127+
ports:
128+
- "53:53/udp" # Likely needs to run at port 53 for adequate nameserver usage.
129+
volumes:
130+
- dnsconfig:/root/dnsconfig
131+
volumes:
132+
sqldata: {}
133+
dnsconfig: {}

0 commit comments

Comments
 (0)