Gitlab Docker-compose files

Not sure if this is useful to anyone, so I’ll just stick it here for comment.

Gitlab publishes gitlab-ce and gitlab-ee Docker images on docker-hub; these are enormous, with postgresql, nginx, and redis included.

I’ve cloned my example Gitlab deployment on Gitlab. It provides individual containers for:

  • Gitlab-ce
  • PostgreSQL 9.5
  • Redis 3
  • Gitlab-Kanban
  • Nginx

The Nginx is necessary. My Web application servers proxy_pass to a socket based on virtual host, allowing me to upgrade, replace, add, and disable services without impacting the rest of the server. For example: when I docker-compose stop OwnCloud, OwnCloud returns a 502 Bad Gateway while GitLab keeps functioning.

To do this by exposed TCP port, you have to link the application in the Compose file, and then restart the Docker container every time the linked container restarts. This also means I can’t restart the gitlab container without restarting the nginx container, which is why I just docker-compose up -d the whole thing on upgrade.

By using a broken out service built through Docker-Compose, I can reuse the same Postgres and Redis installations. I understand the Omnibus brings a whole package, which reduces complexity marginally for new Docker users; and a strong example docker-compose.yml fills that need equally as well, with more direct control on the administrator’s side. I’ve extended Gitlab with my fancy nginx behavior and with Gitlab-kanban (sharing the same Redis as Gitlab) as an example.