go-spatial / tegola

Tegola is a Mapbox Vector Tile server written in Go
http://tegola.io/
MIT License
1.26k stars 193 forks source link

Viewer not built in `v0.15.x` branch #825

Closed flowrean closed 2 years ago

flowrean commented 2 years ago

Hi

When I build from source based on the v0.15.x branch, the embedded viewer does not seem to work. I see a blank page with a single link .keep instead of the fully functional UI I am used to seeing (using the latest Docker image v0.14.0).

Looking at the branches, this is probably due to the four commits that are in the master branch and the v0.14.0 release, but not in the v0.15.x branch. Maybe master should be merged into v0.15.x?

iwpnd commented 2 years ago

You can include the ui this way. @flowrean

flowrean commented 2 years ago

@iwpnd Actually I am building a Docker image. It should include the UI, right? From the master branch at tag v0.14.0, the UI works, but in v0.15.x it doesn't. Do you know of a reason v0.15.x was not based on the most recent commit from master?

ARolek commented 2 years ago

@flowrean I think this is related to the PR: https://github.com/go-spatial/tegola/pull/801. I re-opened that PR as there seems be a regression that I have not tracked down quite yet. What version of Go are you using? I think you're going to need to have npm installed and then run go generate ./... from the repo root to build the ui.

iwpnd commented 2 years ago

I can confirm the issue as I encountered the same forking v0.15.0 branch for my test image. @ARolek Following the guide in /ui fixed the issue and I was able to include it.

flowrean commented 2 years ago

I think this is related to the PR: #801.

Ah yes, it seems something strange happened there.

What version of Go are you using? I think you're going to need to have npm installed and then run go generate ./... from the repo root to build the ui.

I am using Go 1.17.6. When running go generate ./... the npm run build errors for me but it is really a Docker image I am interested in. After merging master into v0.15.x locally, the UI indeed seems fixed in the image built from the Dockerfile in the repo root.

iwpnd commented 2 years ago

Don't bother with master as it is not the default branch of this project and is a couple of commits behind right now. If you want your image to have a ui, build it as I posted, then build the image. Since the Dockerfile copies everything in the workdir over prior to building tegola, the ui will be included.

ARolek commented 2 years ago

Thanks for chiming in @iwpnd! We will make this easier going forward.

flowrean commented 2 years ago

Thanks for your fast replies!

I tried to follow the guide, but the npm run build step fails:

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './2020/CreateDataProperty' is not defined by "exports" in /Users/flowrean/go/src/github.com/go-spatial/tegola/ui/node_modules/es-abstract/package.json

I don't have much experience with JS and wouldn't know what I could be doing wrong here, the instructions seem pretty straightforward.

I'm still a bit confused about the branches too. Master is indeed several commits behind, but it is also a few commits ahead.

iwpnd commented 2 years ago

I'm following the instructions to the point and do not run into issues. It's safe to delete the node_modules directory and the package-lock.json and re-run npm install.

Again, don't worry about master. v0.15.x is the master/main of this repository. Think of it like a development branch only that you don't (necessarily) merge it in master in the end. Every new commit goes towards the v0.15.0 version. Once the maintainers bump the minor version and officially release 0.15.0, the default branch will probably change to v0.16.x.

flowrean commented 2 years ago

When I follow the instructions literally, go-bindata cannot be found.

I can't help but notice some things related to go-bindata changed in this commit that is in v0.14.0 but not in v0.15.x: caf3fa8. Sorry to start about this again. I do understand the branching strategy but don't understand this:

Screenshot 2022-02-03 at 11 14 27

Here are the steps I found that eventually made it work:

rm -rf ui/package-lock.json ui/node_modules  # package-lock.json that is checked in won't do
go install -mod=vendor github.com/jteeuwen/go-bindata/go-bindata
go generate ./...
docker build -t tegola --build-arg VERSION=97ebfc0 .

So now the UI is included in the image. Thanks for the help!

flowrean commented 2 years ago

My problem is solved but I'm leaving the issue open in case some changes should be done in the repo. Feel free to close it of course.

ARolek commented 2 years ago

@flowrean thanks. Yeah the whole go-bindata part of this is a legacy artifact until we drop go 1.16 support. The PR I referenced addresses a build issue that users encounter when they're using Go 1.17+ which doesn't need go-bindata but instead uses go embed.

iwpnd commented 2 years ago

Can confirm the missing ui in gospatial/tegola:edge so I suspect it will also be missing on release of v0.15.0. :/

iwpnd commented 2 years ago

I tracked it down to this commit 1f3156. Prior to that ui would be included.

ARolek commented 2 years ago

This is fixed in this pr: https://github.com/go-spatial/tegola/pull/843