Displaying logs for entrypoint script

EDIT: disregard inquiry. I was confused about logs and cold starts. I can see error logs now.

I’m not very savvy with devops and docker. I’m using a Remix.js indie stack template. I don’t understand exactly what flyctl deploy does. It builds the docker image somehow :man_shrugging:t2:

I npm run a node.js script in my entrypoint shell script that logs to the console. I don’t see:

  • any of the console.log strings
  • any of the text I echo in the entrypoint bash script
  • any of the shell script commands echoed as they should be as a result of set -ex ( see this comment for why )

I look in the local terminal output of flyctl deploy --debug --verbose and in the machine logs and it’s nowhere to be found.

How do I debug entrypoint scripts?

I did manage to echo some text that was displayed in the logs. However, it appears before the logs report that the entrypoint script start.sh is run :exploding_head: (first line has echoed text)

2024-05-31 13:12:26.050	
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2024-05-31 13:12:26.049	
swapon: /swapfile: swapon failed: Invalid argument
2024-05-31 13:12:26.046	
machine started in 540.859349ms
2024-05-31 13:12:26.045	
Machine started in 537ms
2024-05-31 13:12:26.044	
no label, UUID=b32617cc-540a-4b32-b830-cfbfec652b5c
2024-05-31 13:12:26.044	
Setting up swapspace version 1, size = 512 MiB (536866816 bytes)
2024-05-31 13:12:26.027	
2024/05/31 17:12:26 INFO SSH listening listen_address=[fdaa:9:cc4:a7b:f0:3fb8:1a38:2]:22 dns_server=[fdaa::3]:53
2024-05-31 13:12:26.020	
 INFO [fly api proxy] listening at /.fly/api
2024-05-31 13:12:26.012	
 INFO Preparing to run: `sh start.sh` as root

EDIT: I was confused because the logs search is displayed in the opposite order as the live logs

If you’re attempting to setup swap directly via mkswap and swapon, that function is being deprecated with our introduction of a new way to manage rootfs via overlayfs. The supported method moving forward is to update your fly.toml or machine config to use swap_size_mb.

1 Like

I was using this code that I found in some boilerplate:


# allocate swap space
fallocate -l 512M /swapfile
chmod 0600 /swapfile
mkswap /swapfile
echo 10 > /proc/sys/vm/swappiness
swapon /swapfile
echo 1 > /proc/sys/vm/overcommit_memory

Are there any instructions about how to remove the deprecated use of these commands? The linked post is pretty technical.

swap_size_mb should do the trick and remove those lines from your entrypoint script

Thanks for your support @JP_Phillips , looking back, I see that I TLDR’d over that detail in your post, whoops, sorry

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.