Leaving already
14 August 2024Not that long ago I was trying out Google's App Engine for hosting of static website but as soon as I had uploaded place-holder pages for my Taispeaint and Leictreonach I came to the conclusion that App Engine was not an ideal solution with Cloudflare Pages being a far superior solution for my needs. The most immediate problem is App Engine projects needing to be attached to billing accounts and Google has a default limit of five projects, but the killer was irritations with how pages are deployed. This is both push and pull as Cloudflare was already being one of my two DNS providers so things like updating DNS records with what is needed are done automatically, and about all it is de-jure free rather than de-facto free.
To be fair to Google I am currently trying out App Engine for my Flask-based D'Hondt website and so for I am happy with how it is doing, although I wanted to give it a full month to see how close it comes to the paid-for threshold for compute resources before posting a review of it. Cloudflare Pages seems to support some sort of server-side dynamic content but at this time have not even tried looking into the latter's flexibility nor ease-of-use.
(Added 2 September 2024): For something like D'Hondt.eu which is a low-traffic microsite based on Flask, Google's App Engine would be hard to beat. AWS or Azure might be better but with App Engine only costing 1¢ so far I see little scope for alternatives being anything other than an exchange of one set of quirks for another.
Yaml headaches
Google App Engine uses anapp.yaml
file to decide what to deploy and while it picks up entire directories fine I saw no obvious way to get it up pick up certain files based on a regular expression.
I tried things like the following in other to snaffle all the PNG graphics files but they did not need to work, so I ended up listing all files in the root folder explicitly, which give the number of files these micro-sites actually have is not really a big deal, but it leaves the impression that App Engine was not really designed for this sort of thing.
handlers: - url: / static_files: index.html upload: index.html - url: /(\*\.png) static_files: \1 upload: (\*\.png)
Cloudflare Pages deployment
Cloudflare Pages provides various ways to deploy website content which includes its own equivilent of Google'sgcloud
command-line tool but by far the most convenient method is to attach a GitHub repository.
Cloudflare sets itself as an automated build so when content is pushed it is fairly quickly picked up and made live automatically;
the free tier is limited to 500 builds per month but that is ample for a handful of micro-sites that might be updated twice per year.
It is also possible to upload content via a web interface but have not checked it out, so do not know if it supports things like downloading deployed files — most likley does but have not checked.
Interestingly Cloudflare provides URLs for individual commits so it is easy to see past versions.
Cloudflare buckets
The equivalent of Google Buckets is Cloudflare R2 and like many Google Cloud services R2 requires creation of a billing account, but billing only starts once quite generous limits. Ten gigabytes per month and a limit on “operations” that is counted in the millions, with outbound traffic being unlimited. I have yet to find a way of making directory listings rather than just the files themselves public, but I have read hints that directory listing might be a paid-tier perk.Upload via command-line tool
Cloudflare's command-line tool which is equivalent of Google'sgcloud
is called Wrangler which is installed & run using Node.js npm
tool.
On Slackware Node.js is is available from AlienBob's repository and at time of writing is built from the not-too-old v20.13.0 released a few months ago.
The following pretty much sums up the commands:
npm install wrangler export PATH=$PATH:~/node_modules/.bin wrangler login wrangler r2 object put rahorton-net/${file} --file=${file} wrangler logout
Far as I can tell wrangler
does not do uploads of entire directories but there are other tools that do.
Upload via RClone
While RRlone is a third-party tool that uses the S3 API it is supported by Cloudflare and allows for various operations such as creating sub-directories that the web-based interface does not. One interesting feature is “pre-signed URLs” which is a time-limited public link. On Slackware is is available from SlackBuilds and seems to be modelled after the standard Unix file commands. Unfortunately at time of writing RClone with Cloudflare is clearly broken as a bucket I have uploaded files to is not showing up withrclone tree r2:
even though the files themselves are downloadable via a web-browser.
I suspect this is a recurrent problem with their authentication tokens although I am unsure whether to blame RClone or Cloudflare.
Upload via S3cmd
I gave up on RClone and instead tried S3cmd which is a Python program available via PIP and is fairly easy to get up and running, but more importantly actually works. A nice touch is it told me about needing--recursive
and needing a trailing slash when uploading entire directories.
I did not dive deep into what else it can do but it did the one thing that was essential, and that is the bulk upload of files.
One thing to watch out for — there seems to be issues with limiting access via IP addresses when getting access tokens from Cloudflare, which could be down to it trying IPv6 and not falling back to the IPv4 address of the gateway.