-
-
Notifications
You must be signed in to change notification settings - Fork 97
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 exposed DSN option for postgres:info command #162
Open
nicolas-brousse
wants to merge
1
commit into
dokku:master
Choose a base branch
from
nicolas-brousse:add-external-dsn-option-for-postgres-info-cmd
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -75,6 +75,7 @@ dokku postgres:info lolipop | |
# you can also retrieve a specific piece of service info via flags | ||
dokku postgres:info lolipop --data-dir | ||
dokku postgres:info lolipop --dsn | ||
dokku postgres:info lolipop --exposed-dsn | ||
dokku postgres:info lolipop --exposed-ports | ||
dokku postgres:info lolipop --id | ||
dokku postgres:info lolipop --internal-ip | ||
|
@@ -265,6 +266,27 @@ The `import` command should be used with any non-plain-text files exported by `p | |
dokku postgres:connect db < ./dump.sql | ||
``` | ||
|
||
## Exposed DSN | ||
|
||
```shell | ||
# expose the database (you must open the exposed port on your firewall if you have one) | ||
dokku postgres:expose lolipop | ||
|
||
# exposed dsn available on service info | ||
dokku postgres:info lolipop | ||
=====> Container Information | ||
... | ||
Exposed dsn: postgres://postgres:[email protected]:28804/lolipop | ||
Exposed ports: 5432->28804 | ||
... | ||
``` | ||
|
||
So now you connect to your database with [`pgcli`](https://www.pgcli.com/) or with your favorite app. | ||
|
||
```shell | ||
pgcli $(ssh [email protected] postgres:info lolipop --exposed-dsn) | ||
``` | ||
|
||
## Security | ||
|
||
The connection to the database is done over SSL. A self-signed certificate is | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This port may not be exposed to the public, so this external dsn would fail to work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you mean by "This port may not be exposed to the public"?
You mean because of a firewall for example?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The port is by default only on the internal ip address. You'd need to call
SERVICE:expose
on the service (with the port you want to map it to specified) and only then would this code work.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, maybe I missed some explanation. I currently run
ssh [email protected] postgres:expose postgres-database
beforepgcli $(ssh [email protected] postgres:info postgres-database --external-dsn)
. If notExternal dsn
returns-
asExposed ports
do.Maybe I have to update the README for more explanation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right I'm just concerned that if the db is not exposed, then people will get confused and start filing issues about how this doesn't work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, I'll work on updating README and maybe add precision on command help info about the option.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do some changes on README and flag description.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be empty if the service is not exposed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
External dsn:
already returns-
if the service is not exposed.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this fine for you?