Issues with deploying on DO App Platform

Hi there.

I’ve just started using Hugo last week, and I spent a few days putting together a site using 0.113.0 extended locally, using VS code with WSL2, working with modules, making sure it all worked locally, troubleshooting, etc. We have a pretty nice site if I do say so myself, and it all runs really well locally.

I went to deploy this afternoon on DigitalOcean using App Platform and ran into an issue. I’m pretty sure I’m not to blame, because the same site deploys on Cloudflare Pages - except Cloudflare Pages doesn’t support Hugo extended, so none of the fancy stuff works.

The problem is that if I deploy from the Github repo with the go.mod file in the repo, App Platform doesn’t recognise the deployment as Hugo, just as a Go deployment and uses the Go Buildpacks. I get this in the logs:

[2023-06-19 11:21:30] ╭──────────── app build ───────────╼
[2023-06-19 11:21:33] │ -----> Fetching jq... done
[2023-06-19 11:21:34] │ -----> Fetching stdlib.sh.v8... done
[2023-06-19 11:21:34] │ -----> 
[2023-06-19 11:21:34] │        Detected go modules via go.mod
[2023-06-19 11:21:34] │ -----> 
[2023-06-19 11:21:34] │        Detected Module Name: github.com/robotsmakegames/robotsmakegames.com
[2023-06-19 11:21:34] │ -----> 
[2023-06-19 11:21:34] │ -----> New Go Version, clearing old cache
[2023-06-19 11:21:34] │ -----> Installing go1.17.13
[2023-06-19 11:21:59] │ -----> Fetching go1.17.13.linux-amd64.tar.gz... done
[2023-06-19 11:22:00] │ -----> Determining packages to install
[2023-06-19 11:22:00] │ go: warning: "./..." matched no packages
[2023-06-19 11:22:00] │  !!    
[2023-06-19 11:22:00] │  !!    No main packages found in module github.com/robotsmakegames/robotsmakegames.com
[2023-06-19 11:22:00] │  !!    
[2023-06-19 11:22:00] │  !!    Unsure what package(s) to install, defaulting to '.'
[2023-06-19 11:22:00] │  !!    
[2023-06-19 11:22:00] │  !!    Installing package '.' (default)
[2023-06-19 11:22:00] │  !!    
[2023-06-19 11:22:00] │  !!    To install a different package spec add a comment in the following form to your `go.mod` file:
[2023-06-19 11:22:00] │  !!    // +heroku install ./cmd/...
[2023-06-19 11:22:00] │  !!    
[2023-06-19 11:22:00] │ -----> Running: go install -v -tags heroku . 
[2023-06-19 11:22:00] │ no Go files in /workspace
[2023-06-19 11:22:00] │ ERROR: failed to build: exit status 1
[2023-06-19 11:22:00] │ 
[2023-06-19 11:22:00] │ 
[2023-06-19 11:22:00] │ For documentation on the buildpacks used to build your app, please see:
[2023-06-19 11:22:00] │ 
[2023-06-19 11:22:00] │    Go  v0.172.4  https://do.co/apps-buildpack-go
[2023-06-19 11:22:00] │ 
[2023-06-19 11:22:00] │  ✘ build failed

However, obviously, if I build without go.mod, then App Platform picks up config.yaml, recognises it as a Hugo projects, brings in the Hugo Buildpacks but spits out the error about the module being missing. Which is correct behaviour. I know that much.

Unfortunately, I’m not very familiar with any of this, and that goes for App Platform too. I just took a few days out to learn it to set the site up. Is this a DO problem, and if it is, does anyone know a workaround for this? Or is this just a me problem I’m not able to identify? It seems like App Platform just sees go.mod and tries to use the Go Buildpacks and fails.

Again, site is working locally, so a workaround would be to set up a Droplet and maybe do it that way - but then I lose the CD aspect of App Platform that’s really attractive. I definitely don’t know enough to use DOCR or a Docker image comfortably.

Thanks for reading. :slight_smile:

Not a solution, but Cloudflare Pages does support extended Hugo.

No, that’s incredibly helpful and definitely a solution as far as getting the site online goes! I don’t know what I missed, but it’s working on Pages now. Which means the problem isn’t with me or Hugo, it’s definitely with DO. Which would be worse if it wasn’t working on Pages, but I don’t care where it is, as long as it’s working.

Thank you so much. I can transfer the domain over later, and also now I feel slightly vindicated. :grimacing:

I did put in a support ticket for DO though. At least that wasn’t wasting anyone’s time now.

Hey I did get a reply from DigitalOcean support about the App Platform for Hugo not working though.

It basically says it doesn’t work, it is their fault, but they’re not going to fix anything. That’s fine, we’ve just moved it all to Cloudflare. :slight_smile:

Last addition, just in case anyone needs this and to be completely fair to DO. DigitalOcean got back to me again about this, and they’re now aware of the issue and plan to update the buildpacks. However, they did also provide a way of getting Hugo to work with a Dockerfile.

Create a Dockerfile in the root of the project with the following content:

FROM peaceiris/hugo:v0.113.0-mod

WORKDIR /app
COPY . /app
RUN hugo -d public

You can also use FROM peaceiris/hugo:latest-mod to use the latest version.

Create a new app, edit components, set it to a static site (it’ll default to an app with a monthly cost but the static site will be free), then set the output directory to /app/public.

They say this should work but I haven’t had time to test it. But it’s nice to see that DO are working on it.

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.