Post

[Tutorial 2] How to deploy on Cloudflare

This is a suggested way of deploying your Hydrotion blog.

Before you start, make sure you have a Cloudflare account, free tier would works, and also a github account.

Step 1:

Clone https://github.com/dreambulare/hydrotion to your Github repository.

Step 2:

Goes to https://dash.cloudflare.com/70969096462d3f0c9974c059d3bccd7e/workers-and-pages and click on “Create Application” button.

Step 3:

Click on “Continue with Github”

Step 4:

Select the repo cloned on step 1.

Step 5:

  • Build command: pnpm opennextjs-cloudflare build
  • Deploy command: pnpm opennextjs-cloudflare deploy -- --keep-vars

Step 6:

Then cloudflare will start building, but it will fail due to environment variable not set, but no worries, goes to “Settings”

At “Variables and Secrets” area, click on “Add”

Set following variables:

Variable nameTypeValue
NOTION_TOKENSecretthe token you get from tutorial 1
HYDROTION_REFRESH_SECRETSecretyou could input random texts
NOTION_DATABASE_IDTextthe URL of your database created on Notion
HYDROTION_REVALIDATE_SECONDSTextcontent update period in seconds, can set it to 3600
HYDROTION_CACHE_PROVIDERText“cloudflare”
HYDROTION_MEDIA_PROVIDERText“cloudflare”

Then click on “Deploy”

Step 7:

Then click on “Latest build failed”, then click on “Retry build”

Then this build should works.