第八章 Docker部署Jira服务

一、构建Dockerfile

#1.新建dockerfile存放目录
[root@staging docker_file]# mkdir jira
[root@staging docker_file]# ll
total 0
drwxr-xr-x 2 root root 51 May 28 10:45 confluence
drwxr-xr-x 2 root root  6 Jun  1 18:16 jira

#2.编写dockerfile
[root@staging docker_file]# cd jira/
[root@staging jira]# cat Dockerfile
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

二、下载破解包

下载地址:https://files.cnblogs.com/files/sanduzxcvbnm/atlassian-agent-v1.2.3.zip
#1.下载破解包
[root@staging jira]# wget https://files.cnblogs.com/files/sanduzxcvbnm/atlassian-agent-v1.2.3.zip 

#2.解压破解包
[root@staging jira]# unzip atlassian-agent-v1.2.3.zip 

#3.将atlassian-agent.jar移动到当前目录下
[root@staging jira]# mv atlassian-agent-v1.2.3/atlassian-agent.jar ./
[root@staging jira]# ll
total 956
-rw-r--r-- 1 root root 974241 Oct 10  2019 atlassian-agent.jar
-rw-r--r-- 1 root root    313 Jun  1 18:28 Dockerfile

三、构建镜像

#1.构建镜像
[root@staging jira]# docker build -t jira:latest ./

#2.创建/home/jira目录
[root@staging jira]# mkdir /data3/jira

#3.查看docker镜像
[root@staging jira]# docker images
REPOSITORY                                                          TAG                 IMAGE ID            CREATED             SIZE
jira                                                                latest              959de0407cc8        44 seconds ago      645 MB
docker.io/cptactionhank/atlassian-jira-software                     latest              2cbc059748d4        10 hours ago        644 MB

#4.启动容器
[root@staging jira]# docker run -d -v /data3/jira:/var/atlassian/application-data/jira --name="jira" -d -p 8092:8080 jira:latest
8dea79eff7eb65466efd6f2eded2ab3004b50835072cf8421790f53338c4df3d

#5.查看镜像
[root@staging jira]# docker ps
CONTAINER ID        IMAGE                 COMMAND                  CREATED              STATUS                       PORTS                              NAMES
8dea79eff7eb        jira:latest           "/docker-entrypoin..."   About a minute ago   Up About a minute            0.0.0.0:8092->8080/tcp             jira

四、访问JIRA

#1.访问 IP:port,如:192.168.1.18:8092,出现以下界面,点击language,选择安装语言为中文,点击保存。

#2.选择我将设置它自己,点击继续。

五、配置数据库

#1.Docker启动一个数据库
[root@staging jira]# mkdir /data3/config/mysql/
[root@staging jira]# touch /data3/config/mysql/mysqld.cnf
[root@staging jira]# mkdir /data3/data/mysql
[root@staging jira]# docker run --name mysql5.7 -p 13306:3306 -v /data3/config/mysql/mysqld.cnf:/etc/mysql/my.cnf -v /data3/data/mysql:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=123456 -d mysql:5.7

#2.进入数据库
[root@staging jira]# docker ps
CONTAINER ID        IMAGE                 COMMAND                  CREATED             STATUS                  PORTS                               NAMES
fd0e41d45de8        mysql:5.7             "docker-entrypoint..."   About an hour ago   Up About an hour        0.0.0.0:3306->3306/tcp, 33060/tcp   mysql5.7
[root@staging jira]# docker exec -it fd0e41d45de8 bash

root@fd0e41d45de8:/# mysql -P 13306 -u root -p  #打开、进入数据库

#3.创建数据库
mysql> CREATE DATABASE jiradb_new CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
Query OK, 1 row affected (0.36 sec)

#4.创建并授权用户访问jiradb数据库
mysql> create user 'jirauser'@'%' identified by 'jirapass';
Query OK, 0 rows affected (1.58 sec)

mysql> grant all privileges on jiradb_new.* to 'jirauser'@'%' with grant option;
Query OK, 0 rows affected (0.17 sec)

#5.刷新权限
mysql> flush privileges;
Query OK, 0 rows affected (0.44 sec)

#6.设置开头的事务级别
mysql> set global tx_isolation='READ-COMMITTED';
Query OK, 0 rows affected, 1 warning (0.00 sec)

#7.修改数据库配置文件my.cnf
[mysqld] 在文件中找到该 部分,并添加或修改以下参数:

将默认存储引擎设置为 InnoDB:

[mysqld]
...
default-storage-engine=INNODB
...
指定数据库服务器使用的字符集:

[mysqld]
...
character_set_server=utf8mb4
...
将默认行格式设置为 DYNAMIC:

[mysqld]
...
innodb_default_row_format=DYNAMIC
...
启用大前缀:

[mysqld]
...
innodb_large_prefix=ON
...
将 InnoDB 文件格式设置为 Barracuda:

[mysqld]
...
innodb_file_format=Barracuda
...
指定的值 innodb_log_file_size 至少为 2G:

[mysqld]
...
innodb_log_file_size=2G
...
确保 sql_mode 参数未指定 NO_AUTO_VALUE_ON_ZERO

// remove this if it exists
sql_mode = NO_AUTO_VALUE_ON_ZERO

#8.重启数据库
[root@staging mysql]# docker restart fd0e41d45de8
fd0e41d45de8

#9.这里选择其他数据库,类型为MySQL8.0:
输入相应的主机名,数据库名称,用户名和密码,点击测试连接,成功点击下一步

#10.填写相应的程序标题,选择相应的模式,进本URL,填写完成后单击下一步。

#11.复制如下服务器ID

六、破解JIRA

1.生成JIRA许可命令

# 设置产品类型:-p conf, 详情可执行:java -jar atlassian-agent.jar 
java -jar atlassian-agent.jar -d -m test@test.com -n BAT -p conf -o http://192.168.0.89 -s BTW4-2T4Y-9BTK-R0DP

复制服务器ID: BTW4-2T4Y-9BTK-R0DP
在本地存放atlassian-agent.jar的目录下执行命令,生成许可证:
需替换邮箱(test@test.com)、名称(BAT)、访问地址(http://192.168.0.89)、服务器ID(BTW4-2T4Y-9BTK-R0DP)为你的信息

2.生成许可证:

#1.查看docker容器
[root@staging atlassian-agent-v1.2.3]# docker ps -a
CONTAINER ID        IMAGE                 COMMAND                  CREATED             STATUS                 PORTS                              NAMES
8dea79eff7eb        jira:latest           "/docker-entrypoin..."   13 days ago         Up 13 days             0.0.0.0:8092->8080/tcp             jira
fd65270e17d6        amancevice/superset   "gunicorn superset..."   13 days ago         Up 13 days (healthy)   0.0.0.0:523->8088/tcp              heuristic_mccarthy
ed2bb7849dec        confluence:latest     "/docker-entrypoin..."   2 weeks ago         Up 13 days             0.0.0.0:8090-8091->8090-8091/tcp   confluence-new-7.9.3

#2.进入jira容器
[root@staging atlassian-agent-v1.2.3]# docker exec  -it 8dea79eff7eb bash

#3.生成许可证
bash-4.4# cd /opt/atlassian/jira/
bash-4.4# java -jar atlassian-agent.jar -d -m hui.jin@dataxgroup.com -n BAT -p conf -o http://192.168.1.18 -s BTUP-U4IX-BEOT-JW0W

====================================================
=======        Atlassian Crack Agent         =======
=======           https://zhile.io           =======
=======          QQ Group: 30347511          =======
====================================================

Your license code(Don't copy this line!!!):

AAABjg0ODAoPeJyNkltvgkAQhd/5FSR9hrJ4N9mkCqShATUV+77iqNvgQmYXW/vruwim3mKabEiWz
Dl75pt5Skow30phko7p9IetwZAQ8zVOTNdxibFBALHNiwLQjngKQkJyKGDCdkC9aRwH7144igwPg
SmeC58poJXQcroW6RgPJD7IFHlRqehCZHzHFazMrBaYy4O5VaqQw+fnny3PwOa5ETMuFAgmUgi+C
46H5rX+wHJ6+hifHNkpZbDitfUkCuMwCXxjUu6WgNP1QgJKapFTuAdeBearMlV2dbFkvlZfDMG+M
XpQy1LF90AVlnDB8vz/A7lOxTzQXWNd2uD50A9XzbnGvFz+YTyWBHuWlcdh0DXLZGN/bTTFDRNc1
nUVaQ2aDFybdPu2Y7eJ4eVC6ZCBhp5RBVK9VB87zXe14X0I/2xrrhhWUeqAzRxCn0ahPw8mVkS6b
qvX7rY6pOdejvXeJs0B94BaPu6MZ/c29nYXZiWmWybhel/PxUdaBXLZ9KOT0TvpGlDHUONR8gv5t
yJtMCwCFE4iI87rvt/tLaS31y6b5EX26JbiAhQXjJC5T1HSsq5pttx24DbUFXMKPg==X02jb

3.复制生成的许可证,完成破解

七、配置JIRA

1.设置管理员账户

# 填写相应的管理员账户信息,填写完成后点击下一步

2.设置邮件服务器

# 邮件服务器可以立即设置,也可以稍后设置,这里选择以后再说,点击完成。

3.选择语言

# 选择语言为中文,点击continue。

4.设置头像

# 选择一个喜欢的头像,或者自己上传头像,选择完成后,单击下一步。

5.创建项目

#1.这里单击选择创建新项目

#2.选择项目管理,单击下一步

#3.直接点击选择

#4.给这个项目取个名称,点击提交

#4.创建完成后出现以下页面

#5.点击设置-->点击系统,输入管理员密码,

#6.点击应用程序,查看版本信息,许可证过期时间。至此Docker部署JIRA全部完成。

posted @ 2021-07-11 13:12  年少纵马且长歌  阅读(2223)  评论(0编辑  收藏  举报