-
Notifications
You must be signed in to change notification settings - Fork 489
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add kamal app open
command to open app in a web browser
#1070
base: main
Are you sure you want to change the base?
Conversation
To open the app in a web browser
I like this, but I'm not sure. The command will not work properly in lots of setups - where there's no proxy host, where the host if a wildcard etc. |
Normally For example when there is no proxy host, this PR already falls back to the primary IP, and a valid Kamal config always has at least one IP. Falling back to IPs is pretty handy as I often like to create short-lived apps where I don't bother to configure domains, so I access them by IP. Normal non-wildcard proxy hosts (e.g. That leaves us with wildcards proxy hosts (e.g. I think this would cover the majority of cases, and most apps have a pretty standard setup with normal domains or IPs. Do you have other breakage concerns or examples in mind? |
You would have to duplicate the host name, but this would also be possible using Aliases on a per project basis. |
@AxelTheGerman I am not sure how this would be possible. Can you provide an example? AFAIK aliases are for things like |
Duh you're right... but in that case I guess it would be possible to A) write a custom rake task or B) creating a It does seem much easier to add it into kamal but I'm agreeing with @djmb regarding
One option though for implementing it in kamal would just be to print a message that the app cannot be opened if we can't find the host/IP for the app |
Problem
Kamal is a no-PaaS tool with PaaS-like ergonomics, where you can easily open a production Rails (or other) console, a shell session, tail logs, etc. A small feature that could be implemented to further align with this vision is a command to open the app in a web browser, similar to Heroku's
heroku open
or Fly.io'sfly apps open
.This would allow for quick access to a deployed web application, from the CLI, without having to manually copy/paste the URL from one of your browser tabs or your
config/deploy.yml
or some other file. Examples where this can be useful:Solution
Add a
kamal app open
command. It opens the primary role's (usuallyweb
) first domain defined inproxy
host(s)
, or falls back to the primary role's first IP address.The implementation is short, so adding a dependency for finding the OS opening command (with a gem like launchy) felt like too much. But I can change the PR if needed.