-
Notifications
You must be signed in to change notification settings - Fork 194
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Daniel Hu <tao.hu@merico.dev>
- Loading branch information
Showing
100 changed files
with
2,425 additions
and
1,282 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,7 +40,7 @@ e2e-test-local.yaml | |
|
||
# .devstream | ||
.devstream/ | ||
devstream.state | ||
*.state | ||
|
||
# e2e | ||
testbin/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,83 @@ | ||
# gitlab-ce-docker plugin | ||
# gitlab-ce-docker Plugin | ||
|
||
This plugin installs [Gitlab-CE](https://about.gitlab.com/) in an existing docker, and the container name is `gitlab`. | ||
## Usage | ||
This plugin installs [GitLab](https://about.gitlab.com/) CE(Community Edition) on Docker. | ||
|
||
_NOTICE: currently, this plugin support Linux only._ | ||
|
||
## Background | ||
|
||
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: | ||
|
||
```shell | ||
docker run --detach \ | ||
--hostname gitlab.example.com \ | ||
--publish 443:443 --publish 80:80 --publish 22: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-ce:rc | ||
``` | ||
|
||
The variable `$GITLAB_HOME` here pointing to the directory where the configuration, logs, and data files will reside. | ||
|
||
We can set this variable by the `export` command: | ||
|
||
```shell | ||
export GITLAB_HOME=/srv/gitlab | ||
``` | ||
|
||
The GitLab container uses host mounted volumes to store persistent data: | ||
|
||
| Local location |Container location | Usage | | ||
| --------------------- | ----------------- | ------------------------------------------ | | ||
| `$GITLAB_HOME/data` | `/var/opt/gitlab` | For storing application data | | ||
| `$GITLAB_HOME/logs` | `/var/log/gitlab` | For storing logs | | ||
| `$GITLAB_HOME/config` | `/etc/gitlab` | For storing the GitLab configuration files | | ||
|
||
So, we can customize the following configurations: | ||
|
||
1. hostname | ||
2. host port | ||
3. persistent data path | ||
4. docker image tag | ||
|
||
## Configuration | ||
|
||
Note: | ||
1. the user must be `root` or in `docker` group. | ||
2. https not support now(todo). | ||
1. the user you are using must be `root` or in the `docker` group; | ||
2. `https` isn't supported for now. | ||
|
||
```yaml | ||
|
||
--8<-- "gitlab-ce-docker.yaml" | ||
``` | ||
|
||
## Some Commands That May Help | ||
|
||
- clone code | ||
|
||
```shell | ||
export hostname=YOUR_HOSTNAME | ||
export username=YOUR_USERNAME | ||
export project=YOUR_PROJECT_NAME | ||
``` | ||
|
||
## Next | ||
Here are some commands that may help you: | ||
1. ssh | ||
|
||
get password of user root in gitlab-ce-docker | ||
```shell | ||
sudo docker exec -it gitlab grep 'Password:' /etc/gitlab/initial_root_password | ||
# port is 22 | ||
git clone git@${hostname}/${username}/${project}.git | ||
# port is not 22, 2022 as a sample | ||
git clone ssh://git@${hostname}:2022/${username}/${project}.git | ||
``` | ||
|
||
git clone: | ||
2. http | ||
|
||
```shell | ||
#ssh | ||
# 22 port | ||
git clone git@hostname/.../xxx.git | ||
# if not 22 port | ||
git clone ssh://git@hostname:port/.../xxx.git | ||
|
||
# http | ||
# 80 port | ||
git clone http://hostname/.../xxx.git | ||
# if not 80 port | ||
git clone http://hostname:port/.../xxx.git | ||
# port is 80 | ||
git clone http://${hostname}/${username}/${project}.git | ||
# port is not 80, 8080 as a sample | ||
git clone http://${hostname}:8080/${username}/${project}.git | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,81 @@ | ||
# gitlab-ce-docker 插件 | ||
|
||
这个插件用来在本机已存在的 Docker 上安装 [Gitlab-CE](https://about.gitlab.com/), 容器名为 `gitlab`。 | ||
## 使用 | ||
这个插件用于以 Docker 的方式安装 [GitLab](https://about.gitlab.com/) CE(社区版)。 | ||
|
||
_注意:目前本插件仅支持 Linux。_ | ||
|
||
## 背景知识 | ||
|
||
GitLab 官方提供了 [gitlab-ce](https://registry.hub.docker.com/r/gitlab/gitlab-ce) 镜像,通过这个镜像我们可以实现类似这样的命令来启动一个 GitLab 容器: | ||
|
||
```shell | ||
docker run --detach \ | ||
--hostname gitlab.example.com \ | ||
--publish 443:443 --publish 80:80 --publish 22: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-ce:rc | ||
``` | ||
|
||
其中 $GITLAB_HOME 表示的是本地存储卷路径,比如我们可以通过 export 命令来设置这个变量: | ||
|
||
```shell | ||
export GITLAB_HOME=/srv/gitlab | ||
``` | ||
|
||
在上述命令中,我们可以看到这个容器使用了3个存储卷,含义分别如下: | ||
|
||
| 本地路径 | 容器内路径 | 用途 | | ||
| --------------------- | ----------------- | ----------------- | | ||
| `$GITLAB_HOME/data` | `/var/opt/gitlab` | 保存应用数据 | | ||
| `$GITLAB_HOME/logs` | `/var/log/gitlab` | 保存日志 | | ||
| `$GITLAB_HOME/config` | `/etc/gitlab` | 保存 GitLab 配置文件 | | ||
|
||
在此基础上,我们可以自定义如下一些配置: | ||
|
||
1. hostname | ||
2. 本机端口 | ||
3. 存储卷路径 | ||
4. 镜像版本 | ||
|
||
## 配置 | ||
|
||
注意: | ||
1. 执行本插件的用户,必须在 `docker` 用户组内,或者是 `root` | ||
2. 目前暂不支持 `https` 访问 gitlab | ||
1. 你使用的用户必须是 `root` 或者在 `docker` 用户组里; | ||
2. 目前暂不支持 `https` 方式访问 GitLab。 | ||
|
||
```yaml | ||
|
||
--8<-- "gitlab-ce-docker.yaml" | ||
``` | ||
|
||
## 一些可能有用的命令 | ||
|
||
- 克隆项目 | ||
|
||
```shell | ||
export hostname=YOUR_HOSTNAME | ||
export username=YOUR_USERNAME | ||
export project=YOUR_PROJECT_NAME | ||
``` | ||
|
||
## 可能会用到的命令 | ||
1. ssh 方式 | ||
|
||
查看 gitlab 的 root 用户的密码: | ||
```shell | ||
sudo docker exec -it gitlab grep 'Password:' /etc/gitlab/initial_root_password | ||
# port is 22 | ||
git clone git@${hostname}/${username}/${project}.git | ||
# port is not 22, 2022 as a sample | ||
git clone ssh://git@${hostname}:2022/${username}/${project}.git | ||
``` | ||
|
||
克隆项目: | ||
2. http 方式 | ||
|
||
```shell | ||
#ssh | ||
# 22 port | ||
git clone git@hostname/.../xxx.git | ||
# if not 22 port | ||
git clone ssh://git@hostname:port/.../xxx.git | ||
|
||
# http | ||
# 80 port | ||
git clone http://hostname/.../xxx.git | ||
# if not 80 port | ||
git clone http://hostname:port/.../xxx.git | ||
# port is 80 | ||
git clone http://${hostname}/${username}/${project}.git | ||
# port is not 80, 8080 as a sample | ||
git clone http://${hostname}:8080/${username}/${project}.git | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,5 @@ TODO(aFlyBird0): Add your document here. | |
## Usage | ||
|
||
```yaml | ||
|
||
--8<-- "jenkins-github-integ.yaml" | ||
|
||
``` |
Oops, something went wrong.