Same as this unanswered post: How to setup a service/process app that never shuts down
My question is: how do you correctly set up a service in fly.io that should not be publicly accessible
I’ve got a service (cron
) that is not meant to be accessed at all. But every time I deploy I get this warning:
WARNING: Service must expose at least one port. Add a [[services.ports]] section to fly.toml; Check docs at https://fly.io/docs/reference/configuration/#services-ports
Validation for _services without ports_ will hard fail after February 15, 2024.
My fly.toml is the following:
app = "<redacted>"
primary_region = "ord"
[env]
SERVER_PORT = "3000"
WEBHOOK_SERVICE_PORT = "3030"
[deploy]
release_command = "bunx prisma migrate deploy && bunx prisma generate"
[processes]
api = "bun run start:main"
webhooks = "bun run start:webhooks"
cron = "bun run start:cron"
[http_service]
internal_port = 3000
force_https = true
auto_stop_machines = true
auto_start_machines = true
min_machines_running = 1
processes = ["api"]
[http_service.concurrency]
type = "requests"
hard_limit = 250
soft_limit = 200
[[services]]
processes = ["webhooks"]
internal_port = 3030
protocol = "tcp"
auto_stop_machines = true
auto_start_machines = true
min_machines_running = 0
[[services.ports]]
handlers = ["http"]
port = 8080
force_https = true
[[services.ports]]
handlers = ["tls", "http"]
port = 448
# min config to ensure the cron service never shuts down
[[services]]
processes = ["cron"]
internal_port = 3333
protocol = "tcp"
auto_stop_machines = true
auto_start_machines = true
min_machines_running = 1