Flink / dokku-psql-single-container

Plugin for dokku that provides a Postgresql server in a single container
MIT License
51 stars 9 forks source link

can't pgadmin into the database #23

Open sglebs opened 8 years ago

sglebs commented 8 years ago

Hi,

I am trying to connect to the database with pgadmin. I have a MacOS running dokku via vagrant. I tried this option:

dokku config:set --global PSQL_SC_BIND_IP=0.0.0.0

I also defined this port mapping in Virtualbox:

external:5432 --> internal:5432

It still did not work. So I used vagrant ssh to get into the machine. I can see the docker image:

vagrant@dokku:~$ sudo docker ps | grep psql
d1d0d74ce9fa        postgres:9.3                  "/docker-entrypoint.s"   11 weeks ago        Up 28 minutes       5432/tcp            psql-single-container

I guess what is missing is a mapping from this Linux itself into the docker image. This would normally be doable in docker by passing the mapping from external port to internal port. How can I override this in your docker container?

Thanks!

sglebs commented 8 years ago

I see this in the way you run:

docker run $(bind_ip_options) -d -v "$PSQL_ROOT/data:/var/lib/postgresql/data" --name "$PSQL_CONTAINER_NAME" "$PSQL_IMAGE" > /dev/null

But in order to export the port to the outside, one also needs do pass the option -p. Example:

docker run -d -p 9200:9200 elasticsearch

Should we create a fork and always export or should we make it configurable? I think dokku supports extra docker options? Can that be used here?

sglebs commented 8 years ago

It looks like the docker option can be added for an app, but not for a plugin: https://github.com/dokku/dokku/commit/df8f4fb8824550518b07c87ac56aba568bd81295

sglebs commented 8 years ago

The problem is the documentation, at "Binding Postgresql port to another IP". It should say "You should do it before running dokku plugins-install" like in the other sections. Because once you start it, it will reuse the docker image and it will never pass -p.

Zren commented 8 years ago

I ran into this problem awhile back. I added a rebuild command that builds an image off the old container, renames the old container as a backup, and rebuilds a new container with the new port options.

See: https://github.com/Flink/dokku-psql-single-container/compare/master...Zren:dev