|
1 |
| -# gitlab-ce-docker plugin |
| 1 | +# gitlab-ce-docker Plugin |
2 | 2 |
|
3 |
| -This plugin installs [Gitlab-CE](https://about.gitlab.com/) in an existing docker, and the container name is `gitlab`. |
4 |
| -## Usage |
| 3 | +This plugin installs [GitLab](https://about.gitlab.com/) CE(Community Edition) on Docker. |
| 4 | + |
| 5 | +_NOTICE: currently, this plugin support Linux only._ |
| 6 | + |
| 7 | +## Background |
| 8 | + |
| 9 | +GitLab officially provides an image [gitlab-ce](https://registry.hub.docker.com/r/gitlab/gitlab-ce). We can use this image to start a container: |
| 10 | + |
| 11 | +```shell |
| 12 | +docker run --detach \ |
| 13 | + --hostname gitlab.example.com \ |
| 14 | + --publish 443:443 --publish 80:80 --publish 22:22 \ |
| 15 | + --name gitlab \ |
| 16 | + --restart always \ |
| 17 | + --volume $GITLAB_HOME/config:/etc/gitlab \ |
| 18 | + --volume $GITLAB_HOME/logs:/var/log/gitlab \ |
| 19 | + --volume $GITLAB_HOME/data:/var/opt/gitlab \ |
| 20 | + --shm-size 256m \ |
| 21 | + gitlab/gitlab-ce:rc |
| 22 | +``` |
| 23 | + |
| 24 | +The variable `$GITLAB_HOME` here pointing to the directory where the configuration, logs, and data files will reside. |
| 25 | + |
| 26 | +We can set this variable by the `export` command: |
| 27 | + |
| 28 | +```shell |
| 29 | +export GITLAB_HOME=/srv/gitlab |
| 30 | +``` |
| 31 | + |
| 32 | +The GitLab container uses host mounted volumes to store persistent data: |
| 33 | + |
| 34 | +| Local location |Container location | Usage | |
| 35 | +| --------------------- | ----------------- | ------------------------------------------ | |
| 36 | +| `$GITLAB_HOME/data` | `/var/opt/gitlab` | For storing application data | |
| 37 | +| `$GITLAB_HOME/logs` | `/var/log/gitlab` | For storing logs | |
| 38 | +| `$GITLAB_HOME/config` | `/etc/gitlab` | For storing the GitLab configuration files | |
| 39 | + |
| 40 | +So, we can customize the following configurations: |
| 41 | + |
| 42 | +1. hostname |
| 43 | +2. host port |
| 44 | +3. persistent data path |
| 45 | +4. docker image tag |
| 46 | + |
| 47 | +## Configuration |
5 | 48 |
|
6 | 49 | Note:
|
7 |
| -1. the user must be `root` or in `docker` group. |
8 |
| -2. https not support now(todo). |
| 50 | +1. the user you are using must be `root` or in the `docker` group; |
| 51 | +2. `https` isn't supported for now. |
9 | 52 |
|
10 | 53 | ```yaml
|
11 |
| - |
12 | 54 | --8<-- "gitlab-ce-docker.yaml"
|
| 55 | +``` |
| 56 | + |
| 57 | +## Some Commands That May Help |
| 58 | + |
| 59 | +- clone code |
13 | 60 |
|
| 61 | +```shell |
| 62 | +export hostname=YOUR_HOSTNAME |
| 63 | +export username=YOUR_USERNAME |
| 64 | +export project=YOUR_PROJECT_NAME |
14 | 65 | ```
|
15 | 66 |
|
16 |
| -## Next |
17 |
| -Here are some commands that may help you: |
| 67 | +1. ssh |
18 | 68 |
|
19 |
| -get password of user root in gitlab-ce-docker |
20 | 69 | ```shell
|
21 |
| -sudo docker exec -it gitlab grep 'Password:' /etc/gitlab/initial_root_password |
| 70 | +# port is 22 |
| 71 | +git clone git@${hostname}/${username}/${project}.git |
| 72 | +# port is not 22, 2022 as a sample |
| 73 | +git clone ssh://git@${hostname}:2022/${username}/${project}.git |
22 | 74 | ```
|
23 | 75 |
|
24 |
| -git clone: |
| 76 | +2. http |
| 77 | + |
25 | 78 | ```shell
|
26 |
| -#ssh |
27 |
| -# 22 port |
28 |
| -git clone git@hostname/.../xxx.git |
29 |
| -# if not 22 port |
30 |
| -git clone ssh://git@hostname:port/.../xxx.git |
31 |
| - |
32 |
| -# http |
33 |
| -# 80 port |
34 |
| -git clone http://hostname/.../xxx.git |
35 |
| -# if not 80 port |
36 |
| -git clone http://hostname:port/.../xxx.git |
| 79 | +# port is 80 |
| 80 | +git clone http://${hostname}/${username}/${project}.git |
| 81 | +# port is not 80, 8080 as a sample |
| 82 | +git clone http://${hostname}:8080/${username}/${project}.git |
37 | 83 | ```
|
0 commit comments