mirror of
https://github.com/gravitl/netmaker.git
synced 2025-02-25 00:24:37 +08:00
runs, but need to remove resolvectl command
This commit is contained in:
parent
99c8c6b31d
commit
5d786740d7
4 changed files with 52 additions and 3 deletions
22
docker/Dockerfile-netclient-slim-solo
Normal file
22
docker/Dockerfile-netclient-slim-solo
Normal file
|
@ -0,0 +1,22 @@
|
|||
FROM gravitl/builder:latest as builder
|
||||
# add glib support daemon manager
|
||||
WORKDIR /app
|
||||
|
||||
COPY . .
|
||||
|
||||
ENV GO111MODULE=auto
|
||||
|
||||
RUN GOOS=linux GOARCH=amd64 CGO_ENABLED=0 /usr/local/go/bin/go build -ldflags="-w -s" -o netclient-app netclient/main.go
|
||||
|
||||
FROM alpine:3.13.6
|
||||
|
||||
RUN apk add gcompat iptables && mkdir -p /etc/netclient
|
||||
# set the working directory
|
||||
WORKDIR /root/
|
||||
|
||||
COPY --from=builder /app/netclient-app /etc/netclient/netclient
|
||||
COPY --from=builder /app/scripts/netclient.sh .
|
||||
|
||||
RUN chmod 0755 /etc/netclient/netclient && chmod 0755 netclient.sh
|
||||
|
||||
ENTRYPOINT ["./netclient.sh"]
|
|
@ -4,18 +4,33 @@ import (
|
|||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
|
||||
"path/filepath"
|
||||
"github.com/gravitl/netmaker/netclient/ncutils"
|
||||
)
|
||||
|
||||
const MAC_SERVICE_NAME = "com.gravitl.netclient"
|
||||
|
||||
func SetupMacDaemon() error {
|
||||
|
||||
dir, err := filepath.Abs(filepath.Dir(os.Args[0]))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
binarypath := dir + "/netclient"
|
||||
|
||||
if !ncutils.FileExists("/etc/netclient/netclient") {
|
||||
_, err = ncutils.Copy(binarypath, "/etc/netclient/netclient")
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
_, errN := os.Stat("~/Library/LaunchAgents")
|
||||
if os.IsNotExist(errN) {
|
||||
os.Mkdir("~/Library/LaunchAgents", 0755)
|
||||
}
|
||||
err := CreateMacService(MAC_SERVICE_NAME)
|
||||
err = CreateMacService(MAC_SERVICE_NAME)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ import (
|
|||
"os"
|
||||
"runtime"
|
||||
"strings"
|
||||
|
||||
nodepb "github.com/gravitl/netmaker/grpc"
|
||||
"github.com/gravitl/netmaker/models"
|
||||
"github.com/gravitl/netmaker/netclient/auth"
|
||||
|
|
13
scripts/netclient.sh
Executable file
13
scripts/netclient.sh
Executable file
|
@ -0,0 +1,13 @@
|
|||
#!/bin/sh
|
||||
echo "[netclient] joining network"
|
||||
|
||||
/etc/netclient/netclient join -t $NETCLIENT_ACCESSTOKEN -daemon off -dnson no
|
||||
|
||||
echo "[netclient] Starting netclient checkin"
|
||||
# loop and call checkin -n all
|
||||
while [ 1 ]; do
|
||||
# add logs to netclient.logs
|
||||
/etc/netclient/netclient checkin -n all
|
||||
sleep $SLEEP
|
||||
done
|
||||
echo "[netclient] exiting"
|
Loading…
Reference in a new issue