# GitLab: OSS GitHub Alternative

> How to self-hosting GitLab, and use external HA PostgreSQL cluster?
---

Check [Gitlab Docker Deployment](https://docs.gitlab.com/ee/install/docker.html) to finish docker deployment.

```bash
export GITLAB_HOME=/data/gitlab

sudo docker run --detach \
  --hostname gitlab.example.com \
  --publish 443:443 --publish 80:80 --publish 23:22 \
  --name gitlab \
  --restart always \
  --volume $GITLAB_HOME/config:/etc/gitlab \
  --volume $GITLAB_HOME/logs:/var/log/gitlab \
  --volume $GITLAB_HOME/data:/var/opt/gitlab \
  --shm-size 256m \
  gitlab/gitlab-ee:latest

sudo docker exec -it gitlab grep 'Password:' /etc/gitlab/initial_root_password
```

Then change the connection string to the Pigsty managed PostgreSQL clusters.
