【Docker】之搭建Jira

前言

  JIRA 是 Atlassian 公司出品的项目与事务跟踪工具,被广泛应用于缺陷跟踪、客户服务、需求收集、流程审批、任务跟踪、项目跟踪和敏捷管理等工作领域。
  Centos下安装参考:Centos下Jira8.x版本安装与破解
  下面介绍是采用docker来进行部署。

环境准备

  1. Centos8,机子分配的内存适当大些。
  2. 破解包
  3.    参考:atlassian-agent-v1.2.3 , 其他

  4. 安装Docker
  5. 事先安装`Mysql`,尽量5.7

开始安装

安装MSQL

# 1,下载镜像
docker pull mysql:5.7

# 2,创建目录
mkdir -p /root/.docker/mysql5.7/conf
mkdir -p /root/.docker/mysql5.7/data
mkdir -p /root/.docker/mysql5.7/logs

# 3,设置配置文件
cd /root/.docker/mysql5.7/conf
touch my.cnf
[mysqld]
user=mysql
socket=/var/run/mysqld/mysqld.sock

#character-set-server=utf8
character_set_server=utf8mb4
default-storage-engine=INNODB
innodb_default_row_format=DYNAMIC
innodb_large_prefix=ON
innodb_file_format=Barracuda
innodb_log_file_size=2G

#忘记密码时使用
#skip-grant-tables
#设置协议认证方式
default_authentication_plugin=mysql_native_password
secure-file-priv=/var/lib/mysql
#sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION
sql_mode = NO_AUTO_VALUE_ON_ZERO
max_connections=1000

[client]
default-character-set=utf8

[mysql]
default-character-set=utf8

[mysqld_safe]
pid-file=/var/run/mysqld/mysqld.pid
#log-error=/var/log/mysql/mysqld.log
# 4,启动容器
docker run -d -p 3306:3306 --name mysql5.7 \
--restart always \
--privileged=true \
-e TZ=Asia/Shanghai \
-e MYSQL_ROOT_PASSWORD=123456 \
-e MYSQL_DATABASE=jira \
-e MYSQL_USER=jira \
-e MYSQL_PASSWORD=123456 \
-v /root/.docker/mysql5.7/conf/my.cnf:/etc/mysql/conf.d/mysqld.cnf \
-v /root/.docker/mysql5.7/data:/var/lib/mysql \
-v /root/.docker/mysql5.7/logs:/var/log/mysql \
mysql:5.7

# 5,授权远程访问
CREATE DATABASE jira CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
CREATE USER jira IDENTIFIED BY 'jira';
GRANT ALL PRIVILEGES ON *.* TO 'jira' @'%' IDENTIFIED BY 'jira' WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON *.* TO 'jira' @'localhost' IDENTIFIED BY 'jira' WITH GRANT OPTION;
FLUSH PRIVILEGES;


# 6,开放端口
firewall-cmd --zone=public --add-port=3306/tcp --permanent
firewall-cmd --reload

创建jira目录

mkdir -p /root/.docker/atlassian
mkdir -p /root/.docker/atlassian/jira

  tips:有时要,chmod -R 777 atlassian
  tips:atlassian目录如果不创建在root下面,否则会报错

下载破解文件

  下载破解包:atlassian-agent-v1.2.3 ,放到/root/.docker/atlassian目录下面

scp atlassian-agent.jar root@10.211.55.81:/tmp
cp atlassian-agent.jar /root/.docker/atlassian

编写jira对应Dockerfile文件

  确保:docker pull cptactionhank/atlassian-jira-software:latest

FROM cptactionhank/atlassian-jira-software:latest

USER root

# 将代理破解包加入容器
COPY "atlassian-agent.jar" /opt/atlassian/jira/

# 设置启动加载代理包
RUN echo 'export CATALINA_OPTS="-javaagent:/opt/atlassian/jira/atlassian-agent.jar ${CATALINA_OPTS}"' >> /opt/atlassian/jira/bin/setenv.sh

构建镜像

  在/root/.docker/atlassian目录下执行


cd /root/.docker/atlassian
docker build -t jira/jira:latest .

  注意:命令最后有一个空格和点
  执行完毕之后,在末尾显示 Successfully built … 代表执行成功。

启动容器

  在/root/.docker/atlassian目录下执行:

docker run -d -p 8089:8080 \
--name jira \
--restart unless-stopped \
-e TZ=Asia/Shanghai \
-v /root/.docker/atlassian:/var/atlassian/jira \
-v /root/.docker/atlassian/logs:/opt/atlassian/jira/logs \
-v /etc/localtime:/etc/localtime \
jira/jira:latest

浏览器界面进行设置

  输入地址:http://IP地址:8089,一步步配置下去,直到配置数据库,尽量选Msql:5.7.

配置

  确保MSQL配置my.cnf

[mysqld]
pid-file=/var/run/mysqld/mysqld.pid
socket=/var/run/mysqld/mysqld.sock

default-storage-engine=INNODB
character_set_server=utf8mb4
innodb_default_row_format=DYNAMIC
innodb_large_prefix=ON
innodb_file_format=Barracuda
innodb_log_file_size=2G

  确保MSQL数据库5.7,及utf8mb4utf8mb4_bin

CREATE DATABASE jira CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;

生成破解许可

  直到配置许可时,在/root/.docker/atlassian目录下执行:

java -jar atlassian-agent.jar -d -m ***@163.com -n *** -p jira -o http://IP -s BXLB-ZOUP-KBKK-KYOK

  根据Server ID 生成license Key, 复制生成的KEY,点击Next

-p jira(安装的是jira产品),具体的可以根据-p进行参考
-m jira@jira.com(随意写)
-n jira(随意写)
-o https://jira.com (随意写)
-s BXLB-ZOUP-KBKK-KYOK (即jira显示的服务器ID)

创建账户

  破解后,继续设置账户即可。