-
Notifications
You must be signed in to change notification settings - Fork 39
Configure a path prefix for River UI #231
Hello! I am deploying an instance of Riverqueue in another service. Since I now have two separate microservices using Riverqueue I created two separate databases in Postgres since we need to be able to upgrade Riverqueue in each service independently of the other. Hence, the database migrations for Riverqueue need to happen at different points in time and the services might run with different migration versions which is why I created a separate Riverqueue database for the other service.
Now I want to deploy a River UI for the new service and thought I could use the same URL host but different path prefix for the different instances if the River UI
https://my-host/service-ahttps://my-host/service-b
In Kubernetes I have added a rewrite of HTTP requests to https://my-host where https://my-host/service-a gets a path rewrite where I strip off /service-a to target path / and the request gets directed to the container that runs the River UI for service a (and vice versa for service b). However, this does not work and I suppose that is because the Frontend performs subsequent requests that are not prefixed with /service-a and then those requests cannot reach the River UI container for service a.
I assume that the short term solution is to use separate host names for service a and b which would be a workaround:
https://my-host-ahttps://my-host-b
But would be nice with the possibility to have one host with different path prefixes. Would it be easy to make that configurable? I assume that you would not only specify the DATABASE_URL env variable but also an optional PATH_PREFIX=/service-a for example. Just sharing this idea if it's something you would be interested in.
All reactions
I'm not sure I understand the issue you're running into. River UI supports a path prefix option via any of the supported runtime options (docker, executable, or Go embed via the Prefix option). So you could embed this in another Go application with as many copies of River UI as you want, each with a different path prefix. When doing so, the UI also makes requests to the appropriate sub-path.
Replies: 1 comment 2 replies
I'm not sure I understand the issue you're running into. River UI supports a path prefix option via any of the supported runtime options (docker, executable, or Go embed via the Prefix option). So you could embed this in another Go application with as many copies of River UI as you want, each with a different path prefix. When doing so, the UI also makes requests to the appropriate sub-path.
All reactions
Thanks for the reply! I now discovered in the Dockerfile that you already had implemented this here and here. I suggested the environment variable PATH_PREFIX without knowing that it existed since it was not in the docs at the time of writing this. It seems to work fine locally so I will try to deploy this. Thanks!
All reactions
-
🎉 1
And works like a charm in the deployed environment too! 🙌