1. 环境准备
- 操作系统: centos7
- 系统配置: 4核8G
必要的系统软件安装
# 将本机ip 添加到 hosts
cat >> /etc/hosts << EOF
192.168.90.128 gitlab.ylb.com jira.ylb.com jenkins.ylb.com
EOF
yum install -y epel-release
yum install -y vim wget
安装docker-ce
# 卸载旧版本
yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
# 添加docker-ce yum源
wget https://download.docker.com/linux/centos/docker-ce.repo -O /etc/yum.repos.d/docker-ce.repo
yum repolist
# 安装 docker-ce
yum install -y docker-ce
# 启动 docker
systemctl start docker
# 将 docker 开机启动
systemctl enable docker
docker 安装 JIRA
安装 mysql
mysql指定库的字符集必须是utf8,否则创建项目会报错
docker run \
--name mysql-jira \
--restart unless-stopped \
-p 3306:3306 \
–character-set-server=utf8mb4 \
--collation-server=utf8mb4_bin \
-e MYSQL_ROOT_PASSWORD=123456 \
-e SQL_MODE=NO_AUTO_VALUE_ON_ZERO \
-e MYSQL_DATABASE=jira \
-e MYSQL_USER=jira \
-e MYSQL_PASSWORD=jira \
-d \
mysql:5.7
# CREATE DATABASE jira CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
安装 jira
docker run -d \
-p 7081:8080 \
--name jira-software \
--restart always \
cptactionhank/atlassian-jira-software:8.1.0
# 下载 mysql-jdbc 驱动
wget https://cdn.mysql.com//Downloads/Connector-J/mysql-connector-java-5.1.49.tar.gz -O /usr/local/src/mysql-connector-java-5.1.49.tar.gz
tar -xvf /usr/local/src/mysql-connector-java-5.1.49.tar.gz -C /usr/local/src/
# 下载破解包
wget https://github.com/ly641921791/knowledge/raw/master/jira/crack/atlassian-extras-3.2.jar -O /usr/local/src/atlassian-extras-3.2.jar
# 替换
docker cp /usr/local/src/mysql-connector-java-5.1.49/mysql-connector-java-5.1.49-bin.jar jira-software:/opt/atlassian/jira/atlassian-jira/WEB-INF/lib/
docker cp /usr/local/src/atlassian-extras-3.2.jar jira-software:/opt/atlassian/jira/atlassian-jira/WEB-INF/lib/
# 重启
docker restart jira-software
配置jira
浏览器访问: http://jira.ylb.com:7081/
docker 安装 gitlab
mkdir -p /data/gitlab
mkdir -p /data/back/gitlab
# docker 启动gitlab
GITLAB_IP="gitlab.ylb.com"
GITLAB_PATH="/data/gitlab"
docker run -d \
-p 443:443 \
-p 80:80 \
-p 222:22 \
--name gitlab \
--hostname ${GITLAB_IP} \
--restart always \
-v ${GITLAB_PATH}/etc:/etc/gitlab \
-v ${GITLAB_PATH}/log:/var/log/gitlab \
-v ${GITLAB_PATH}/data:/var/opt/gitlab \
-v ${GITLAB_PATH}/data/back/gitlab:/var/opt/gitlab/backups \
gitlab/gitlab-ce:12.8.10-ce.0
# gitlab 备份
# gitlab-rake gitlab:backup:create
docker 安装 jenkins
mkdir -p /data/jenkins
docker run -d \
-p 8080:8080 \
-v ~/jenkins:/var/jenkins_home \
--name jenkins \
--restart always \
jenkins:2.60.3
nginx 配置
server {
listen 80 default_server;
#charset koi8-r;
#access_log /var/log/nginx/host.access.log main;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
location /api/ {
proxy_pass http://172.17.5.4:8080/;
}
#参考地址https://github.com/cptactionhank/docker-atlassian-jira/blob/master/.docker/nginx/nginx.conf
location /jira/ {
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 100M;
proxy_pass http://172.17.5.4:8081/jira/;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
设置
gitlab 设置 jira
JIRA 设置
JIRA集成gitlab 注意事项
- jira 允许远程 API调用
JIRA 查看项目 issue 的工作流
- 必须使用 admin 帐号查看
**
JIRA 安装 jenkins 插件
JIRA 中设置jenkins
JIRA 中issue状态的改变触发Jenkins构建
在 jira 中配置 webhook
jenkins 设置
jenkins 所需要的插件
- JIRA Trigger
- Jira Issue Updater
- JIRA plugin 1.4.7 手动下载 ( 1.5.x 用的时候有问题 )
- JiraTestResultReporter
- Git
- GitLab
- GitLab Hook
上传下载好的插件