, 2 min read

Hosting Static Content with DigitalOcean

I wrote about hosting static sites on various platforms:

  1. Hosting Static Content with surge.sh
  2. Hosting Static Content with now.sh, now.sh renamed themself to vercel.app
  3. Hosting Static Content with netlify.app
  4. Hosting Static Content with Cloudflare
  5. Hosting Static Content with Neocities
  6. Hosting Static Content with GitLab
  7. Hosting Static Content with GitHub

DigitalOcean offers what they call "App Platform". It is a "Platform-as-a-Service (PaaS)". They have "apps" for React, Django, Go, Jekyll, Next.js, Python, Ruby, Hugo, TypeScript, Hexo, PHP, Node.js, Gatsby, and some others.

Here, I confine myself to the "Sample App for Static HTML Assets". I only show how to use GitHub as source for static files. GitLab would be totally similar.

1. Steps to setup. Here are the steps to create a static site on DigitalOcean.

  1. Go to "App Platform"
  2. Click "Create App"
  3. Select one of the repositories, GitHub in this case

  1. Provide access to your GitHub account, if you haven't done so
  2. Choose proper GitHub repo

Whenever changes in the GitHub repo, or you change the settings in DigitalOcean, you initiate a new build.

Unfortunately, the name used for DNS, here eklausmeier-5257s.ondigitalocean.app cannot be changed. It is partly autogenerated.

2. Build configuration. The default build configuration for static sites is:

lerts:
- rule: DEPLOYMENT_FAILED
- rule: DOMAIN_FAILED
features:
- buildpack-stack=ubuntu-22
ingress:
  rules:
  - component:
      name: eklausme-github-io
    match:
      path:
        prefix: /
name: eklausmeier
region: fra
static_sites:
- environment_slug: html
  github:
    branch: master
    deploy_on_push: true
    repo: eklausme/eklausme.github.io
  name: eklausme-github-io
  source_dir: /

3. Limitations. DigitalOcean does have some annoying limitations. My blog cannot be fully hosted on the DigitalOcean app. If I remove all images then DigitalOcean can host it. So it seems there is some undocumented limit on the number of files.

In the free version you can only have up to three apps.