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

Broken crystal example #29

Open
KELiON opened this issue Aug 11, 2017 · 4 comments
Open

Broken crystal example #29

KELiON opened this issue Aug 11, 2017 · 4 comments

Comments

@KELiON
Copy link

KELiON commented Aug 11, 2017

I just tried to test oss/crystal-basic example. PORT=3000 crystal main.cr works fine locally, up deployment works fine:

       build: 5 files, 3.2 MB (344ms)
       deploy: complete (17.647s)
        stack: complete (20.219s)

But opening result in browser shows:

{
  message: "Internal server error"
}

and in up logs I see:

  12:18:26pm INFO starting name: app-crystal type: server
  12:18:26pm INFO found free port 35452 version: $LATEST
  12:18:26pm INFO executing "./server" version: $LATEST
  12:18:26pm INFO waiting for http://127.0.0.1:35452 version: $LATEST
  12:18:26pm ERRO sh: ./server: No such file or directory
@lukeed
Copy link
Contributor

lukeed commented Aug 11, 2017

This is because main.cr will compile to main by default. Similarly, up start is looking for a server file or directory.

You can change the output name while building crystal:

crystal build --release main.cr -o server

@tj
Copy link
Member

tj commented Aug 11, 2017

hmm sounds like the Docker build failed. It works on my machine but I already have the tjholowaychuk/up-crystal image pulled. Maybe double check with up -v to see verbose output. up run build can be useful there too

For reference what it executes is:

$ docker run --rm -v $(PWD):/src -w /src tjholowaychuk/up-crystal crystal build --link-flags -static -o server main.cr

@KELiON
Copy link
Author

KELiON commented Aug 16, 2017

Output of up -v:


     4ms     DEBU region defaulted to "us-west-2"
     0s      DEBU track "Deploy" map[regions:[us-west-2] stage:development header_rules_count:0 redirect_rules_count:0 inject_rules_count:0 has_cors:false has_logs:true duration:0s type:server os:darwin arch:amd64 version:0.1.6]
     0s      DEBU event deploy map[]
     0s      DEBU event platform.build map[]
     0s      DEBU hook build is not defined
     118ms   DEBU injecting proxy
     0s      DEBU open
     5ms     DEBU add _proxy.js: size=931 mode=-rwxr-xr-x
     0s      DEBU add byline.js: size=4710 mode=-rwxr-xr-x
     189ms   DEBU add main: size=8891243 mode=-rwxr-xr-x
     1ms     DEBU add main.rc: size=200 mode=-rw-r--r--
     0s      DEBU add up.json: size=28 mode=-rw-r--r--
     0s      DEBU stats dirs_filtered=0 files_added=5 files_filtered=0 size_uncompressed=8.9 MB
     6ms     DEBU close
     0s      DEBU event platform.build.zip map[files:5 size_uncompressed:8897112 size_compressed:3216991 duration:318.765499ms]
     1ms     DEBU removing proxy
     0s      DEBU event platform.build.complete map[duration:319.87964ms]
     589ms   DEBU checking for role
     0s      DEBU using existing role arn:aws:iam::953067738496:role/app-crystal-api-function
     0s      DEBU event platform.deploy map[stage:development region:us-west-2]
     4.949s  DEBU fetching function config region=us-west-2
     0s      DEBU event platform.function.update map[region:us-west-2 stage:development]
     0s      DEBU event platform.deploy.complete map[stage:development region:us-west-2 duration:4.949122068s]
     0s      DEBU hook clean is not defined
   ⠇ 0s
 DEBU event deploy.complete map[duration:5.857958144s]%

Output of up run build -v:

     3ms     DEBU region defaulted to "us-west-2"
   ⠋ 0s      DEBU track "Hook" map[name:build os:darwin arch:amd64 version:0.1.6]
     0s      DEBU track "Hook" map[name:build os:darwin arch:amd64 version:0.1.6]
   ⠋ 0s      DEBU hook build is not defined%

So, looks like problem is in up buildhook build is not defined. For me it is unexpected behaviour – up should fail in this case, no?

@tj
Copy link
Member

tj commented Aug 17, 2017

hmm strange yeah it should infer from main.cr that it's a Crystal project. I'll see if I can reproduce, worth trying one of the newer releases as well.

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

3 participants