Preview: multi process apps (get your workers here!)

Hello,

This is an awesome feature. I am currently using it to run a Django API, a Celery Worker, and a Celery Beat instance.

fly.toml for references

kill_signal = "SIGINT"
kill_timeout = 5

[processes]
web = "gunicorn appname.wsgi --log-level 'info'"
worker = "celery -A appname worker -l INFO"
beat = "celery -A appname beat -l INFO"

[build]
  builtin = "python"

[deploy]
  release_command = "sh release.sh"

[experimental]
  allowed_public_ports = []
  auto_rollback = true

[[services]]
  processes = ["web"]
  http_checks = []
  internal_port = 8080
  protocol = "tcp"
  script_checks = []

  [services.concurrency]
    hard_limit = 25
    soft_limit = 20
    type = "connections"

  [[services.ports]]
    handlers = ["http"]
    port = 80

  [[services.ports]]
    handlers = ["tls", "http"]
    port = 443

  [[services.tcp_checks]]
    grace_period = "1s"
    interval = "15s"
    restart_limit = 6
    timeout = "2s"

Is there something special that I need to do to expose Fly Secrets to all of my processes? Does it differ in any way from just setting variables in [env]?

I ask because:

When I specify a SECRET_KEY variables locally on my computer in the env block and then deploy it all three instances get the variable and work fine

With that working, I moved on to trying to deploy via a Github Action, good docs around that too BTW, and moved all my sensitive values from the [env] block into the Fly Secrets.

However, this appears to not work, as my celery beat process cannot find the SECRET_KEY variable now. but my main app instance can.

I sshed into my worker instance and my app instance and listed their environment variables and both had a SECRET_KEY set. I would check the Beat instance in the same way but cannot SSH into as the deployment fails and gets rolled back, I guess I probably could disable health checks and then SSH in?

Thanks for your help!

2 Likes