Following the docs to create a static website

Hello,
I am trying to follow the docs on Create a static website on Fly to create a static website. I have cloned the repo as proposed, then generate the fly.toml file using flyctl launch. Finally, the docs mention that I need to run fly deploy. When I run it I get the following:

C:\progr\html\hellostatic-builtin>flyctl deploy
Deploying winter-river-1745
==> Validating app configuration
--> Validating app configuration done
Services
TCP 80/443 ⇢ 8080

Error app does not have a Dockerfile or buildpacks configured. See https://fly.io/docs/reference/configuration/#the-build-section

I understand that a Dockerfile is missing however no Dockerfile is mentioned anywhere in that particular tutorial. So probably the create static website tutorial needs updating (or I am missing something)?

Thanks

I also tried following the docs to deploy a python website (Build, Deploy And Run A Python Application). This tutorial has exactly the same problem (no Dockerfile). Maybe some configuration is missing to configure fly to use a buildpack instead of docker?

I’m using the latest flyctl version:

(venv) C:\progr\python-hellofly-flask>flyctl version
flyctl.exe v0.0.247 windows/amd64 Commit: 8068b7f BuildDate: 2021-10-11T16:25:15Z

When generating the fly.toml file using flyctl, it’ll usually ask you which builder to use and present you with a list. One of those options should have been a builder called static. Was that the one that was chosen? That should/would have configured your fly.toml to use one of the Dockerfiles managed by Fly.

1 Like

Hello @sudhir.j thank you for answering. I deleted my fly.toml and run flyctl launch again to display the output:

C:\progr\html\hellostatic-builtin>flyctl launch
Creating app in C:\progr\html\hellostatic-builtin
Scanning source code
Could not find a Dockerfile, nor detect a runtime or framework from source code. Continuing with a blank app.
? App Name (leave blank to use an auto-generated name):
Automatically selected personal organization: Serafeim Papastefanos
? Select region: lhr (London, United Kingdom)
Created app dry-meadow-9284 in organization personal
Wrote config file fly.toml

As you see nowhere it asks for builder! I am using the latest flyctl version.

Good point! I just checked as well, I don’t see it. Let’s see if the team has updates about this.

1 Like

Hey all! Sorry for the confusion about this. Our docs are wrong - we’ll get them fixed up!

We removed the option to select our internal ‘builders’ because we felt they were not transparent enough. We’d like it to be easy to work from a template and tweak it. That said, we don’t have an official answer yet for static sites.

Builtins should still work, for now, so you add the static one to your fly.toml like this:

[build]
  builtin = "static"

To expand a bit on static site hosting: we also have a statics fly.toml section built for this. So Fly would serve your static assets directly without the need for a web server at all.

Are you using a static site generator? If so, which one?

1 Like

Hello @joshua thanks for replying. Using the static builder you mentioned worked fine to deploy the static website (https://dry-meadow-9284.fly.dev/), however it doesn’t work with the python-flask example (it pushes all files in the directory and serves them, like this: https://cool-waterfall-513.fly.dev/).

I don’t use any static site generator, I just followed the tutorial.

Could you give me a ping when the python and static docs are updated so I can check again if it works ?

Thanks !

The Python site will need to use the Python builtin, think it’s just called python. So that would probably be

[build]
  builtin = "python"

You’d probably not want to use the builtin for Python, though, not sure whether it’s 2 or 3 and I’ve heard that might make a difference :smiley:

Thanks @sudhir.j I’ll try it tomorrow at work!

I tried it using the builtin = "python" as recommended by sudhir and it works now!

However I still believe that the documentation needs to be updated to reflect changes in the flyctl latest versions.

1 Like