Browse Source

rejoin using updatenode vice createnode

Matthew R. Kasun 2 years ago
parent
commit
bf2d4ccf1e
2 changed files with 4 additions and 6 deletions
  1. 3 5
      Dockerfile
  2. 1 1
      controllers/node.go

+ 3 - 5
Dockerfile

@@ -4,12 +4,10 @@ ARG version
 ARG tags 
 WORKDIR /app
 COPY . .
-# RUN mkdir -p /Users/abhishekk/go/src/github.com/gravitl
-# ADD ../netclient /Users/abhishekk/go/src/github.com/gravitl
 ENV GO111MODULE=auto
 
-# RUN apk add git
-# RUN GOOS=linux CGO_ENABLED=1 go build ${tags} -ldflags="-s -X 'main.version=${version}'" .
+RUN apk add git
+RUN GOOS=linux CGO_ENABLED=1 go build ${tags} -ldflags="-s -X 'main.version=${version}'" .
 # RUN go build -tags=ee . -o netmaker main.go
 FROM alpine:3.16.2
 
@@ -18,7 +16,7 @@ RUN apk add gcompat iptables wireguard-tools
 # set the working directory
 WORKDIR /root/
 RUN mkdir -p /etc/netclient/config
-COPY --from=builder /app/bin/netmaker .
+COPY --from=builder /app/netmaker .
 COPY --from=builder /app/config config
 EXPOSE 8081
 ENTRYPOINT ["./netmaker"]

+ 1 - 1
controllers/node.go

@@ -34,7 +34,7 @@ func nodeHandlers(r *mux.Router) {
 	r.HandleFunc("/api/nodes/{network}/{nodeid}/createingress", logic.SecurityCheck(false, http.HandlerFunc(createIngressGateway))).Methods("POST")
 	r.HandleFunc("/api/nodes/{network}/{nodeid}/deleteingress", logic.SecurityCheck(false, http.HandlerFunc(deleteIngressGateway))).Methods("DELETE")
 	r.HandleFunc("/api/nodes/{network}/{nodeid}/approve", authorize(false, true, "user", http.HandlerFunc(uncordonNode))).Methods("POST")
-	r.HandleFunc("/api/nodes/{network}/{nodeid}", authorize(true, true, "node", http.HandlerFunc(createNode))).Methods("POST")
+	r.HandleFunc("/api/nodes/{network}/{nodeid}", authorize(true, true, "node", http.HandlerFunc(updateNode))).Methods("POST")
 	r.HandleFunc("/api/nodes/{network}", nodeauth(checkFreeTierLimits(node_l, http.HandlerFunc(createNode)))).Methods("POST")
 	r.HandleFunc("/api/nodes/adm/{network}/authenticate", authenticate).Methods("POST")
 }