sameersbn / docker-gitlab

Dockerized GitLab
http://www.damagehead.com/docker-gitlab/
MIT License
7.88k stars 2.14k forks source link

Support UNIX sockets for db connections #415

Open rysiekpl opened 9 years ago

rysiekpl commented 9 years ago

Reading the documentation I cannot find how to configure GitLab docker container to connect to a database (in my case: PostgreSQL) via a UNIX socket. If UNIX sockets are not supported, it would be worthwhile to add such a support, methinks!

lazyfrosch commented 9 years ago

The idea of Docker is to isolate applications, so they can only use networking to communicate...

rysiekpl commented 9 years ago

The idea of Docker is to isolate applications, full stop. Using UNIX sockets for applications in a single group (say, managed by docker-compose) makes it possible to not have certain containers/applications listening on any network ports, which adds some additional security.

Moreover, it makes it possible not to worry about "which IP address this container will get this time". If we're talking UNIX sockets through data volume containers, we don't have to worry about network stuff where network stuff is not needed.

UNIX sockets can also be actually faster than TCP/IP stack in certain scenarios. Also, all underlying libraries (esp. the PostgreSQL library) support UNIX sockets.

sameersbn commented 9 years ago

i agree that we need to add support for unix sockets. but due to time limitations this is not very high on my priority list. This will only have lasting performance improvements on large installations me thinks.

ivlis commented 9 years ago

I have implemented a UNIX socket connection via a DVC from gitlab to ngnix. Making connections to databases is not a big deal. After @sameersbn will finish porting 8.0.0 I will create a PR.

sameersbn commented 9 years ago

p.s. the sameersbn/postgresql and sameersbn/mysql images already expose volumes that contain the unix domain sockets. Simply doing a --volumes-from would make this volume available to the gitlab container. Just a couple of changes are required in the entrypoint.sh script to detect and configure database.yml accordingly.

After @sameersbn will finish porting 8.0.0 I will create a PR.

This is for the best.

rysiekpl commented 8 years ago

Any news on this?

sameersbn commented 8 years ago

@ivlis I will be happy to review your PR with this feature.

ivlis commented 8 years ago

@rysiekpl @sameersbn Thanks for reminding me about that :smile:. Gitlab is changing rapidly, I'll update my config to the current version and submit a PR soon. I'm still on 7.14 for my personal server.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had any activity for the last 60 days. It will be closed if no further activity occurs during the next 7 days. Thank you for your contributions.