Hi, I’m just trying to kick the tyres with machines. And I cannot seem to get a simple job / script to show stdout in the logs, which makes me wonder if I’m even running it.
When I had a simple
node -p 'console.log('hi')' it looked like the machine started → stopped fine but I never saw any stdout in the logs.
I tried a simple Dockerfile
ENTRYPOINT ["/bin/sh", "-c"]
And then I try machine run:
fly machine run <image> --id <machine> -a <app> 'ls -la /'
And I just get:
Waiting on firecracker VM...
I know I am doing something very obviously wrong, but please help
My app has an empty services block, because it is just meant to be a job (e.g. download some files and zip them up, put them on a bucket). Would that affect health checks or something?
Oh and here is a much better reproducible example:
fly machine run debian:wheezy 'ls /'
There’s a known bug where
flyctl might get stuck showing
Waiting on firecracker VM, but it might’ve already started.
fly machine list -a <app> show a running machine for the ID printed when running it?
You can also
fly machine run --id <machine> -a <app> . ls -la / and that will build your current directory’s Dockerfile.
It’s also possible this command exits so quickly it might’ve stopped already.
Can you check
fly logs -a <app> to see if it logged the
ls -la / result?
I wish I knew that, that is fantastic!
machine list shows
stopped - which is great. And when I go check the logs in the dash I can see the ls worked. So somewhere between my original command and that simple example is the issue, I’ll go bisect…
Ok got this working, I used the curl API before so I must have done something weird, but here is a simple reduced working example for anyone else who needs it:
# Create app directory
COPY src ./src
CMD [ "node", "src/index.js" ]
Then create/run the machine:
fly machine run .
Follow the prompts, create an app, check your logs:
Thanks again @jerome