Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loki windows amd64 release binaries #917

Closed
RobertLivermore opened this issue Aug 19, 2019 · 7 comments · Fixed by #981
Closed

Loki windows amd64 release binaries #917

RobertLivermore opened this issue Aug 19, 2019 · 7 comments · Fixed by #981

Comments

@RobertLivermore
Copy link

Would like to run Loki on a Windows Server / window amd64. Cannot find compatible binaries windows release. Can you provide directions on how to make windows build of Loki or provide the zip archive of the binaries on the release tab.
Thanks

@slim-bean
Copy link
Collaborator

A while back there were issues building on Windows, thought I just tried it an it seemed to work.

If you check out the source you should be able to run:

make GOOS=windows loki

The build was successful for me but I don't have a windows machine available to test at the moment.

If it works we can update the release process to auto generate windows binaries for Loki as well

@MHerbst
Copy link

MHerbst commented Aug 20, 2019

I have compiled and used version 0.2 on Windows and did not encounter any problems. Will try 0.3 this evening.

@RobertLivermore
Copy link
Author

Thanks for the help. I was able to make a build.
I'm testing to see if Loki is a replacement TSDB for InfluxDB. InfluxDB has expensive RAM cost and recommends an Azure premium SSD disk for storeage. Loki Design document suggest it can be run on lower cost disks. I'm just storing application logs(timestamp, tags, and a large message). If you have suggestions on what Loki storage options I should test and compare with InfluxDB.

Created a dockerfile. Use the windows golang image, pull the loki source and build. Copy the output to a windows nanoserver.

 #escape=`
FROM golang:1.12.9-windowsservercore-1809 AS build
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
RUN mkdir src\github.com\grafana ; `
    mkdir \bin ; ` 
    cd src\github.com\grafana ; `
    git clone -q https://github.com/grafana/loki ; `
    go build -o \bin\loki-server.exe .\loki\cmd\loki\main.go ;

FROM mcr.microsoft.com/windows/nanoserver:1809 AS base
COPY --from=build ["C:/bin/", "C:/Program Files/Loki"]
USER ContainerAdministrator 
RUN mkdir %ProgramData%\loki\index&mkdir %ProgramData%\loki\chunk 
EXPOSE 3100
WORKDIR "Program Files/Loki"
ENTRYPOINT [ "loki-server.exe" ]
LABEL loki.version="0.3.0" `
loki.license="https://github.com/grafana/loki/blob/master/LICENSE"

Build with
docker build --tag loki:v0.3.0-nanoserver-1809 .\loki

Can get the help page with
docker run loki:v0.3.0-nanoserver-1809 -help

@RobertLivermore
Copy link
Author

Loki process fails with invalid memory address or dereferenced pointer. when initializing the processes storage.

level=info ts=2019-08-20T14:35:30.8571574Z caller=loki.go:125 msg=initialising module=server
level=info ts=2019-08-20T14:35:30.8591573Z caller=server.go:120 http=[::]:80 grpc=[::]:9095 msg="server listening on addresses"
level=info ts=2019-08-20T14:35:30.863176Z caller=loki.go:125 msg=initialising module=overrides
level=info ts=2019-08-20T14:35:30.863176Z caller=override.go:48 msg="per-tenant overides disabled"
level=info ts=2019-08-20T14:35:30.863176Z caller=loki.go:125 msg=initialising module=table-manager
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x38 pc=0x10aac91]

goroutine 1 [running]:
github.com/grafana/loki/vendor/github.com/cortexproject/cortex/pkg/chunk/storage.NewTableClient(0x14db233, 0x3, 0x0, 0x4000000000000000, 0x4024000000000000, 0x0, 0x0, 0x0, 0x186a0, 0x3ff4cccccccccccd, ...)
        C:/gopath/src/github.com/grafana/loki/vendor/github.com/cortexproject/cortex/pkg/chunk/storage/factory.go:160 +0x81
github.com/grafana/loki/pkg/loki.(*Loki).initTableManager(0xc0001b6000, 0xc00007c4b0, 0x7)
        C:/gopath/src/github.com/grafana/loki/pkg/loki/modules.go:201 +0x11c
github.com/grafana/loki/pkg/loki.(*Loki).initModule(0xc0001b6000, 0x7, 0x0, 0x0)
        C:/gopath/src/github.com/grafana/loki/pkg/loki/loki.go:127 +0x234
github.com/grafana/loki/pkg/loki.(*Loki).init(0xc0001b6000, 0x8, 0xc0004e66b0, 0x10)
        C:/gopath/src/github.com/grafana/loki/pkg/loki/loki.go:116 +0x82
github.com/grafana/loki/pkg/loki.New(0x8, 0x1, 0x14dbc28, 0x4, 0x0, 0x0, 0x50, 0x0, 0x0, 0x2387, ...)
        C:/gopath/src/github.com/grafana/loki/pkg/loki/loki.go:86 +0x15a
main.main()
        C:/gopath/src/github.com/grafana/loki/cmd/loki/main.go:69 +0x380

Command to run process: From a PowerShell console.

$dockerCommand = 'docker run loki:v0.3.0-nanoserver-1809 --% -auth.enabled false -server.http-listen-port 3100 -ingester.lifecycler.addr 127.0.0.1   -ring.store inmemory -distributor.replication-factor 1   -ingester.final-sleep 0 -ingester.chunks-idle-period 5m   -ingester.chunks-retain-period 30s -config-yaml schema_config:configs:-from:2018-04-15store:boltdbobject_store:filesystemschema:v9index:prefix:index_period:168h -boltdb.dir "C:\ProgramData\loki\index" -local.chunk-directory "C:\ProgramData\loki\chunk" -validation.enforce-metric-name false   -validation.reject-old-samples true -validation.reject-old-samples.max-age 168h -store.max-look-back-period 0 -dynamodb.chunk-table.inactive-read-throughput 0 -dynamodb.chunk-table.inactive-write-throughput 0 -dynamodb.chunk-table.read-throughput.scale.max-capacity 0 -dynamodb.chunk-table.write-throughput.scale.max-capacity 0 -dynamodb.periodic-table.inactive-read-throughput 0 -dynamodb.periodic-table.inactive-write-throughput 0 -dynamodb.periodic-table.read-throughput.scale.max-capacity 0 -dynamodb.periodic-table.write-throughput.scale.max-capacity 0 -table-manager.retention-deletes-enabled false -table-manager.retention-period 0'
iex $dockerCommand 

@MHerbst
Copy link

MHerbst commented Aug 20, 2019

I have pulled the latest sources and build loki on Windows 10.

I get very similar errors if I start loki.exe without passing a config file. If I execute it with option --config.file and the default config file it works.
I don't use docker and execute it directly from a PowerShell Console on Windows 10:
This is the command line that works in my environment:

.\loki.exe --config.file cmd\loki\loki-local-config.yaml

BTW: I had to use two hyphens for the parameter. Maybe you can try to use a config file, too.

@RobertLivermore
Copy link
Author

RobertLivermore commented Aug 20, 2019 via email

@sh0rez
Copy link
Member

sh0rez commented Sep 6, 2019

Docker is not a fan of config files because the disk image are supposed to be immutable – settings lost on ever container start. Not good practice to make your dev/QA/Production images different.

Can't you make use of docker volumes? And just bind the configuration file from outside into the container?
Furthermore, building custom images for environments might not be the cleanest way, but is definitely an acknowledged one (e.g. the library/postgres image recommends such an approach).

Regarding Loki on windows ... we can certainly distribute .exe files in the Releases section. Docker images are a little more tricky here, because Docker for Windows has some weird constraints (building system needs the same version as the executing one etc.), furthermore we do not have access to a Windows system in CI.

So, in near future, yes for binaries, no for containers. Would that work for you?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants