influxdata / influxdb

Scalable datastore for metrics, events, and real-time analytics
https://influxdata.com
Apache License 2.0
28.96k stars 3.56k forks source link

influxdb v2 binaries for FreeBSD? #16902

Open hellvesper opened 4 years ago

hellvesper commented 4 years ago

Proposal: influxdb2 binaries for FreeBSD

Current behavior: There is only v1 available at the moment

Desired behavior: I want influxdb2 on FreeBSD

Alternatives considered: Or build instructions for v2

russorat commented 4 years ago

@hellvesper thanks for the issue. Yes we would like to create binaries for additional OSes. We will make sure FreeBSD is added to the list.

In the meantime, have you tried building from source? https://github.com/influxdata/influxdb/blob/master/CONTRIBUTING.md#getting--building-from-source

Did you run into any problems?

jacobmarble commented 4 years ago

@ayang64 FYI

hellvesper commented 4 years ago

@hellvesper thanks for the issue. Yes we would like to create binaries for additional OSes. We will make sure FreeBSD is added to the list.

In the meantime, have you tried building from source? https://github.com/influxdata/influxdb/blob/master/CONTRIBUTING.md#getting--building-from-source

Did you run into any problems?

Yes, I tried to build beta2 without luck, there was some problem with wasm-pack and workspaces. But current master builds without any problem, thanks!

rickspencer3 commented 4 years ago

We would like to offer these binaries, and would be happy to take such a contribution. However, we can add this any time of we GA 2.0 Open Source, so I am de-prioritizing this. Please leave a comment if you disagree with this decision.

rawkode commented 4 years ago

CC @slicerdicer

GitKalle commented 3 years ago

@hellvesper thanks for the issue. Yes we would like to create binaries for additional OSes. We will make sure FreeBSD is added to the list.

In the meantime, have you tried building from source? https://github.com/influxdata/influxdb/blob/master/CONTRIBUTING.md#getting--building-from-source

Did you run into any problems?

I try to compile freebsd and run into a problem. Please see the output:

root@influx:/home/influx/influxdb # gmake
gmake -C http all
gmake[1]: Entering directory '/usr/home/influx/influxdb/http'
gmake[1]: Nothing to be done for 'all'.
gmake[1]: Leaving directory '/usr/home/influx/influxdb/http'
gmake -C ui all
gmake[1]: Entering directory '/usr/home/influx/influxdb/ui'
gmake[1]: Nothing to be done for 'all'.
gmake[1]: Leaving directory '/usr/home/influx/influxdb/ui'
gmake -C chronograf all
gmake[1]: Entering directory '/usr/home/influx/influxdb/chronograf'
gmake -C dist all
gmake[2]: Entering directory '/usr/home/influx/influxdb/chronograf/dist'
gmake[2]: Nothing to be done for 'all'.
gmake[2]: Leaving directory '/usr/home/influx/influxdb/chronograf/dist'
gmake -C server all
gmake[2]: Entering directory '/usr/home/influx/influxdb/chronograf/server'
gmake[2]: Nothing to be done for 'all'.
gmake[2]: Leaving directory '/usr/home/influx/influxdb/chronograf/server'
gmake -C canned all
gmake[2]: Entering directory '/usr/home/influx/influxdb/chronograf/canned'
gmake[2]: Nothing to be done for 'all'.
gmake[2]: Leaving directory '/usr/home/influx/influxdb/chronograf/canned'
gmake[1]: Leaving directory '/usr/home/influx/influxdb/chronograf'
gmake -C storage all
gmake[1]: Entering directory '/usr/home/influx/influxdb/storage'
gmake -C flux all
gmake[2]: Entering directory '/usr/home/influx/influxdb/storage/flux'
gmake[2]: Nothing to be done for 'all'.
gmake[2]: Leaving directory '/usr/home/influx/influxdb/storage/flux'
gmake[1]: Leaving directory '/usr/home/influx/influxdb/storage'
env GO111MODULE=on go build -tags 'assets' -ldflags "-s -w  -X main.commit=2a45f0c037 -X main.version=v2.0.7" -o bin/freebsd/influx ./cmd/influx
# /home/influx/influxdb/scripts/pkg-config.sh --cflags  -- flux
/home/influx/influxdb/scripts/pkg-config.sh: fork/exec /home/influx/influxdb/scripts/pkg-config.sh: no such file or directory
gmake: *** [Makefile:97: bin/freebsd/influx] Error 2

I don't know, what's wrong. The pkg-config.sh exist in that location:

root@influx:/home/influx/influxdb # ls -la /home/influx/influxdb/scripts/pkg-config.sh
-rwxr-xr-x  1 influx  influx  448 Jun  7 14:09 /home/influx/influxdb/scripts/pkg-config.sh

Any suggestion?

ayang64 commented 3 years ago

@GitKalle -- the problem is that the "magic number" (the first line of the script) is #!/bin/bash. FreeBSD, rightfully, puts bash in /usr/local/bin/bash.

If you change that it should work.

I think the solution to this might be to use env like:

#!/usr/bin/env bash

That should allow the script to run on FreeBSD, Linux, Mac, etc.

It compiles under FreeBSD when I make this change.

GitKalle commented 3 years ago

@GitKalle -- the problem is that the "magic number" (the first line of the script) is #!/bin/bash. FreeBSD, rightfully, puts bash in /usr/local/bin/bash.

If you change that it should work.

I think the solution to this might be to use env like:

#!/usr/bin/env bash

That should allow the script to run on FreeBSD, Linux, Mac, etc.

It compiles under FreeBSD when I make this change.

Perfect, it works. Thank you very much.

ayang64 commented 3 years ago

Perfect, it works. Thank you very much.

awesome! now submit a pull request fixing the #! line in all of the scripts to use /usr/bin/env instead of bash directly. i think that'd improve the portability of influxdb 2.

phaethon commented 2 years ago

If it helps anyone, just successfully built influxdb v2.4.0 in a fresh 13.1-RELEASE jail.

# Running as root in a jail. Home dir /root

pkg install git
pkg install gmake
pkg install go
pkg install rust
pkg install pkgconf
pkg install goprotobuf
pkg install bash
bash

export PATH=$PATH:/root/go/bin

git clone https://github.com/influxdata/influxdb.git --branch v2.4.0 --single-branch
git clone https://github.com/influxdata/influx-cli.git --branch v2.4.0 --single-branch

cd influx-cli
gmake

cd ../influxdb

# Within each .proto file replace line starting with 'option go_package = ".;' to start with 'option go_package = "./;'
find . -name *.proto -exec sed -i .bkp 's$^option go_package = ".;$option go_package = "./;$' \{\} \;
find . -name *.proto.bkp -exec rm \{\} \;

gmake

Have not done any thorough tests, but at least the build completes successfully, and I can run the binary bin/freebsd/influxd

tarkhil commented 2 years ago

Thanks a lot!

phaethon commented 2 years ago

Running gmake test all tests seem to pass except these:

--- FAIL: TestNewGroupResultSet_Sorting (0.00s)
    --- FAIL: TestNewGroupResultSet_Sorting/group_by_tag1_in_partial_series (0.00s)
        group_resultset_test.go:275: unexpected value; -got/+exp
              []string{
                ... // 6 identical elements
                "  tag key      : _m,tag0,tag1",
                "  partition key: val11",
            -   "    series: _m=cpu,tag0=val00,tag1=val11",
                "    series: _m=cpu,tag0=val01,tag1=val11",
            +   "    series: _m=cpu,tag0=val00,tag1=val11",
                "group:",
                "  tag key      : _m,tag0,tag1",
                "  partition key: val12",
            +   "    series: _m=cpu,tag0=val01,tag1=val12",
                "    series: _m=cpu,tag0=val00,tag1=val12",
            -   "    series: _m=cpu,tag0=val01,tag1=val12",
                "group:",
                "  tag key      : _m,tag0",
                ... // 4 identical elements
              }
--- FAIL: TestNewGroupResultSet_SortOrder (0.00s)
    --- FAIL: TestNewGroupResultSet_SortOrder/nil_lo (0.00s)
        group_resultset_test.go:401: unexpected value; -got/+exp
              []string{
                "group:",
                "  tag key      : _m,tag1,tag2",
                "  partition key: <nil>,val20",
            -   "    series: _m=mem,tag1=val10,tag2=val20",
                "    series: _m=mem,tag1=val11,tag2=val20",
            +   "    series: _m=mem,tag1=val10,tag2=val20",
                "group:",
                "  tag key      : _m,tag1,tag2",
                ... // 3 identical elements
                "  tag key      : _m,tag0,tag1",
                "  partition key: val00,<nil>",
            -   "    series: _m=aaa,tag0=val00",
                "    series: _m=cpu,tag0=val00,tag1=val10",
                "    series: _m=cpu,tag0=val00,tag1=val11",
                "    series: _m=cpu,tag0=val00,tag1=val12",
            +   "    series: _m=aaa,tag0=val00",
                "group:",
                "  tag key      : _m,tag0",
                ... // 3 identical elements
              }
FAIL
FAIL    github.com/influxdata/influxdb/v2/storage/reads 0.437s
jeffreyssmith2nd commented 2 years ago

If you're using Go 1.19, there was a change in sorting behavior that will lead to those tests failing. At the moment, it is recommended to build with Go 1.18 until it is validated that those sorting changes are acceptable.

phaethon commented 2 years ago

You are right. Now I installed go 1.18 via gvm and gmake test returns no error. I still used the package for go1.19 in order to be able to build go1.18. This is a full updated script to build and test influxdb.

# Running as root in a jail. Home dir /root

pkg install git
pkg install gmake
pkg install go
pkg install rust
pkg install pkgconf
pkg install goprotobuf
pkg install bash
pkg install bison
pkg install gcc
bash
bash < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer)
source /root/.gvm/scripts/gvm
gvm install go1.18 -b
gvm use go1.18

export PATH=$PATH:/root/go/bin

git clone https://github.com/influxdata/influxdb.git --branch v2.4.0 --single-branch
git clone https://github.com/influxdata/influx-cli.git --branch v2.4.0 --single-branch

cd influx-cli
gmake

cd ../influxdb

# Within each .proto file replace line starting with 'option go_package = ".;' to start with 'option go_package = "./;'
find . -name *.proto -exec sed -i .bkp 's$^option go_package = ".;$option go_package = "./;$' \{\} \;
find . -name *.proto.bkp -exec rm \{\} \;

gmake
gmake test