Keeping machine active

I am trying to keep the machine active in my paid account. I looked at the logs and the following I saw:

  1. Volume Initialization and Encryption: The logs indicate that the machine is initializing and encrypting a volume (pg_data), likely intended for PostgreSQL data storage. This part seems to be functioning correctly.
  2. Apache Starting: The Apache HTTP server starts successfully but then the main process exits with code 0, which generally indicates a normal shutdown. However, in a persistent server configuration, you typically want the main process to keep running.
  3. Rebooting: After the main process exits, the machine cleans up and unmounts volumes, but encounters an error with unmounting /rootfs, and then the system reboots. This could be indicative of an issue with the startup script or the configuration that leads to an unintended or misconfigured shutdown process.
  4. Repeated Reboots: The machine restarts several times, indicating that there might be a problem in the startup configuration that is causing the system to reboot instead of staying online.
  5. Potential Misconfigurations:
  • Startup Script: The start.sh script is executed as root and might contain commands or operations that lead to a shutdown or reboot. You should review this script to ensure it’s configured to start services in the intended manner and does not include commands that could cause the machine to shut down or reboot unless intended.

how do I access start.sh?

Hi,

I would assume start.sh is being added by Fly and so you probably don’t need to edit it.

Instead … to keep a machine running and not auto-shutdown, i’d think you would need to specify that in the fly.toml. Do you see these lines in your file? It sounds like you would set the first line as false, and the third line to 1 to keep 1 machine active:

auto_stop_machines = true
auto_start_machines = true
min_machines_running = 0

For more on that:

If you do need to explore start.sh, er … maybe SSH in to the machine and look at it there?

[http_service]
internal_port = 8080
force_https = true
auto_stop_machines = false
auto_start_machines = true
min_machines_running = 1
processes = [‘app’]

[[services]]
protocol = ‘tcp’
internal_port = 8080
auto_stop_machines = false
auto_start_machines = true
min_machines_running = 1
ports =

[[vm]]
memory = ‘2gb’
cpu_kind = ‘shared’
cpus = 2

this is my latest settings in my toml file. I looked at the logs and it looks like the shutdown is still automatic. Any ideas?

I think I did a beginner mistake. Despite these settings fly looks at 1 instance as 0 so that is why it shuts down. I create another instance and it seems to be working now.

1 Like

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