Deploy discord bot to fly?

I’d like to deploy my discord bot to fly. It’s written in node and I don’t have a docker container. It’s not a server so there’s no reason to open up any ports for web traffic. What are some changes I should make the to fly.toml to optimize for this? Here’s the default that I got when running fly init and selecting “node.js”:

# fly.toml file generated for kcd-discord-bot on 2021-07-06T14:22:54-06:00

app = "kcd-discord-bot"

kill_signal = "SIGINT"
kill_timeout = 5

[build]
  builtin = "node"

[env]

[experimental]
  allowed_public_ports = []
  auto_rollback = true

[[services]]
  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"

All you should need to do here is knock off the services (when you register a service in your fly.toml, we try to make sure it’s alive, and restart your vm if it isn’t). I have a whole bunch of instances like this that are just a Dockerfile and an almost-empty fly.toml (you can still use stuff like flyctl secrets and the [env] section, of course).

Sweet! Thanks. With Heroku, I can view the logs online and that was nice sometimes. I don’t think fly currently has an online view of logs is that right?

No but that + more metrics are the first two things we’re doing when we start working on the UI again. We’re, like, one hire away from that. :slight_smile:

You can stream your logs to something like LogDNA right now.

1 Like