How to setup multiple service for http and ws

Inside the docker image, I run multiple server.

  1. http runs on port 8080
  2. ws runs on port 8181

How do I set the services on my fly configuration?

1 Like

I think you can have multiple service entries in your fly config
something like

[[services]]
  internal_port = 8080
  processes = ["app"]
  protocol = "tcp"

  [services.concurrency]
    ...

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

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

[[services]]
  internal_port = 8181
  processes = ["app"]
  protocol = "tcp"

  [services.concurrency]
    ...

  [[services.ports]]
    port = 8181

Although I’m not sure if you want to run ws server on “non-standard” ports like 80 and 443, if those are 2 different servers maybe split them into 2 apps?

2 Likes

Would you please share what is the concern here to split into 2 apps? I am on the same question.