Skip to content
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

How to expose postgresql container to public? #10

Closed
darklow opened this issue Jul 26, 2015 · 9 comments
Closed

How to expose postgresql container to public? #10

darklow opened this issue Jul 26, 2015 · 9 comments

Comments

@darklow
Copy link

darklow commented Jul 26, 2015

Currently i see that 5432/tcp port is exposed for local connections.

CONTAINER ID        IMAGE                     COMMAND                CREATED             STATUS              PORTS               NAMES
104c2a2acf76        postgres:9.4              "/docker-entrypoint.   3 days ago          Up 21 hours         5432/tcp            psql-single-container

But i guess i need to bind it to exactly 0.0.0.0:5432->5432/tcp in order to make postgresql listen public.
When i was using original ohardy/dokku-psql repo the exposed ports looked like this:

716104709bf7        ohardy/postgresql:latest      "manage start"         11 weeks ago        Up 11 weeks         0.0.0.0:5432->5432/tcp             sharp_carson

Could you please help me what do i need to change to make my postgresql container to be available in public? Is it somehow configurable?

Thanks.

@Flink Flink added the question label Jul 26, 2015
@Flink
Copy link
Owner

Flink commented Jul 26, 2015

Well this change was by design, I want to be able to run a PG server on the host while running this plugin side by side.

Now what you’re asking is doable, you’ll have to add -p 0.0.0.0:5432:5432 in https://github.com/Flink/dokku-psql-single-container/blob/master/commands#L73

I could also add an option to bind the container externally while keeping the default behavior of not binding externally.

@darklow
Copy link
Author

darklow commented Jul 26, 2015

Thank you for the solution, it will work!
Of course configurable option would be much better. That way this plugin will become more configurable and easy to use. For most of projects i don't need such a feature, but for some i have 3rd party apps on another servers that just need an access to this psql server/container.
So configurable option would be much appretiated.

@Flink
Copy link
Owner

Flink commented Jul 26, 2015

Yes, you’re right, I’m taking a look ;)

@Flink
Copy link
Owner

Flink commented Jul 26, 2015

Done! Available in the latest master (instructions in README) 😁

@darklow
Copy link
Author

darklow commented Jul 28, 2015

Sorry for bothering you again, lot of "dockerizing" lately :)

Now for one app i have another wish related to this one, i would like to bind container not to 0.0.0.0 but to 127.0.0.1 so that it is exposed for docker server without linking.

I wish you implemented something like PSQL_SC_BIND_IP instead of hardcoded PSQL_SC_BIND_EXTERNAL therefore we could configure to either 0.0.0.0 or 127.0.0.1 or don't specify for not exposing at all.

Would you consider this as a feature?
If you are busy i could try to adjust current feature and make a pull request.
Thanks.

@Flink
Copy link
Owner

Flink commented Jul 29, 2015

PSQL_SC_BIND_EXTERNAL could take an IP instead of true and that should do it. I could also rename it to PSQL_SC_BIND_IP as you suggested but I don’t know if that’s really necessary?

What do you think?

@darklow
Copy link
Author

darklow commented Jul 29, 2015

I think PSQL_SC_BIND_IP would be more precise because specifying 127.0.0.1 doesn't mean it will bind external as PSQL_SC_BIND_EXTERNAL would suggest.
But you know what, i actually solved my problem in a bit different way, but if you want you can still add it as a feature anyways.

@Flink
Copy link
Owner

Flink commented Aug 3, 2015

I think I will still add this feature ;)

Flink added a commit that referenced this issue Aug 3, 2015
Replace `PSQL_SC_BIND_EXTERNAL` with `PSQL_SC_BIND_IP`. See README for
instructions.

Closes #10
@Flink
Copy link
Owner

Flink commented Aug 3, 2015

Done in latest master 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants