当前位置:首页 >> 服务器

在Docker中部署Confluence和jira-software的方法步骤

version:

 centos==7.2
 jdk==1.8
 confluence==6.15.4
 jira-software==8.2.1
 docker==18.09

安装前提示:

    1. 需要准备2个数据库,因为confluence和jira-software的mysql配置要求不一样
    2. confluence需要配置jdk,jira-software自带jdk

选择使用docker部署的原因:

    1. confluence和jira-software环境需求不同,需要分开配置.
    2. 如果直接使用物理机,需要占用多台.
    3. 不使用虚拟机是因为docker更轻量,而且更容易迁移.
    4. confluence和jira-software只是作为公司内部员工使用,不需要太高的配置和复杂的环境

此次部署流程:

    1. 配置jira-software需要的数据库
    2. 配置jira-software
    3. 配置confluence需要的数据库
    4. 配置confluence

容器名称和IP分布:

    因为wiki的账号可以由jira控制,所以我们首先安装jira-software

    宿主机IP:10.0.0.25

    1. jira-software
        jira-mysql          192.168.0.10
        confluence-jira     192.168.0.100

    2. confluence
        wiki-mysql          192.168.0.20
        confluence-wiki     192.168.0.200

一、docker-ce环境配置

1. 安装docker

  $ sudo yum remove docker       docker-client       docker-client-latest       docker-common       docker-latest       docker-latest-logrotate       docker-logrotate       docker-engine

  $ sudo yum install -y yum-utils   device-mapper-persistent-data   lvm2

  $ sudo yum-config-manager    --add-repo    https://download.docker.com/linux/centos/docker-ce.repo

  $ sudo yum install docker-ce docker-ce-cli containerd.io

  $ sudo systemctl enable docker

  $ sudo systemctl start docker

 2. 配置添加自定义网桥,用于指定docker容器IP

  $ docker network create   --driver=bridge   --subnet=192.168.0.0/24   --ip-range=192.168.0.0/24   --gateway=192.168.0.254   br-custom

3. 下载由官方提供的容器基础镜像

docker pull centos:7.5.1511
docker pull mysql:5.7.26

4. 迁移docker容器默认存放目录

systemctl stop docker
mv /var/lib/docker /data/docker
ln -s /data/docker /var/lib/docker
systemctl start docker

二、jira-software部署

 创建目录:

mkdir -p /docker-storage/confluence/jira/{etc,data,mysql}

释:

/docker-storage/confluence/jira/mysql   :   MySQL容器的数据目录
/docker-storage/confluence/jira/etc     :   jira-software容器的安装目录
/docker-storage/confluence/jira/data    :   jira-software容器的数据目录

1. 部署并且配置jira需要的MySQL

  # 启动容器
   docker run --name jira-mysql --network br-custom --ip 192.168.0.10    -v /docker-storage/confluence/jira/mysql:/var/lib/mysql    -e MYSQL_ROOT_PASSWORD='123456Qr!'    -d mysql:5.7.26

  # 进入容器修改MySQL配置,并且创建jira-software需要的数据库
   docker exec -it jira-mysql "/bin/bash"

   apt update
   apt-get install vim

   vim /etc/mysql/mysql.conf.d/mysqld.cnf
    [mysqld]
    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
    sql_mode = NO_AUTO_VALUE_ON_ZERO

   mysql -uroot -p123456Qr!
    CREATE DATABASE jiradb CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
    GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,REFERENCES,ALTER,INDEX on jiradb.* TO 'confluence-jira'@'192.168.0.%' IDENTIFIED BY '123456Qr!';
    flush privileges;

  # 重启容器使MySQL配置生效
   docker restart jira-mysql

2. 部署jira-software

  # 安装jira-software的四个重要选项
   安装类型 - 选择选项2(自定义)以获得最多控制权. 
   目标目录 - 这是安装Jira的地方.
   主目录  - 这是存储日志,搜索索引和文件等Jira数据的地方.
   TCP端口  - 这些是HTTP连接器端口和Jira将运行的控制端口.除非您在同一端口上运行其他应用程序,否则请使用默认值.
   安装为服务 - 使用"/etc/init.d/jira [stop | start]"命令来控制jira服务.

  # 部署容器并且安装jira-software
   docker run -dit --name confluence-jira --network br-custom --ip 192.168.0.100 -p 10.0.0.25:10010:8080    -v /docker-storage/confluence/jira/:/usr/local/confluence/    -v /docker-storage/confluence/jira/etc/:/usr/local/confluence/etc/    -v /docker-storage/confluence/jira/data/:/usr/local/confluence/data/    centos:7.2.1511 "/bin/bash"

   docker exec -it confluence-jira "/bin/bash"

   yum -y install epel-release
   yum -y install libffi-devel gcc gcc-c++ make automake zlib zlib-devel openssl-devel wget gcc gcc-c++ make automake zlib zlib-devel openssl-devel dejavu-sans-fonts vim lrzsz

   wget https://product-downloads.atlassian.com/software/jira/downloads/atlassian-jira-software-8.2.1-x64.bin

   chmod a+x atlassian-jira-software-8.2.1-x64.bin

   ./atlassian-jira-software-8.2.1-x64.bin
    > 交互式安装过程:
     Unpacking JRE ...
     Starting Installer ...

     > 这会在你的计算机中安装jira software,回车即可
     This will install JIRA Software 8.2.1 on your computer.
     OK [o, Enter], Cancel [c]

     Click Next to continue, or Cancel to exit Setup.

     > 这里输入1是默认安装,2是自定义安装,3是更新,选择2
     Choose the appropriate installation or upgrade option.
     Please choose one of the following:
     Express Install (use default settings) [1], Custom Install (recommended for advanced users) [2, Enter], Upgrade an existing JIRA installation [3]
     2

     > 选择你的jira安装目录
     Select the folder where you would like JIRA Software to be installed.
     Where should JIRA Software be installed"/etc/init.d/jira [stop | start]"来控制jira的停止和启动.
     JIRA can be run in the background.
     You may choose to run JIRA as a service, which means it will start
     automatically whenever the computer restarts.
     Install JIRA as Service"http://10.0.0.25:10010"初始化你的jira-software配置,暂时先使用jira的试用授权许可(普通版)

  # 破解jira-software
   > 备份原文件
    mv /usr/local/confluence/etc/atlassian-jira/WEB-INF/lib/atlassian-extras-3.2.jar /root/

   > 将破解文件移动到源位置
    cp atlassian-extras-3.2.jar /usr/local/confluence/etc/atlassian-jira/WEB-INF/lib/atlassian-extras-3.2.jar

   > 重启服务
    /etc/init.d/jira stop
    /etc/init.d/jira start

   > 查看许可证过期时间
    许可证状态查看http://10.0.0.25:10010/plugins/servlet/applications/versions-licenses

三、jira-software启动后问题处理.

处理/usr/local/confluence/etc/logs/catalina.out警告:

        Fri May 31 12:05:49 UTC 2019 WARN: Establishing SSL connection without server's identity verification is
        not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be
        established by default if explicit option isn't set. For compliance with existing applications not using
        SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by
        setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.

问题

 vim /usr/local/confluence/data/dbconfig.xml
  <url>jdbc:mysql://address=(protocol=tcp)(host=192.168.0.10)(port=3306)/jiradb"htmlcode">
  <url>jdbc:mysql://address=(protocol=tcp)(host=192.168.0.10)(port=3306)/jiradb"htmlcode">
 /etc/init.d/jira stop
 /etc/init.d/jira start

四、confluence部署

创建目录:

mkdir -p /docker-storage/confluence/wiki/{etc,data,mysql}

释:
/docker-storage/confluence/wiki/mysql   :   MySQL容器的数据目录
/docker-storage/confluence/wiki/etc     :   wiki容器的安装目录
/docker-storage/confluence/wiki/data    :   wiki容器的数据目录

 1. 部署并且配置wiki需要的MySQL

# 启动容器
   docker run --name wiki-mysql --network br-custom --ip 192.168.0.20    -v /docker-storage/confluence/wiki/mysql:/var/lib/mysql    -e MYSQL_ROOT_PASSWORD='123456Qr!'    -d mysql:5.7.26

  # 进入容器修改MySQL配置,并且创建jira-software需要的数据库
   docker exec -it wiki-mysql "/bin/bash"

   apt update
   apt-get install vim

   vim /etc/mysql/mysql.conf.d/mysqld.cnf
    [mysqld]
    character-set-server=utf8
    collation-server=utf8_bin
    default-storage-engine=INNODB
    max_allowed_packet=256M
    innodb_log_file_size=2GB
    sql_mode = NO_AUTO_VALUE_ON_ZERO
    transaction-isolation=READ-COMMITTED
    binlog_format=row

   mysql -uroot -p123456Qr!
    CREATE DATABASE confluence CHARACTER SET utf8 COLLATE utf8_bin;
    GRANT ALL PRIVILEGES ON confluence.* TO 'confluence_user'@'192.168.0.%' IDENTIFIED BY '123456Qr!';
    flush privileges;

  # 重启容器使MySQL配置生效
   docker restart wiki-mysql

2. 部署wiki
      

 # 安装wiki的选项和jira几乎相同

  # 部署容器并且安装wiki
   docker run -dit --name confluence-wiki --network br-custom --ip 192.168.0.200 -p 10.0.0.25:10020:8090    -v /docker-storage/confluence/wiki/:/usr/local/confluence/    -v /docker-storage/confluence/wiki/etc/:/usr/local/confluence/etc/    -v /docker-storage/confluence/wiki/data/:/usr/local/confluence/data/    centos:7.2.1511 "/bin/bash"

   docker exec -it confluence-wiki "/bin/bash"

   yum -y install epel-release
   yum -y install libffi-devel gcc gcc-c++ make automake zlib zlib-devel openssl-devel wget gcc gcc-c++ make automake zlib zlib-devel openssl-devel dejavu-sans-fonts vim lrzsz

  # wiki需要手动配置jdk
   wget https://download.oracle.com/otn/java/jdk/8u202-b08/1961070e4c9b4e26a04e7f5a083f551e/jdk-8u202-linux-x64.tar.gz
   tar zxf jdk-8u202-linux-x64.tar.gz 
   mv jdk1.8.0_202 /usr/local/jdk1.8

   vim /etc/profile
    export JAVA_HOME=/usr/local/jdk1.8
    export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
    export PATH=$PATH:$JAVA_HOME/bin

   source /etc/profile

  # 安装wiki
   wget https://product-downloads.atlassian.com/software/confluence/downloads/atlassian-confluence-6.15.4-x64.bin

   chmod a+x atlassian-confluence-6.15.4-x64.bin

   ./atlassian-confluence-6.15.4-x64.bin
    > 交互式安装过程:
     This will install Confluence 6.15.4 on your computer.
     OK [o, Enter], Cancel [c]         

     Click Next to continue, or Cancel to exit Setup.

     Choose the appropriate installation or upgrade option.
     Please choose one of the following:
     Express Install (uses default settings) [1],     快速安装
     Custom Install (recommended for advanced users) [2, Enter], 自定义安装 -
     Upgrade an existing Confluence installation [3]    升级
     2

     Select the folder where you would like Confluence 6.15.4 to be installed, 选择要安装Confluence 6.15.4的文件夹,
     then click Next.               然后单击Next。
     Where should Confluence 6.15.4 be installed"http://10.0.0.25:10020"初始化你的wiki配置,暂时不要选择组件,直接配置到有server ID的那一页

  # 破解wiki和jira完全不同,需要两步,一是破解文件,二是获取授权码
   > 将wiki的/usr/local/confluence/etc/confluence/WEB-INF/lib/atlassian-extras-decoder-v2-3.4.1.jar文件下载到本地重命名为atlassian-extras-2.4.jar
   > 找到破解软件,右击confluence_keygen.jar使用java运行(需要在windows上安装好java)
   > 选择".patch"找到刚才从wiki上下载下来并且重命名的文件打开
   > 注意破解程序暂时别关闭
   > 然后打开你下载的破解包的文件目录,可以看到atlassian-extras-2.4.jar和atlassian-extras-2.4.bak两个文件,这里atlassian-extras-2.4.jar已经是破解好的
   > 将atlassian-extras-2.4.jar名字改回为atlassian-extras-decoder-v2-3.4.1.jar然后传到wiki的/usr/local/confluence/etc/confluence/WEB-INF/lib/下

   /etc/init.d/confluence restart

   > 复制网页中的server ID,然后返回你的破解程序,将server ID填入到破解程序,并且填入其他信息(随意填,邮箱格式要正确)
   > 点击破解程序".gen!"按钮,然后将生成的key填入web中即可

五、confluence问题处理

对于console报错500,atlassian的社区帮助这样回复

 1. confluence配置完成后发现css样式不显示,并且console报错500

atlassian的社区帮助这样提示:

confluence帐户必对目录 <confluence_home>和<confluence_install> 拥有读/写/执行权限

解决办法(不要加-R):

chmod 755 /usr/local/confluence/data

2. wiki登录后提示:在您系统中的服务器 SQL 模式健康检查失败了.

进入wiki-mysql容器注释如下行

 vim /etc/mysql/mysql.conf.d/mysqld.cnf
   # sql_mode = NO_AUTO_VALUE_ON_ZERO

  docker restart wiki-mysql

3. 处理catalina.out警告:

处理/usr/local/confluence/etc/logs/catalina.out警告:

Fri May 31 12:16:44 UTC 2019 WARN: Establishing SSL connection without server's identity verification is not recommended.
            According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit
            option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'.
            You need either to explicitly disable SSL by setting useSSL=false,
            or set useSSL=true and provide truststore for server certificate verification

问题

vim /usr/local/confluence/data/confluence.cfg.xml 
   <property name="hibernate.connection.url">jdbc:mysql://192.168.0.20:3306/confluence</property>

改为

<property name="hibernate.connection.url">jdbc:mysql://192.168.0.20:3306/confluence?useSSL=false</property>

  /etc/init.d/confluence restart

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。