Deploying Strapi on

I am trying to get a Strapi application running on There is a PR in the Strapi repo which gives deployment instructions, so I followed them.

Bad news: they don’t work. I’ve put a comment on the PR to alert OP to this, but @lubien suggested I should ask the question here too, where more folks would see it. Here’s what looks like:

The logs say that Strapi actually starts, but then it dies again:

2022-08-14T17:02:19.541 runner[2fe10c23] lhr [info] Starting instance
2022-08-14T17:02:20.004 runner[2fe10c23] lhr [info] Configuring virtual machine
2022-08-14T17:02:20.010 runner[2fe10c23] lhr [info] Pulling container image
2022-08-14T17:02:31.785 runner[2fe10c23] lhr [info] Unpacking image
2022-08-14T17:02:48.227 runner[2fe10c23] lhr [info] Preparing kernel init
2022-08-14T17:02:48.593 runner[2fe10c23] lhr [info] Configuring firecracker
2022-08-14T17:02:48.768 runner[2fe10c23] lhr [info] Starting virtual machine
2022-08-14T17:02:48.993 app[2fe10c23] lhr [info] Starting init (commit: c86b3dc)...
2022-08-14T17:02:49.020 app[2fe10c23] lhr [info] Preparing to run: `/cnb/process/web` as heroku
2022-08-14T17:02:49.050 app[2fe10c23] lhr [info] 2022/08/14 17:02:49 listening on [fdaa:0:81f5:a7b:be65:2fe1:c23:2]:22 (DNS: [fdaa::3]:53)
2022-08-14T17:02:49.601 app[2fe10c23] lhr [info] yarn run v1.22.19
2022-08-14T17:02:49.629 app[2fe10c23] lhr [info] $ strapi start
2022-08-14T17:02:53.380 app[2fe10c23] lhr [info] [2022-08-14 17:02:53.377] info: The Users & Permissions plugin automatically generated a jwt secret and stored it in .env under the name JWT_SECRET.
2022-08-14T17:02:53.637 app[2fe10c23] lhr [info] Project information
2022-08-14T17:02:53.654 app[2fe10c23] lhr [info] ┌────────────────────┬──────────────────────────────────────────────────┐
2022-08-14T17:02:53.654 app[2fe10c23] lhr [info] │ Time │ Sun Aug 14 2022 17:02:53 GMT+0000 (Coordinated … │
2022-08-14T17:02:53.654 app[2fe10c23] lhr [info] │ Launched in │ 1640 ms │
2022-08-14T17:02:53.654 app[2fe10c23] lhr [info] │ Environment │ development │
2022-08-14T17:02:53.654 app[2fe10c23] lhr [info] │ Process PID │ 536 │
2022-08-14T17:02:53.654 app[2fe10c23] lhr [info] │ Version │ 4.3.4 (node v15.14.0) │
2022-08-14T17:02:53.654 app[2fe10c23] lhr [info] │ Edition │ Community │
2022-08-14T17:02:53.654 app[2fe10c23] lhr [info] └────────────────────┴──────────────────────────────────────────────────┘
2022-08-14T17:02:53.654 app[2fe10c23] lhr [info] Actions available
2022-08-14T17:02:53.655 app[2fe10c23] lhr [info] One more thing...
2022-08-14T17:02:53.655 app[2fe10c23] lhr [info] Create your first administrator 💻 by going to the administration panel at:
2022-08-14T17:02:53.656 app[2fe10c23] lhr [info] ┌─────────────────────────────┐
2022-08-14T17:02:53.656 app[2fe10c23] lhr [info] │ http://localhost:8080/admin │
2022-08-14T17:02:53.656 app[2fe10c23] lhr [info] └─────────────────────────────┘
2022-08-14T17:07:33.942 runner[2fe10c23] lhr [info] Shutting down virtual machine
2022-08-14T17:07:34.027 app[2fe10c23] lhr [info] Sending signal SIGINT to main child process w/ PID 516
2022-08-14T17:07:35.031 app[2fe10c23] lhr [info] Main child exited with signal (with signal 'SIGINT', core dumped? false)
2022-08-14T17:07:35.032 app[2fe10c23] lhr [info] Starting clean up. 

I’m using the .env which came with yarn create, which uses the Strapi standard port 1337. Here is the fly.toml created by fly launch, modified as directed in the proposed Strapi guide doc:

# fly.toml file generated for my-app on 2022-08-14T16:21:23+01:00

app = "my-app"
kill_signal = "SIGINT"
kill_timeout = 5
processes = []

  builder = "heroku/buildpacks:20"

  PORT = "8080"

  allowed_public_ports = []
  auto_rollback = true

  http_checks = []
  internal_port = 1337
  processes = ["app"]
  protocol = "tcp"
  script_checks = []
    hard_limit = 25
    soft_limit = 20
    type = "connections"

    force_https = true
    handlers = ["http"]
    port = 80

    handlers = ["tls", "http"]
    port = 443

    grace_period = "1s"
    interval = "15s"
    restart_limit = 0
    timeout = "2s"

The Dockerfile does indeed EXPORT 1337. I presume I should be able to reach the service on, right? That URL just hangs and then times out.

Any suggestions would be much appreciated.

Actually, it’s a mapping of pots. Your app listens to port 8080 and the setting internal_port should be 8080 so it maps it to port 80 (meaning and port 443 (meaning httpS://

Another interesting thing is that you have a dockerfile but you fly.toml has a builder. Feel free to remove this:

  builder = "heroku/buildpacks:20"
1 Like

Thank you for the quick reply! Good point about the heroku builder, I’ve removed that.

And I now understand what’s going on. You’re right, it’s a port issue. In my local .env, the PORT environment variable is set to Strapi’s usual 1337. But of course, the .env isn’t committed. In the fly.toml, I’m setting the same env var to 8080. But the Dockerfile is set to EXPORT 1337, and so Strapi is listening on a port that Docker isn’t exporting.

Once I changed PORT to 1337 too, it worked! Thanks very much for your timely help.