Multiple Processes in TOML FIle

Hi, I don’t know how to deploy my actual configuration. In my Rails App I have this Procfile:

web: unset PORT && bin/rails server
sidekiq: bundle exec sidekiq -C config/sidekiq.yml
telegram: bin/rake telegram:bot:poller

But when I try to deploy with this tree processes with this toml:

app = "avisator"
primary_region = "mad"

web = "bin/rails server"
worker = "bundle exec sidekiq"
telegram = 'bin/rake telegram:bot:poller'

  processes = ["web"] # this service only applies to the web process
  internal_port = 3000
  force_https = true
  auto_stop_machines = true
  auto_start_machines = true

    type = "tcp"
    interval = "15s"
    timeout = "2s"
    grace_period = "5s"

  guest_path = "/rails/public"
  url_prefix = "/"

Alwais get this error:
Error: error creating machine configuration: Check ‘telegram’ for group ‘alive’ has no internal port set and there is no http_service to refer to

Someone can help me?

Hey @hangman2! First of all, that should actually read Check 'alive' for group 'telegram' has no internal port set and there is no http_service to refer to. That is, the check name and group name are transposed. That’s a bug in flyctl!

Top-level checks (i.e., those defined in the [checks] section) are not associated with a particular service. Therefore, you generally need to provide an explicit port to connect to like this:

  port = 3000

As a convenience, if no port is defined, it will use your http_service’s internal port.

Top-level checks also by default apply to all processes in your app. EDIT: My bad! Top-level checks apply only to your default process group. That’s app if present (or if no processes are defined) and the first lexicographically otherwise. In your case, that’s telegram. The suggested fix below should still work.

The error here is that the alive check you have defined applies to all processes and has no port set, so it will default to using the http_service; however, the http_service does not apply to the telegram and worker processes.

EDIT: Perhaps you want to limit the alive check to the web process group, like this?

  processes = ["web"]

Hi Matthew! Thanks, I think now works, but I change a bit my process because I set a webhook instead a poller. But I have an error with my session_store… In the documentation of the gem saids:

By default session is configured to use FileStore at `Rails.root.join('tmp', 'session_store')` . To use it in production make sure to share this folder between releases (ex., add to list shared of shared folders in capistrano).

But I don’t know how to share a folder in fly deploy. Maybe you know how.

Thanks again!!

Before proceeding, I encourage you to review your activestorage options. If you want to scale your application to multiple servers, either now, or in the future, you will want to put this storage elsewhere This can be on servers by deploying something like MinIO, or it could be on Amazon S3, Digital Ocean, Microsoft Azure, or Google Cloud.

If scalability is not a concern, you can put the data on the same machine, but it will need to be place on a volume. If you proceed down this path, you will need to mount the volume by adding lines to your fly.toml, and modify your config/storage.yml to reference a subdirectory of the destination where you mounted your volume.

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