mirror of
https://github.com/ditatompel/xmr-remote-nodes.git
synced 2025-01-03 09:29:35 +00:00
Build server tags in Makefile & air
config #3
The build system is changed, now it build 2 different binary by using go `-tags`. The local output binary also changed based on build tags.
This commit is contained in:
parent
7dea8380b8
commit
279b142e76
3 changed files with 12 additions and 10 deletions
|
@ -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 = []
|
||||
|
|
14
Makefile
14
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
|
||||
|
|
|
@ -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-<YOUR_CPU_ARCH> serve`.
|
||||
4. Run the service with `./bin/xmr-nodes-server-linux-<YOUR_CPU_ARCH> serve`.
|
||||
|
||||
To create admin user (for creating prober API key from Web-UI, execute `./bin/xmr-nodes-static-linux-<YOUR_CPU_ARCH> admin create`).
|
||||
To create admin user (for creating prober API key from Web-UI, execute `./bin/xmr-nodes-server-linux-<YOUR_CPU_ARCH> 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-<YOUR_CPU_ARCH> prober`.
|
||||
4. Run the service with `./bin/xmr-nodes-client-linux-<YOUR_CPU_ARCH> 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).
|
||||
|
||||
|
|
Loading…
Reference in a new issue