Debugging Applications
Although we would love everything to work out of the box, the world, the cloud, and software are more complicated than that. In this guide we show you how to debug apps on KraftCloud so that you may fix issues, or, in the worst case, be able to provide enough information for us to do so for you.
Debugging the Build, Packaging and Pushing Steps
The kraft cloud deploy
command performs several steps on your local device before actually deploying your app to KraftCloud:
- Downloads the runtime image (defined in the
Kraftfile
) from the KraftCloud registry. - Builds the application filesystem using the
Dockerfile
via BuildKit. - Packages the application filesystem and the runtime in an OCI image.
- Pushes the OCI image to the to the KraftCloud registry under your username’s namespace.
In case any of these fail or report issues you can enable kraft
debugging by using the --log-level
and --log-type
flags:
You should then see debug output for the 4 steps above, similar to:
Hopefully this output will give you better insights into what the issue is; if not, please report the issue to us with the output on our Discord server.
Debugging Running Apps
The most direct way to debug apps on KraftCloud is to use the apps’s console output, which may include kernel output.
To see it, after starting the KraftCloud instance (via kraft cloud deploy
or kraft cloud inst create
), use:
In case of a crash, you’ll see a full crash output:
Use the recommended command for detailed output. You get something like:
This gives you a more clear reason of why the error occurred, in the stop reason
line.
In this case, it’s because of insufficient memory.
Some times the stop reason is insufficient for debugging. The next step is to enable debug tracing for the instance.
To do that, in your application of choice in the examples repository, or in an application directory you created, update the runtime
entry in the Kraftfile
to reference the debug build of the image you use by adding -dbg
to the name of the runtime.
For example, if you want to run the http-go1.21 example with debug output, update its Kraftfile
as follows:
That is, simply change base:latest
to base:latest-dbg
. Now we’re ready to re-deploy:
We can now can now inspect the logs as before and get the system call tracing:
This mechanism should work for all apps/runtimes and we hope will give you enough insights into what the problem is. If not, please contact us on the Discord server and provide this output so we can assist you in debugging.
Learn More
- The
kraft cloud
CLI reference - KraftCloud’s REST API reference
- Many more guides here