Having trouble getting multiple processes working with go app

I’m new to fly, and still getting my feet. Any help is appreciated.

I have a go app that’s been running as a single instance while I’m testing things. I’m getting ready to add instances, but first I need to separate cron tasks from the server (so the cron work is done once, not once per instance).

I altered my go app to pick a job (cron or server) based on a run time flag. When I run this locally, everything works as expected.

I modified my fly.toml file, defining two processes. The web server section already included a reference to the “app” process, so I left that as-is. Here are the relevant bits:

[processes]
app = "my-binary"
cron = "my-binary --cron"

[build]
  builder = "paketobuildpacks/builder:base"
  buildpacks = ["gcr.io/paketo-buildpacks/go"]

[[services]]
  processes = ["app"]
  ...

When I deploy the app, the web server works as expected. However, the cron version never finishes starting up. I see a ton of these messages:

“checking docker activity”
“Calling GET /v1.41/containers/json?filters=%7B%22status%22%3A%7B%22running%22%3Atrue%7D%7D&limit=0”

And eventually this:

“dockerd has exited”
“Deadline reached without docker build”
“shutting down”
“gracefully stopped\n”

It’s the same binary, and same build system, all executed by fly. The only difference is that the cron version has no web server running. It’s just a schedule of tasks and a blocking statement to prevent the app exiting.

Perhaps unrelated, but when I deploy the app, fly tries to launch two instances of the cron version (1 app, 2 cron). I tried it twice, and both times it gave me two cron-version instances.

Anyone familiar with this behavior? I’m not finding anything probative in the logs, and I’m not sure where to look next.

TIA!

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