第八章 Docker部署Jira服務
阿新 • • 發佈:2021-07-11
一、構建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 [email protected] -n BAT -p conf -o http://192.168.0.89 -s BTW4-2T4Y-9BTK-R0DP
複製伺服器ID: BTW4-2T4Y-9BTK-R0DP
在本地存放atlassian-agent.jar的目錄下執行命令,生成許可證:
需替換郵箱([email protected])、名稱(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 [email protected] -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全部完成。