2016-04-22 12:22:10 +02:00
|
|
|
gitlab
|
|
|
|
======
|
|
|
|
|
2016-06-09 17:41:17 +02:00
|
|
|
[GitLab][1] includes Git repository management, code reviews, issue tracking,
|
|
|
|
wikis, and more, plus GitLab CI, an easy-to-use continuous integration and
|
|
|
|
deployment tool.
|
|
|
|
|
2016-04-22 12:22:10 +02:00
|
|
|
## docker-compose.yml
|
|
|
|
|
2016-09-02 04:27:40 +02:00
|
|
|
```yaml
|
2016-04-22 12:22:10 +02:00
|
|
|
gitlab:
|
|
|
|
image: gitlab/gitlab-ce
|
2016-06-10 06:35:11 +02:00
|
|
|
hostname: git.example.com
|
2016-06-09 17:41:17 +02:00
|
|
|
environment:
|
|
|
|
GITLAB_OMNIBUS_CONFIG: |
|
2016-06-10 06:35:11 +02:00
|
|
|
external_url 'https://git.example.com'
|
2016-09-02 04:27:40 +02:00
|
|
|
gitlab_rails['gitlab_shell_ssh_port'] = 2222
|
2016-04-22 12:22:10 +02:00
|
|
|
ports:
|
|
|
|
- "443:443"
|
2016-09-02 04:27:40 +02:00
|
|
|
- "2222:22"
|
2016-06-09 17:41:17 +02:00
|
|
|
volumes:
|
|
|
|
- ./gitlab/config:/etc/gitlab
|
|
|
|
- ./gitlab/logs:/var/log/gitlab
|
|
|
|
- ./gitlab/data:/var/opt/gitlab
|
2016-04-22 12:22:10 +02:00
|
|
|
restart: always
|
|
|
|
```
|
|
|
|
|
2016-09-02 04:27:40 +02:00
|
|
|
You can put TLS crt+key into `./gitlab/config/ssl/`:
|
2016-06-10 06:35:11 +02:00
|
|
|
|
2016-09-02 04:27:40 +02:00
|
|
|
- `git.example.com.crt`
|
|
|
|
- `git.example.com.key`
|
2016-04-22 12:22:10 +02:00
|
|
|
|
2016-09-02 04:27:40 +02:00
|
|
|
If you bind port 22, you need to change host `sshd` config:
|
|
|
|
|
|
|
|
```bash
|
2016-04-22 12:22:10 +02:00
|
|
|
$ vi /etc/ssh/sshd_config
|
|
|
|
- Port 22
|
|
|
|
+ Port 2222
|
|
|
|
$ systemctl restart ssh
|
2016-09-02 04:27:40 +02:00
|
|
|
$ ssh -p 2222 localhost
|
|
|
|
```
|
2016-04-22 12:22:10 +02:00
|
|
|
|
2016-09-02 04:27:40 +02:00
|
|
|
## up and running
|
2016-04-22 12:22:10 +02:00
|
|
|
|
2016-09-02 04:27:40 +02:00
|
|
|
```bash
|
|
|
|
$ mkdir -p ~/fig/gitlab/gitlab/config/ssh
|
|
|
|
$ cd ~/fig/gitlab/gitlab/config/ssh
|
|
|
|
$ openssl req -newkey rsa:4096 -nodes -sha256 -x509 -days 365 \
|
|
|
|
-keyout git.example.com.key \
|
|
|
|
-out git.example.com.crt
|
|
|
|
$ docker-compose up -d
|
2016-04-22 12:22:10 +02:00
|
|
|
```
|
|
|
|
|
2016-09-02 04:27:40 +02:00
|
|
|
Open <https://git.example.com> in your web browser:
|
|
|
|
|
|
|
|
- username: `root`
|
|
|
|
- password: `5iveL!fe`
|
|
|
|
|
2016-04-22 12:22:10 +02:00
|
|
|
## backup volumes
|
|
|
|
|
2016-09-02 04:27:40 +02:00
|
|
|
```bash
|
2016-04-22 12:22:10 +02:00
|
|
|
$ docker run --rm \
|
|
|
|
--volumes-from gitlab_gitlab_1 \
|
|
|
|
-v $PWD:/tmp \
|
|
|
|
alpine \
|
|
|
|
tar czf /tmp/gitlab.tgz /etc/gitlab /var/opt/gitlab /var/log/gitlab
|
|
|
|
|
|
|
|
$ tar tzf gitlab.tgz
|
|
|
|
```
|
2016-06-09 17:41:17 +02:00
|
|
|
|
|
|
|
## read more
|
|
|
|
|
|
|
|
- http://docs.gitlab.com/omnibus/docker/
|
2016-06-10 06:35:11 +02:00
|
|
|
- https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/doc/settings/nginx.md
|
2016-09-02 04:27:40 +02:00
|
|
|
- https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/doc/settings/configuration.md
|
2016-06-09 17:41:17 +02:00
|
|
|
|
|
|
|
[1]: https://gitlab.com/
|