Gleamをfly.ioにデプロイするときはinterfaceを指定する

2025/01/19に公開

結論

mist.bind/2を指定して0.0.0.0でリクエストを受け付けるようにする必要があるようです(Dockerfile側での解決方法もあると思います)

https://github.com/yellowsman/my_web_app/blob/main/src/my_web_app.gleam

https://gleam.run/deployment/fly/

fly logsで表示されたログ

2025-01-18T16:54:47Z proxy[7811007b49d678] nrt [error][PC01] instance refused connection. is your app listening on 0.0.0.0:8080? make sure it is not only listening on 127.0.0.1 (hint: look at your startup logs, servers often print the address they are listening on)
2025-01-18T16:54:48Z proxy[d8dd79dc247038] nrt [error][PC01] instance refused connection. is your app listening on 0.0.0.0:8080? make sure it is not only listening on 127.0.0.1 (hint: look at your startup logs, servers often print the address they are listening on)
2025-01-18T16:54:58Z proxy[7811007b49d678] nrt [error][PC01] instance refused connection. is your app listening on 0.0.0.0:8080? make sure it is not only listening on 127.0.0.1 (hint: look at your startup logs, servers often print the address they are listening on)
2025-01-18T16:54:59Z proxy[d8dd79dc247038] nrt [error][PC01] instance refused connection. is your app listening on 0.0.0.0:8080? make sure it is not only listening on 127.0.0.1 (hint: look at your startup logs, servers often print the address they are listening on)

Discussion