Miscellaneous Findings I

This is a roundup of miscellaneous things that I’ve found out about (or have rediscovered). I take notes on findings regularly, and I put the findings that translate well to speech on my podcast, Small Findings. The rest (which are often technical findings), I put here. They’re not always written up for maximum comprehension as a blog post, but if anything is hard to understand, please email me if you need clarification.

Coca-cola

Coca-Cola says in-premise (restaurant) sales are 40% of its industry.

#business

Darklang

It’s a language and environment and deployment platform for writing backends. It has quite a few impressive future-of-programming style features such as:

  • Being able to re-run code execution traces with edits
  • Knowledge of which functions have side effects and which don’t
  • Live evaluation

Fascinating.

However:

  • You cannot run Dark locally, nor anywhere other than on their servers.
  • They promise that if they go out of business that they’ll open source Dark (but do not promise they’ll help you get that source running).
  • They will do an automated conversion to Go or Node if you want to leave (no guarantees about how well it will work)

#programming #business

Netlify

Recently I looked into Netlify because I’ve heard a lot of good things about it, and it appeared to be the rare CDN that gives access to logs, so you know what’s being delivered via the CDN.

What is Netlify

To back up a second, let’s talk about what Netlify is. Netlify is a hosting service that provides a way to deploy straight from wherever you keep your code to their CDN. It provides things to make this possible, like triggers that build your code on deploy. The ideal experience they’re trying to make happen is: You update the code for your static site or single-page app on your computer. Then, you push it to GitHub. Then, Netlify builds it and takes it to the CDN. Instant web site update.

Gaps

However, I learned that there are several things it doesn’t do. It’s not meant to be a replacement for a general-purpose CDN.

For example, if you have your site and apps arranged like this:

Home page: jimkang.com/ App 1: jimkang.com/smallfindings App 2: jimkang.com/observatory Site 1: jimkang.com/weblog

Let’s say you have a different GitHub repo for each one of those sites.

Netlify does not support building subdirectories of a site via several different directories. You’d have to have an enormous monorepo containing everything.

I’ve seen people recommend working around this by:

  • Putting coolgame contents in a separate coolgame Netlify site.
  • Creating a rewrite rule in yourdomain.com‘s _redirects Netlify file that rewrites /coolgame to https://coolgame.netlify.app so that when the browser asks form yourdomain.com/coolgame, it thinks it’s getting that, but Netlify actually serves coolgame.netlify.app.

    /coolgame/* https://coolgame.netlify.app/:splat 200

I’ve seen this recommended:

This doesn’t work when you go to https://yourdomain.com/coolgame without a trailing slash, though. You’ll get the right index.html, but all of the files it references that are expected to be in the same directory will be loaded from yourdomain.com, not coolgame. If you go to https://yourdomain.com/coolgame/ with a trailing slash, it will load the referenced files from coolgame.

If this was nginx, you could get around it by adding a redirect to go to the URL with a trailing slash.

However, you can’t write a rule like that with _redirects. Their CDN nodes do URL normalization before the redirect rules are applied. So, the matching part of rules that use trailing slashes are the same as those that don’t. If you tried to match /coolgame, the rule would also match /coolgame/, resulting in an infinite redirect.

Instead, their docs tell you about a Pretty URLs setting, which is supposed to forward clients to the trailing slash version of the URL, but it appears to not work at all.

I’ve seen someone recommend adding JS to every page that’s in a subdirectory to redirect to ‘/‘, but that’s dozens of pages for me.

Apparently, even if you decided to use subdomains instead of subdirectories to avoid this problem, but it’s not meant to do that, either.

It also does not want you to use a “naked” domain — e.g. it like something.yourdomain.com, but will only support yourdomain.com if your DNS provider supports ALIAS records. For me, this is a showstopper.

Dev experience

Netlify, the web app you use to configure your Netlify sites, is Chrome-first. If you drag a folder onto Want to deploy a new site without connecting to Git? Drag and drop your site folder here, it’ll crash the Firefox tab.

Bizarre stuff happens when you try to scroll through their docs site in Firefox. Every so often, it’ll just jump back while you scroll down.

What’s good, though?

The deploys are indeed fast. The experience is probably great if you have a single site on there or can use something.netlify.app URLs.

If there is indeed no other CDN that will let you get at access logs, maybe I will end up biting the bullet and going with Netlify.

#hosting #rewrite #proxy #business #internet