diff --git a/.air.toml b/.air.toml index d9d02d6..7bb5528 100644 --- a/.air.toml +++ b/.air.toml @@ -5,7 +5,7 @@ tmp_dir = "tmp" [build] args_bin = [] bin = "./tmp/main" - cmd = "go build -o ./tmp/main ." + cmd = "go build -tags server -o ./tmp/main ." delay = 0 exclude_dir = ["assets", "tmp", "testdata", "frontend/node_modules", "data", "bin", "tools"] exclude_file = [] diff --git a/Makefile b/Makefile index 8f471b4..235b288 100644 --- a/Makefile +++ b/Makefile @@ -1,17 +1,19 @@ -.PHONY: deploy-prober deploy-server ui build linux-amd64 linux-arm64 +.PHONY: deploy-prober deploy-server ui client server build BINARY_NAME = xmr-nodes -build: ui linux-amd64 linux-arm64 +build: client server ui: go generate ./... -linux-amd64: - CGO_ENABLED=0 GOARCH=amd64 GOOS=linux go build -o bin/${BINARY_NAME}-static-linux-amd64 +client: + CGO_ENABLED=0 GOARCH=amd64 GOOS=linux go build -ldflags="-s -w" -o bin/${BINARY_NAME}-client-linux-amd64 + CGO_ENABLED=0 GOARCH=arm64 GOOS=linux go build -ldflags="-s -w" -o bin/${BINARY_NAME}-client-linux-arm64 -linux-arm64: - CGO_ENABLED=0 GOARCH=arm64 GOOS=linux go build -o bin/${BINARY_NAME}-static-linux-arm64 +server: ui + CGO_ENABLED=0 GOARCH=amd64 GOOS=linux go build -ldflags="-s -w" -tags server -o bin/${BINARY_NAME}-server-linux-amd64 + CGO_ENABLED=0 GOARCH=arm64 GOOS=linux go build -ldflags="-s -w" -tags server -o bin/${BINARY_NAME}-server-linux-arm64 clean: go clean diff --git a/README.md b/README.md index 9795b6e..9884247 100644 --- a/README.md +++ b/README.md @@ -21,9 +21,9 @@ Source code of [https://xmr.ditatompel.com](https://xmr.ditatompel.com), a websi 1. Download [GeoIP Database](https://dev.maxmind.com/geoip/geoip2/geolite2/) and place it to `./assets/geoip`. (see [./internal/repo/geoip.go](./internal/repo/geoip.go)). 2. Copy `.env.example` to `.env` and edit it to match with server environment. 3. Build the binary with `make build`. -4. Run the service with `./bin/xmr-nodes-static-linux- serve`. +4. Run the service with `./bin/xmr-nodes-server-linux- serve`. -To create admin user (for creating prober API key from Web-UI, execute `./bin/xmr-nodes-static-linux- admin create`). +To create admin user (for creating prober API key from Web-UI, execute `./bin/xmr-nodes-server-linux- admin create`). Systemd example: [./tools/resources/init/xmr-nodes-server.service](./tools/resources/init/xmr-nodes-server.service). @@ -32,7 +32,7 @@ Systemd example: [./tools/resources/init/xmr-nodes-server.service](./tools/resou 1. Create API key for prober 2. Copy `.env.example` to `.env` and edit it to match with prober environment. 3. Build the binary with `make build`. -4. Run the service with `./bin/xmr-nodes-static-linux- prober`. +4. Run the service with `./bin/xmr-nodes-client-linux- probe`. Systemd example: [xmr-nodes-prober.service](./tools/resources/init/xmr-nodes-prober.service) and [xmr-nodes-prober.timer](./tools/resources/init/xmr-nodes-prober.timer).