Preconfigured Shared Ports

Is there a way to preconfigure shared ports to public in a coder template? I am trying to run Hasura in a docker container within coder (docker in Envbox). Another dashboard docker image uses the exposed Hasura URL. I don't have a way to set credentials: "include" within the fetch calls of the dashboard. The only way to get everything working is for me to manually set the "Shared Port" to public. I am trying to automate creating a workspace and running the docker stack and would prefer to not have to manually set this value on every workspace. Is there a way to preconfigure this port to be public or script the startup script to expose the port as public?
No description
Solution:
I was able to get this url to load: https://nhost-dashboard--main--a1--jovermier.coder.hahomelabs.com but this url with the additional apps didn't work. https://nhost-dashboard--main--a1--jovermier-apps.coder.hahomelabs.com/ ...
Jump to solution
7 Replies
zounce
zounce•4mo ago
Would a coder_app suit your needs? It's basically just a permanently open port https://registry.terraform.io/providers/coder/coder/latest/docs/resources/app#share-1
Jason Overmier
Jason OvermierOP•4mo ago
sure that would work
Jason Overmier
Jason OvermierOP•4mo ago
I have tried this approach but the dashboard still has auth redirect issue. Only when i manually add "Shared Ports" to public did it start working.
No description
No description
No description
No description
zounce
zounce•4mo ago
I don't completely follow, but it looks like your service running on 8082 is trying to hit port 1337 via browser portforwarding (1337--<agent>...), and not the app url. The app URL would start with the slug of the app <slug>--<agent>--<workspace>--<username>--apps.example.coder.com
Solution
Jason Overmier
Jason Overmier•4mo ago
I was able to get this url to load: https://nhost-dashboard--main--a1--jovermier.coder.hahomelabs.com but this url with the additional apps didn't work. https://nhost-dashboard--main--a1--jovermier-apps.coder.hahomelabs.com/ I haven't seen the apps suffix on a username before in the docs. Is this a feature? Switching to using the slug rather than the port number fixed the issue. Thank you for the help 🙂
zounce
zounce•4mo ago
I haven't seen the apps suffix on a username before in the docs. Is this a feature?
ah nah sorry, my mistake, that's from our own coder configuration glad to hear that worked!
Codercord
Codercord•4mo ago
@Phorcys closed the thread.

Did you find this page helpful?