fly.ioにデプロイしたときに以下のようなエラーに遭遇しました。このエラーの解決法を紹介させていただきます。
・・・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)
・・・ nrt [info] [ 2.598432] Out of memory: Killed process 334 (compile) total-vm:1379336kB, anon-rss:142832kB, file-rss:0kB, shmem-rss:0kB, UID:0 pgtables:412kB oom_score_adj:0
解決法
修正後は以下のとおりです。
fly.tomlのmemoryを512mbに増やしました。当初はmemoryを256mbとしていました。上記のエラーに「Out of memory」と記載されているようにメモリー不足が原因のようでした。
fly.toml
app = APP_NAME
primary_region = 'nrt'
[build]
[http_service]
internal_port = 8080
force_https = true
auto_stop_machines = false
auto_start_machines = true
min_machines_running = 0
processes = ['app']
[[vm]]
memory = '512mb'
cpu_kind = 'shared'
cpus = 1
1個目のエラーの「instance refused connection」に固執してportを変更するなど色々試すもうまくいかず解決に時間がかかってしまいました...。
なお、修正前のfly.tomlは以下の内容です。
fly.toml
app = APP_NAME
primary_region = 'nrt'
[build]
[http_service]
internal_port = 8080
force_https = true
auto_stop_machines = false
auto_start_machines = true
min_machines_running = 0
processes = ['app']
[[vm]]
memory = '256mb'
cpu_kind = 'shared'
cpus = 1