Open KELiON opened 7 years ago
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
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
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 build
– hook build is not defined
. For me it is unexpected behaviour – up
should fail in this case, no?
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.
I just tried to test oss/crystal-basic example.
PORT=3000 crystal main.cr
works fine locally,up
deployment works fine:But opening result in browser shows:
and in
up logs
I see: