Custom TCP service?

Hi, I have a custom TCP server I’d like to isolate in its own machine that serves connections opened by my HTTP server. I saw some documentation about HTTP services, but I need to run at a lower level. Is there any support for this?

How about Running Fly.io Apps On UDP and TCP · Fly Docs?

2 Likes

Yes. How to configure this will depend on whether the HTTP server is run on fly.io or not, and (should the HTTP server be run on fly.io) whether both applications are included in the same docker image or are separate images.

HTTP server hosted else where

  • Either go with only an IPv6 address, or (should you need IPV4) you will need a private IPV4 address
  • In your fly.toml replace [http_service] with something like the following (feel free to pick your own port:
[[services]]
  internal_port = 2222
  protocol = "tcp"
  [[services.ports]]
    port = 2222

HTTP server hosted on fly.io

  • Leave the [http_service] and don’t add anything for the TCP server
  • Use private networking to connect your HTTP server to your TCP server. Either <process_group>.process.<appname>.internal (if included on the same image, or <appname>.internal if running as a separate app
  • If running in the same image, follow Run Multiple Process Groups in an App · Fly Docs to define two processes. If running in separate apps, launch each separately and remove the [http_service] from the fly.toml in the TCP server app.
1 Like

:+1: Appreciate it folks.

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