Skip to content

Conversation

@alekzvik
Copy link
Contributor

@alekzvik alekzvik commented Dec 8, 2024

What I am changing

I am adding a STAC Browser as an additional service.

How I did it

I am using a custom image due to complications described here
The custom image is built on CRON once daily if there are changes.

Alternatives

Another alternative is to avoid a custom image and do all the work in the initContainer. We spawn an initContainer with node that checks out the git repo on a tag, installs dependencies, builds the stac-browser, and puts the static files in a shared volume. The main container would be nginx which serves the data from the mounted volume.
Pros:

  • it is less dependent on another repo doing trickery in its actions
  • it can be much more configurable

Cons:

  • this approach is much slower. The npm install & npm build take a long time

Notes

  1. The whole approach to the STAC browser is not ideal. I mentioned in values.yaml that the preferred way to deploy the STAC browser would not be with k8s&helm, but maybe there is a better way to convey this to users.
  2. There are problems with /browser URL routing (without the trailing slash) and I have not identified the source yet.
  3. The URL is persisted in a way that does not allow to recover state. If you open a collection -> item and then reload the page, stac browser fails to recover the state.

How you can test it

helm update --install ... and one more service appears in the list of static services.
The URL is /browser/, it will point to the stac endpoint exposed at /stac

Related Issues

Closes #62

@alekzvik
Copy link
Contributor Author

alekzvik commented Dec 8, 2024

Hello, this is my first contribuiton to k8s-eoapi. Please let me know if there is anything I can improve or if you prefer the alternative approach with initContainer to avoid another dependency.

Copy link
Contributor

@pantierra pantierra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much for this PR! ❤️

Apologies for any inconvenience, but I’m not in favor of pulling the stac-browser image from a personal registry. I think we should stick to using the upstream maintainer's image. As for the prefix issue, we’ll need to address that in another way.

@pantierra pantierra changed the title feat: Add stac-browser Add stac-browser Jan 21, 2025
@eschwartz
Copy link
Contributor

As for the prefix issue, we’ll need to address that in another way.

I customized nginx to just run stac-browser from the root / path. That seems like the simplest fix, here.

I'm using my own nginx service to work around some GCP issues, but here's the config:

    http {
        server {
            listen 80;

            location ~ ^/stac(/|$)(.*) {
                rewrite ^/stac(/|$)(.*)$ /$2 break;
                proxy_set_header Host $host;
                proxy_set_header X-Forwarded-Host $host;
                proxy_pass http://stac.eoapi.svc.cluster.local:8080;
            }

            location ~ ^/vector(/|$)(.*) {
                rewrite ^/vector(/|$)(.*)$ /$2 break;
                proxy_set_header Host $host;
                proxy_set_header X-Forwarded-Host $host;
                proxy_pass http://vector.eoapi.svc.cluster.local:8080;
            }

            location ~ ^/raster(/|$)(.*) {
                rewrite ^/raster(/|$)(.*)$ /$2 break;
                proxy_set_header Host $host;
                proxy_set_header X-Forwarded-Host $host;
                proxy_pass http://raster.eoapi.svc.cluster.local:8080;
            }
    
            location ~ ^/($|.*) {
                proxy_set_header Host $host;
                proxy_set_header X-Forwarded-Host $host;
                proxy_pass http://stac-browser.eoapi.svc.cluster.local:8080;
            }

        }
    }

@emmanuelmathot emmanuelmathot added this to the Full Cloud Agnostic milestone Apr 30, 2025
@emmanuelmathot
Copy link
Contributor

We have been under a lot of recent PRs that refactores the helm chart. I will reintegrate your PR with the current main branch

@emmanuelmathot emmanuelmathot self-requested a review April 30, 2025 12:27
@emmanuelmathot emmanuelmathot merged commit 3aed7b3 into developmentseed:main Apr 30, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Include STAC browser in the helm chart

5 participants