How can I configure another process in production along with rails server

Hi All,
Happy New Year! :tada:

I have a rails application deployed in The fly.toml was generated automatically by fly CLI.

I have searched the fly documentation on how to launch another process for running sidekiq and found this. I don’t see any default process like “web” defined in my fly.toml and the fly.toml.

Here are fly.toml contents

processes = []

    BUILD_COMMAND = "bin/rails fly:build"
    SERVER_COMMAND = "bin/rails fly:server"

  release_command = "bin/rails fly:release"

  PORT = "8080"

  http_checks = []
  internal_port = 8080
  processes = ["app"]
  protocol = "tcp"
  script_checks = []

And here is Procfile

backend: bin/rails server -p 3000
frontend: bin/vite dev
worker: bundle exec sidekiq

I have modified fly.toml with multiple process, it is throwing this error message,

web = "bin/rails fly:server"
worker = "bundle exec sidekiq"

  http_checks = []
  internal_port = 8080
  processes = ["web"]

Error Your fly.toml referenced an attribute 'web' but it is unknown. Double check the accepted attributes in fly.toml

Bit confused about coping with the commands from Procfile to fly.toml. How can I run both rails server and sidekiq worker?

I previously had asked a similar question here, I am a bit concerned about adding below code, as if one process fails entire app will fail to run

fork { sh 'bundle exec sidekiq' }

Could someone help me,

Thanks in advance. :pray:

if your app is rather small and you are using Sidekiq 7, you could try using Sidekiq Capsule.

about your error, I believe the problem is in the docs. the processes declaration should be indented under processes, like this

  web = "bin/rails fly:server"
  worker = "bundle exec sidekiq"

at least it is like that in this example too so it might be it

1 Like