dsnezhkov / racketeer

MIT License
68 stars 22 forks source link

go run main.go generates errors #2

Closed wimdecorte closed 2 years ago

wimdecorte commented 2 years ago

checked out the code using gh, running "go run main.go"

ubuntu@ip-xxx-xxx-xxx-xxx:~/racketeer/server$ go run main.go main.go:6:2: package RNS/serve is not in GOROOT (/usr/local/go/src/RNS/serve) main.go:7:2: package RNS/types is not in GOROOT (/usr/local/go/src/RNS/types)

This is a plain vanilla Ubunti 18.04, nothing but Go on it (fresh instance for the purpose of testing - go1.17.1 linux/amd64).

VS Code also throws this error when inspecting the code, which seems to be related.

image

Folder structure (unmodified after checking out the code) of the server folder:

ubuntu@ip-172-31-57-127:~/racketeer/server$ tree . . ├── dist │ ├── gencert.sh │ ├── server.crt │ └── server.key ├── go.mod ├── keys │ ├── server.crt │ └── server.key ├── main.go ├── man │ └── masterkey.template └── src └── RNS ├── help │ ├── go.mod │ └── masterkey.go ├── routers │ ├── go.mod │ ├── go.sum │ └── router.go ├── serve │ ├── go.mod │ ├── go.sum │ ├── httpserver.go │ └── tuishell.go ├── surveys │ ├── clearlogs.go │ ├── execagent.go │ ├── getlogs.go │ ├── go.mod │ ├── go.sum │ ├── heartbeat.go │ ├── masterkey.go │ ├── polexec.go │ ├── setlogs.go │ ├── setlogsource.go │ └── summary.go ├── types │ ├── go.mod │ ├── help.go │ ├── model.go │ └── tui.go └── utils ├── go.mod └── util.go

dsnezhkov commented 2 years ago

Try this:

Dev/Build

Prerequisites:

  1. Clone the repo: got clone <this repo path>

  2. Navigate to the server component: cd racketeer/server

  3. Build the code: GO111MODULE=on go build -o bin/server.exe

wimdecorte commented 2 years ago

No joy. See two screenshots below. The instructions work and I've done the required "go gets" which led to a successful build but then an error on execution.

image

image

Even when run the executable as sudo

image

wimdecorte commented 2 years ago

and just to confirm that there is nothing else listening on port 3000 (shouldn't be since this is a clean AWS instance)

image

wimdecorte commented 2 years ago

and I'm a C# / JS guy with no experience whatsoever with Go, so don't feel bad about pointing out silly mistakes I'm making.

dsnezhkov commented 2 years ago

No worries. The documentation is not clear as to how SSL keys are found.

Run:

$ server -H 127.0.0.1 -P 3001 -s

This will start server on IP/Port with the TLS support. ** ports < 1024 on Ux need a sudo.

Please make sure that there is a keys folder right next to the server executable which contains the TLS cert and the server key named server.crt and server.key respectively . In the future there will be an option to point to correct directory with keys. Right now, it's a hardcoded assumption here

In the above example (launching server from ./bin ) place certificates in keys directory inside ./bin. Take a look at ./dist/gencert.sh key generation script to get self-signed certs, or extract from Letsencrypt/etc. for the host/domain.