Skip to main content

Okay, So.

Render decided to stop rendering (Ba-Dum-Tss) my website a few months ago.

I noticed this problem on another site I built with the Blowfish theme but deployed on Cloudflare pages.

Apparently, that’s due to the theme’s dependencies; specifically Hugo version as that’s what builds the site.

I figured I could set HUGO_VERSION as an environment variable which Cloudflare automatically picked up—like its supposed to!

But render said, NOPE. I DON’T RECOGNIZE THAT SHIT.

Well, it didn’t actually say that, but you get the point right?

Then the hunt began.

I found myself surfing forums, climbing mountains, jumping over volcanoes, swimming to the shores of neverland to find answers! ANSWERS! on how to make Render render!

So, eh.

I found this guy and it pretty much solved the mystery for me.

I realized Render doesn’t actually know what to do with the environment variable I set because, well, nothing in the config files or even the build command uses it’s value.

So.

I took that guy up there, and customized it to fit my needs.

But first, I frantically searched through Blowfish’s releases for any sign of dependencies that needed to be loaded upfront.

Then I thought to myself, wait, that’s kinda stupid because Render did that automatically already

I knew all I had to change was hugo’s version as Blowfish (currently) only supports hugo v0.150.0 -> v0.151.0.

So, I did the thing. Edited that guy up there to just this guy down here:

services:
    - type: web
      name: afterhours
      repo: https://gitlab.com/Clue-ess-coder/afterhours
      runtime: static
      buildCommand: chmod a+x build.sh && ./build.sh
      staticPublishPath: public
      envVars:
          - key: HUGO_VERSION
            value: 0.151.0
#!/usr/bin/env bash

main() {

  # Install Hugo
  echo "Installing Hugo ${HUGO_VERSION}..."
  curl -sLJO "https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.tar.gz"
  mkdir -p "${HOME}/.local/hugo"
  tar -C "${HOME}/.local/hugo" -xf "hugo_extended_${HUGO_VERSION}_linux-amd64.tar.gz"
  rm "hugo_extended_${HUGO_VERSION}_linux-amd64.tar.gz"
  export PATH="${HOME}/.local/hugo:${PATH}"
  
  # Build the site
  echo "Building the site..."
  hugo --gc --minify --baseURL "${RENDER_EXTERNAL_URL}"

}

set -euo pipefail
main "$@"

And that did it!

Honestly, I hate how the deployment process just became a tiny little bit more complicated, but the truth is (whispers) this is actually better on the longrun. LOL.

I see why Hugo might have officially decided to do it this way.

Reply by Email