Hello community,
I am trying to deploy a python discord bot, but running into the error
v3 failed - Failed due to unhealthy allocations - no stable job version to auto revert to and deploying as v4
Any help would be greatly appreciated
Docker file:
FROM python:3.10
WORKDIR /happy
COPY requirements.txt /happy/
RUN pip install -r requirements.txt
COPY . /code
CMD python happy.py
fly.toml
# fly.toml file generated for happy on 2022-12-07T06:32:21Z
app = "happy"
kill_signal = "SIGINT"
kill_timeout = 5
processes = []
[build]
builder = "paketobuildpacks/builder:base"
[env]
PORT = "8080"
[experimental]
allowed_public_ports = []
auto_rollback = true
[[services]]
http_checks = []
internal_port = 22
processes = ["app"]
protocol = "tcp"
script_checks = []
[services.concurrency]
hard_limit = 25
soft_limit = 20
type = "connections"
[[services.ports]]
force_https = true
handlers = ["http"]
port = 80
[[services.ports]]
handlers = ["tls", "http"]
port = 443
[[services.tcp_checks]]
grace_period = "1s"
interval = "15s"
restart_limit = 0
timeout = "2s"
Check your app’s logs for more detailed error info: flyctl logs
.
Generally, Discord bots in Python don’t listen on a HTTP port. If yours does, take a look at flyctl logs
; otherwise, removing [[services]]
and everything below it should fix the issue.
Hey Lilian!
I can’t really make head nor tail of the logs
2022-12-07T06:51:15Z runner[459fe096] lhr [info]Starting instance
2022-12-07T06:51:16Z runner[459fe096] lhr [info]Configuring virtual machine
2022-12-07T06:51:16Z runner[459fe096] lhr [info]Pulling container image
2022-12-07T06:51:21Z runner[459fe096] lhr [info]Unpacking image
2022-12-07T06:51:27Z runner[459fe096] lhr [info]Preparing kernel init
2022-12-07T06:51:28Z runner[459fe096] lhr [info]Configuring firecracker
2022-12-07T06:51:28Z runner[459fe096] lhr [info]Starting virtual machine
2022-12-07T06:51:28Z app[459fe096] lhr [info]Starting init (commit: f447594)...
2022-12-07T06:51:28Z app[459fe096] lhr [info]Preparing to run: `/cnb/process/web` as 1000
2022-12-07T06:51:28Z app[459fe096] lhr [info]2022/12/07 06:51:28 listening on [fdaa:0:fb7f:a7b:2808:459f:e096:2]:22 (DNS: [fdaa::3]:53)
2022-12-07T06:51:29Z app[459fe096] lhr [info]Starting clean up.
2022-12-07T06:51:36Z runner[459fe096] lhr [info]Starting instance
2022-12-07T06:51:36Z runner[459fe096] lhr [info]Configuring virtual machine
2022-12-07T06:51:36Z runner[459fe096] lhr [info]Pulling container image
2022-12-07T06:51:36Z runner[459fe096] lhr [info]Unpacking image
2022-12-07T06:51:36Z runner[459fe096] lhr [info]Preparing kernel init
2022-12-07T06:51:37Z runner[459fe096] lhr [info]Configuring firecracker
2022-12-07T06:51:37Z runner[459fe096] lhr [info]Starting virtual machine
2022-12-07T06:51:37Z app[459fe096] lhr [info]Starting init (commit: f447594)...
2022-12-07T06:51:37Z app[459fe096] lhr [info]Preparing to run: `/cnb/process/web` as 1000
2022-12-07T06:51:37Z app[459fe096] lhr [info]2022/12/07 06:51:37 listening on [fdaa:0:fb7f:a7b:2808:459f:e096:2]:22 (DNS: [fdaa::3]:53)
2022-12-07T06:51:38Z app[459fe096] lhr [info]Starting clean up.
It will relaunch 3 times before aborting, my python script is using Discord API and OpenAI so do I need ports for that?
Thanks in advance
Ah, it looks like the app is running /cnb/process/web
instead of your Python file. This is (I think) because of the builder
you have set up - removing the [build]
section will default to building and running as specified in your Dockerfile.
By the way, I noticed in the Dockerfile you copied your bot’s Python files to /code
, but the working directory (WORKDIR
) is still /happy
. That won’t work, the files need to be in the working directory to be able to be found. You could copy the files to /happy
or add a WORKDIR /code
command before CMD
.
1 Like
Lillian!
You are a wonderful human!
Thank you so much for your help and time!