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

0.2.2-sandbox+oryOS.10: Unable to initialize compiler: lstat /go: no such file or directory #73

Closed
sevenlure opened this issue Jan 4, 2019 · 20 comments

Comments

@sevenlure
Copy link

Describe the bug
Version [0.2.2-sandbox+oryOS.10]
keto serve
=> Unable to initialize compiler: lstat /go: no such file or directory

Version [v0.1.9-sandbox+oryOS.9]
keto serve
=> work well

To Reproduce
Steps to reproduce the behavior:

  1. Run keto serve
  2. See error: Unable to initialize compiler: lstat /go: no such file or directory

Version:

  • Environment: [binaries]
  • Version [0.2.2-sandbox+oryOS.10]
@bensont1
Copy link

bensont1 commented Jan 7, 2019

I have also run into this problem, same issue on 0.2.1-sandbox+oryOS.10.

@aeneasr
Copy link
Member

aeneasr commented Jan 7, 2019

What OS?

@bensont1
Copy link

bensont1 commented Jan 7, 2019

I’m runnning the Docker image from DockerHub. In my case, it doesn’t even specify which file is is not found.

The process immediately gets shutdown due to this error.

time="2019-01-07T20:28:40Z" level=info msg="Listening on https://:4466"
time="2019-01-07T20:28:40Z" level=fatal msg="Unable to gracefully shutdown HTTP(s) server because open : no such file or directory"

@bensont1
Copy link

bensont1 commented Jan 7, 2019

I think i found the issue, seems to be in this block on HTTPS server start. The certs are not actually set in the http.Server tls config

keto/cmd/server/serve.go

Lines 126 to 130 in ed7af3f

if errors.Cause(err) == tlsx.ErrNoCertificatesConfigured {
server.TLSConfig = &tls.Config{Certificates: cert}
} else if err != nil {
cmdx.Must(err, "Unable to load HTTP TLS certificate(s): %s", err)
}

@aeneasr
Copy link
Member

aeneasr commented Jan 7, 2019

Are you running it with TLS configured or without?

@bensont1
Copy link

bensont1 commented Jan 7, 2019

I am running 0.2.2-sandbox+oryOS.10 with TLS configured using Path to cert and key.

@aeneasr
Copy link
Member

aeneasr commented Jan 7, 2019

Can you make sure that the paths are set correctly? Could you maybe show the env config?

@bensont1
Copy link

bensont1 commented Jan 7, 2019

They are set correctly, using HTTPS_TLS_CERT_PATH and HTTPS_TLS_KEY_PATH.

The tlsx package for tlsx.HTTPSCertificate() doesn't return tlsx.ErrNoCertificatesConfigured which would allow the above code to hit line 127. Instead nil is returned in err

From tlsx:
https://github.com/ory/x/blob/8463556ef7762bd4f6dd94dd30da22cec10ac70a/tlsx/cert.go#L81

@aeneasr
Copy link
Member

aeneasr commented Jan 7, 2019

Right, the logic here seems to be messed up. TLSConfig should be nil in case of tlsx.ErrNoCertificatesConfigured and set if the error is nil.

@sum2000
Copy link
Contributor

sum2000 commented Jan 17, 2019

@aeneasr I am facing the same issue on Mac. I am building from source and I pull in the src using go mod vendor. This script pulls in Keto source (.go files) to local vendor folder and I build using 'go build -mod=vendor'. The build is fine but when I run keto serve, I get the same error as OP. It has to do with go mod vendor because it does not pull the .rego files from git as they are non .go files. I manually added the rego folder on my local src copy inside ladon folder and everything was working fine. One solution could be adding a placeholder .go file inside the rego folder. I imagine this will force go mod vendor to download all the necessary code required to run keto serve

@aeneasr
Copy link
Member

aeneasr commented Jan 19, 2019

Ohhh, that's possible. Damn, any ideas how to fix that?

@sum2000
Copy link
Contributor

sum2000 commented Jan 19, 2019

One solution could be adding a placeholder .go file inside the rego folder. I imagine this will force go mod vendor to download all the necessary code required to run keto serve. I tried forking latest master and running with proposed solution but I kept getting the resty import issues, I will try again today.

@sum2000
Copy link
Contributor

sum2000 commented Jan 23, 2019

@aeneasr PR for the issue

@sum2000
Copy link
Contributor

sum2000 commented Jan 23, 2019

Also, the DockerFile needs to be updated. You have to copy the rego folder into your docker release image here. Let me know if it needs further clarification.

@aeneasr
Copy link
Member

aeneasr commented Jan 24, 2019

Whoops, reopening because this is two issues in one

@aeneasr aeneasr reopened this Jan 24, 2019
aeneasr added a commit that referenced this issue Jan 24, 2019
aeneasr added a commit that referenced this issue Jan 24, 2019
@ingenieroariel
Copy link

I got a similar error with yesterday's master:

Unable to initialize compiler: lstat /build: no such file or directory

@aeneasr
Copy link
Member

aeneasr commented Feb 5, 2019

This is probably caused by: #79 (comment)

@aeneasr aeneasr reopened this Feb 5, 2019
@ingenieroariel
Copy link

I have a nix derivation that reproduces the problem (while packaging ORY for NixOS).

https://github.com/piensa/nur-packages/blob/master/pkgs/keto/default.nix

@aeneasr
Copy link
Member

aeneasr commented Feb 5, 2019

Ok, it seems like there were several issues:

  • The CircleCI build spec did not use packr to pack the rego files in the binary
  • The makefile did not use packr to pack the rego files in the binary
  • The docs did not specify that packr needs to be installed

This has all been fixed now and is being merged with #84

aeneasr added a commit that referenced this issue Feb 5, 2019
Closes #73 
Closes #81

Signed-off-by: aeneasr <[email protected]>
@aeneasr
Copy link
Member

aeneasr commented Feb 5, 2019

0.2.3 is now on it's way where this should be solved

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

No branches or pull requests

5 participants