From 85ed597711a6bfb50b7941cc38e2376652951367 Mon Sep 17 00:00:00 2001 From: IndigoFox Date: Thu, 12 Oct 2023 16:14:05 -0700 Subject: [PATCH] fixes for prod --- .gitignore | 3 ++- .hemtt/project.toml | 1 + README.md | 21 ++++++++++++++++----- addons/capture/$PBOPREFIX$ | 2 +- addons/capture/fnc_entity_count.sqf | 4 +++- addons/capture/fnc_player_performance.sqf | 4 +++- addons/main/$PBOPREFIX$ | 2 +- addons/main/config.cpp | 6 +++++- extension/IFXMetrics/cmd/main.go | 3 +++ influxdb/docker-compose.yaml | 20 ++++++++++++++++++++ 10 files changed, 55 insertions(+), 11 deletions(-) create mode 100644 influxdb/docker-compose.yaml diff --git a/.gitignore b/.gitignore index 1dee516..df3975a 100644 --- a/.gitignore +++ b/.gitignore @@ -8,5 +8,6 @@ ifxmetrics.config.json .hemttout -influxdb +influxdb/data +influxdb/config releases \ No newline at end of file diff --git a/.hemtt/project.toml b/.hemtt/project.toml index eddf244..695b9dc 100644 --- a/.hemtt/project.toml +++ b/.hemtt/project.toml @@ -10,6 +10,7 @@ git_hash=6 # Default: 8 [files] include=[ "ifxmetrics.config.example.json", + "ifxmetrics.config.json", # used for copying during debugging "LICENSE", "README.md", "mod.cpp", diff --git a/README.md b/README.md index 71e7366..46c4540 100644 --- a/README.md +++ b/README.md @@ -179,13 +179,19 @@ Run this from the project root. docker pull x1unix/go-mingw:1.20 # Compile x64 Windows DLL -docker run --rm -it -v ${PWD}:/go/work -w /go/work -e GOARCH=amd64 -e CGO_ENABLED=1 x1unix/go-mingw:1.20 go build -o ./ifxmetrics_x64.dll -buildmode=c-shared -ldflags "-w -s -X main.EXTENSION_VERSION=`"$IFXMETRICS_BUILD_VER`"" ./extension/IFXMetrics/cmd +docker run --rm -it -v ${PWD}/extension/IFXMetrics:/go/work -w /go/work -e GOARCH=amd64 -e CGO_ENABLED=1 x1unix/go-mingw:1.20 go build -o ./dist/ifxmetrics_x64.dll -buildmode=c-shared -ldflags "-w -s -X main.EXTENSION_VERSION=$IFXMETRICS_BUILD_VER" ./cmd + +Move-Item -Path ./extension/IFXMetrics/dist/ifxmetrics_x64.dll -Destination ./ifxmetrics_x64.dll -Force # Compile x86 Windows DLL -docker run --rm -it -v ${PWD}:/go/work -w /go/work -e GOARCH=386 -e CGO_ENABLED=1 x1unix/go-mingw:1.20 go build -o ./ifxmetrics.dll -buildmode=c-shared -ldflags "-w -s -X main.EXTENSION_VERSION=`"$IFXMETRICS_BUILD_VER`"" ./extension/IFXMetrics/cmd +docker run --rm -it -v ${PWD}/extension/IFXMetrics:/go/work -w /go/work -e GOARCH=386 -e CGO_ENABLED=1 x1unix/go-mingw:1.20 go build -o ./dist/ifxmetrics.dll -buildmode=c-shared -ldflags "-w -s -X main.EXTENSION_VERSION=$IFXMETRICS_BUILD_VER" ./cmd + +Move-Item -Path ./extension/IFXMetrics/dist/ifxmetrics.dll -Destination ./ifxmetrics.dll -Force # Compile x64 Windows EXE -docker run --rm -it -v ${PWD}:/go/work -w /go/work -e GOARCH=amd64 -e CGO_ENABLED=1 x1unix/go-mingw:1.20 go build -o ./ifxmetrics_x64.exe -ldflags "-w -s -X main.EXTENSION_VERSION=`"$IFXMETRICS_BUILD_VER`"" ./extension/IFXMetrics/cmd +docker run --rm -it -v ${PWD}/extension/IFXMetrics:/go/work -w /go/work -e GOARCH=amd64 -e CGO_ENABLED=1 x1unix/go-mingw:1.20 go build -o ./dist/ifxmetrics_x64.exe -ldflags "-w -s -X main.EXTENSION_VERSION=$IFXMETRICS_BUILD_VER" ./cmd + +Move-Item -Path ./extension/IFXMetrics/dist/ifxmetrics_x64.exe -Destination ./ifxmetrics_x64.exe -Force ``` ### EXTENSION: COMPILING FOR LINUX @@ -196,10 +202,15 @@ Run this from the project root. docker build -t indifox926/build-a3go:linux-so -f ./build/Dockerfile.build . # Compile x64 Linux .so -docker run --rm -it -v ${PWD}:/app -e GOOS=linux -e GOARCH=amd64 -e CGO_ENABLED=1 indifox926/build-a3go:linux-so go build -o ./ifxmetrics_x64.so -linkshared -ldflags "-w -s -X main.EXTENSION_VERSION=${IFXMETRICS_BUILD_VER}" ./extension/IFXMetrics/cmd +docker run --rm -it -v ${PWD}/extension/IFXMetrics:/app -e GOOS=linux -e GOARCH=amd64 -e CGO_ENABLED=1 indifox926/build-a3go:linux-so go build -o ./dist/ifxmetrics_x64.so -linkshared -ldflags "-w -s -X main.EXTENSION_VERSION=${IFXMETRICS_BUILD_VER}" ./cmd + +Move-Item -Path ./extension/IFXMetrics/dist/ifxmetrics_x64.so -Destination ./ifxmetrics_x64.so -Force # Compile x86 Linux .so -docker run --rm -it -v ${PWD}:/app -e GOOS=linux -e GOARCH=386 -e CGO_ENABLED=1 indifox926/build-a3go:linux-so go build -o ./ifxmetrics.so -linkshared -ldflags "-w -s -X main.EXTENSION_VERSION=${IFXMETRICS_BUILD_VER}" ./extension/IFXMetrics/cmd +docker run --rm -it -v ${PWD}/extension/IFXMetrics:/app -e GOOS=linux -e GOARCH=386 -e CGO_ENABLED=1 indifox926/build-a3go:linux-so go build -o ./dist/ifxmetrics.so -linkshared -ldflags "-w -s -X main.EXTENSION_VERSION=${IFXMETRICS_BUILD_VER}" ./cmd + +Move-Item -Path ./extension/IFXMetrics/dist/ifxmetrics.so -Destination ./ifxmetrics.so -Force + ``` ### ADDON: COMPILE USING HEMTT diff --git a/addons/capture/$PBOPREFIX$ b/addons/capture/$PBOPREFIX$ index 635279f..1a1e135 100644 --- a/addons/capture/$PBOPREFIX$ +++ b/addons/capture/$PBOPREFIX$ @@ -1 +1 @@ -x\ifxmetrics\addons\capture \ No newline at end of file +x/ifxmetrics/addons/capture \ No newline at end of file diff --git a/addons/capture/fnc_entity_count.sqf b/addons/capture/fnc_entity_count.sqf index cfe58e4..6163848 100644 --- a/addons/capture/fnc_entity_count.sqf +++ b/addons/capture/fnc_entity_count.sqf @@ -1,6 +1,8 @@ #include "script_component.hpp" -params ["_allUserInfos", [], [[]]]; +params [ + ["_allUserInfos", [], [[]]] +]; private _hashesOut = []; diff --git a/addons/capture/fnc_player_performance.sqf b/addons/capture/fnc_player_performance.sqf index 58b0a38..20f81f9 100644 --- a/addons/capture/fnc_player_performance.sqf +++ b/addons/capture/fnc_player_performance.sqf @@ -1,6 +1,8 @@ #include "script_component.hpp" -params ["_allUserInfos", [], [[]]]; +params [ + ["_allUserInfos", [], [[]]] +]; private _hashesOut = []; { diff --git a/addons/main/$PBOPREFIX$ b/addons/main/$PBOPREFIX$ index 1b4dc9a..d4226e7 100644 --- a/addons/main/$PBOPREFIX$ +++ b/addons/main/$PBOPREFIX$ @@ -1 +1 @@ -x\ifxmetrics\addons\main \ No newline at end of file +x/ifxmetrics/addons/main \ No newline at end of file diff --git a/addons/main/config.cpp b/addons/main/config.cpp index 0e4501d..9e2196b 100644 --- a/addons/main/config.cpp +++ b/addons/main/config.cpp @@ -5,7 +5,11 @@ class CfgPatches { units[] = {}; weapons[] = {}; requiredVersion = 2.10; - requiredAddons[] = {}; + requiredAddons[] = { + "cba_main", + "cba_xeh", + "cba_settings" + }; author[] = {"IndigoFox"}; authorUrl = "https://github.com/indig0fox/IFXMetrics"; }; diff --git a/extension/IFXMetrics/cmd/main.go b/extension/IFXMetrics/cmd/main.go index aae9200..51e793b 100644 --- a/extension/IFXMetrics/cmd/main.go +++ b/extension/IFXMetrics/cmd/main.go @@ -319,4 +319,7 @@ func main() { // s := settings.Active.Get("cbaEventHandlers") // // return the custom cba event handlers as an arma hashmap // fmt.Println(a3interface.ToArmaHashMap(s)) + + fmt.Println("IFXMetrics extension started. Version: " + EXTENSION_VERSION) + fmt.Scanln() } diff --git a/influxdb/docker-compose.yaml b/influxdb/docker-compose.yaml new file mode 100644 index 0000000..a97bb8b --- /dev/null +++ b/influxdb/docker-compose.yaml @@ -0,0 +1,20 @@ +version: '3.8' + +services: + influxdb: + image: influxdb:latest + container_name: influxdb + restart: always + ports: + - 8086:8086 + volumes: + - ./data:/var/lib/influxdb2 + - ./config:/etc/influxdb2 + environment: + - DOCKER_INFLUXDB_INIT_MODE=setup + - DOCKER_INFLUXDB_INIT_USERNAME=exampleuser + - DOCKER_INFLUXDB_INIT_PASSWORD=dfaow3ho9i7funa0w3nv + - DOCKER_INFLUXDB_INIT_ORG=ifx-metrics + - DOCKER_INFLUXDB_INIT_BUCKET=test-bucket + - DOCKER_INFLUXDB_INIT_RETENTION=1w + - DOCKER_INFLUXDB_INIT_ADMIN_TOKEN=f0982q3ahfu8yawbo27w8fb986ba90b0wb2f \ No newline at end of file