在Docker中部署Confluence和jira-software

小生博客:http://xsboke.blog.51cto.com

    -------谢谢您的参考,如有疑问,欢迎交流


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?
                    [/opt/atlassian/jira]
                    /usr/local/confluence/etc

                    > 选择你的jira数据目录
                    Default location for JIRA Software data
                    [/var/atlassian/application-data/jira]
                    /usr/local/confluence/data

                    > 可以指定服务端口,这里是默认
                    Configure which ports JIRA Software will use.
                    JIRA requires two TCP ports that are not being used by any other
                    applications on this machine. The HTTP port is where you will access JIRA
                    through your browser. The Control port is used to startup and shutdown JIRA.
                    Use default ports (HTTP: 8080, Control: 8005) - Recommended [1, Enter], Set custom value for HTTP and Control ports [2]

                    > 是否将jira安装为服务,安装为服务后使用"/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?
                    Yes [y, Enter], No [n]
                    y

                    > 这里列出了你之前输入的配置信息,询问你否安装,回车即可
                    Details on where JIRA Software will be installed and the settings that will be used.
                    Installation Directory: /usr/local/confluence/etc
                    Home Directory: /usr/local/confluence/data
                    HTTP Port: 8080
                    RMI Port: 8005
                    Install as service: Yes
                    Install [i, Enter], Exit [e]

                    Extracting files ...

                    Please wait a few moments while JIRA Software is configured.

                    > jira software已经安装成功,是否现在启动
                    Installation of JIRA Software 8.2.1 is complete
                    Start JIRA Software 8.2.1 now?
                    Yes [y, Enter], No [n]
                    y

                    Please wait a few moments while JIRA Software starts up.
                    Launching JIRA Software ...

                    Installation of JIRA Software 8.2.1 is complete
                    Your installation of JIRA Software 8.2.1 is now ready and can be accessed
                    via your browser.
                    JIRA Software 8.2.1 can be accessed at http://localhost:8080
                    Finishing installation ...

        # 因为jira并没有自带java连接mysql的驱动器,所以这里需要自己下载,并且放入对应目录.
                wget https://cdn.mysql.com//Downloads/Connector-J/mysql-connector-java-5.1.47.tar.gz
                tar zxf mysql-connector-java-5.1.47.tar.gz
                cp mysql-connector-java-5.1.47/mysql-connector-java-5.1.47-bin.jar /usr/local/confluence/etc/lib/
                /etc/init.d/jira stop
                /etc/init.d/jira start

        # 到此就可以访问"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?sessionVariables=default_storage_engine=InnoDB</url>
        改为
        <url>jdbc:mysql://address=(protocol=tcp)(host=192.168.0.10)(port=3306)/jiradb?useSSL=false&amp;sessionVariables=default_storage_engine=InnoDB</url>

    重启jira
    /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?                               6.15.4应安装在何处?
                    [/opt/atlassian/confluence]
                    /usr/local/confluence/etc

                    Default location for Confluence data                                       confluence数据的默认位置
                    [/var/atlassian/application-data/confluence]
                    /usr/local/confluence/data

                    Configure which ports Confluence will use.
                    Confluence requires two TCP ports that are not being used by any other
                    applications on this machine. The HTTP port is where you will access
                    Confluence through your browser. The Control port is used to Startup and
                    Shutdown Confluence.
                    Use default ports (HTTP: 8090, Control: 8000) - Recommended [1, Enter], Set custom value for HTTP and Control ports [2]   1=默认,2=自定义
                    1

                    Confluence can be run in the background.                                      可以在后台运行Confluence。
                    You may choose to run Confluence as a service, which means it will start      您可以选择将Confluence作为服务运行,这意味着它将启动
                    automatically whenever the computer restarts.                                 自动每当计算机重新启动。
                    Install Confluence as Service?                                                安装Confluence作为服务?
                    Yes [y, Enter], No [n]                                                        Yes [y, Enter], No [n]
                    y

                    Extracting files ...

                    Please wait a few moments while we configure Confluence.

                    Installation of Confluence 6.15.4 is complete                                Confluence 6.15.4安装完成
                    Start Confluence now?                                                        现在启动Confluence吗?
                    Yes [y, Enter], No [n]
                    y

                    Please wait a few moments while Confluence starts up.
                    Launching Confluence ...

                    Installation of Confluence 6.15.4 is complete
                    Your installation of Confluence 6.15.4 is now ready and can be accessed via
                    your browser.
                    Confluence 6.15.4 can be accessed at http://localhost:8090
                    Finishing installation ...

        # wiki和jira一样并没有自带java连接mysql的驱动器,所以这里需要自己下载,并且放入对应目录.
            wget https://cdn.mysql.com//Downloads/Connector-J/mysql-connector-java-5.1.47.tar.gz
            tar zxf mysql-connector-java-5.1.47.tar.gz
            cp mysql-connector-java-5.1.47/mysql-connector-java-5.1.47-bin.jar /usr/local/confluence/etc/confluence/WEB-INF/lib/
            /etc/init.d/confluence restart

        # 到此就可以访问"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

原文地址:https://blog.51cto.com/xsboke/2403649

时间: 2024-11-05 13:40:11

在Docker中部署Confluence和jira-software的相关文章

如果在docker中部署tomcat,并且部署java应用程序

1.先说如何在docker中部署tomcat 第一步:root用户登录在系统根目录下创建文件夹tomcat7,命令如:mkdir tomcat7,并且切换到该目录下:cd tomcat7: 第二步:创建Dockerfile,命令如:touch Dockerfile: 第三步:编写Dockerfile,命令如:vim Dockerfile,完成以下命令编写: FROM ubuntu:14.04 MAINTAINER zhaichong <[email protected]> ENV REFRES

如何在Docker中部署DzzOffice

一.一些背景 之前研究Docker很久了,并且在公司内部实际使用起来了,目前分两种场景使用Docker 1.作为PAAS,提供一致,统一的编译/测试环境: 2.作为虚拟机,直接分配给新来的开发人员使用. 使用Docker一段时间之后,准备在公司内部使用Docker + Hadoop(HDFS)组件内部一个私有云,统一管理公司和产品/项目组内部的代码.文档. 我选择先从文档管理开始,在底层架子搭建好之后,需要给内部人员提供一个好的"门面",在没有这个门面之前,我们大量使用SSH+Comm

7条命令在docker中部署Mesos集群

7条命令在docker中部署Mesos集群 所有使用的Docker容器构建文件是有也.您可以在本地构建每个容器或只使用位于Docker Hub预构建的容器.下面的命令会自动下载所需的预建的容器为您服务.ZooKeeper?-?https://registry.hub.docker.com/u/garland/zookeeper/Meso Master?-?https://registry.hub.docker.com/u/garland/mesosphere-docker-mesos-maste

docker中部署mongodb副本集

1.基本信息如下 服务器地址 192.168.73.129 副本集名称 rs 容器节点及端口映射 m0 37017:27017 m1 47017:27017 m2 57017:27017 注:机器环境安装docker 2.部署步骤 2.1下载mongo镜像 docker pull mongo 2.2 启动三个节点 docker run --name m0 -p 37017:27017 -d mongo --replSet "rs" docker run --name m1 -p 470

在 Docker 中部署 ASP.NET CORE 应用

有了 Docker 之后, 部署起来却这间非常方便,环境不用搭了, 直接创建一个 microsoft/aspnetcore 的容器, 在本地开发好后, 把内容直接部署到容器中. 下面的命令是把本地发布的 ASP.NET CORE 程序文件夹映射到容器中指定的文件夹. docker run -p 8002:80 -v e:/docker/aspnetcore_web:/wwwroot -w /wwwroot/ microsoft/aspnetcore dotnet /wwwroot/WebAppl

记录在docker中部署pure-ftp

1.部署环境 普通物理机一台(6G内存,500G硬盘),windows server 2016操作系统. 安装vmware workstation  pro14,新建centos 7虚拟机. 2.在centos 7虚拟机中安装docker.创建容器.在容器中安装pure-ftp 2.1.禁用SELINUX #vi /etc/selinux/config SELINUX有以下三种设置,设置为第一种 SELINUX=disabled SELINUX=enforcing SELINUX=permiss

Docker中部署Tomcat,并且部署Java应用程序

Dockerfile FROM tomcat:9.0-jre8-alpine MAINTAINER louguanyang <[email protected]> VOLUME /tmp ARG JAR_FILE RUN apk add -U tzdata RUN cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime RUN echo "Asia/Shanghai" > /etc/timezone RUN apk de

Windows10系统下在Docker中部署静态网站

1.关于docker的安装和docker命令这里不写.可以查看我上一篇文章. 准备dockerfile文件和 index.html .   假设文件在c:/mufolder/目录 1. Dockerfile 内容如下: #Dockerfile FROM httpd #copy 命令,将./myfolder/ 目录文件全部copy到 docker里htdocs目录. 这里我不用. #COPY ./myfolder/ /usr/local/apache2/htdocs/ WORKDIR /usr/l

在Docker中从头部署自己的Spark集群

由于自己的电脑配置普普通通,在VM虚拟机中搭建的集群规模也就是6个节点左右,再多就会卡的不行 碰巧接触了Docker这种轻量级的容器虚拟化技术,理论上在普通PC机上搭建的集群规模可以达到很高(具体能有多少个也没有实际测试过) 于是就准备在Docker上搭建Spark集群 由于是Docker新手,在操作过程中遇到了不少麻烦 刚开始在网上找的资料都是直接从DockerHub上拉取别人已经建好的镜像使用 问题多多,下载速度慢,下载异常,运行异常,配置异常等等等等... 好不容易下载了一个可以用的镜像,