Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

简简单单之Docker部署Confluence #102

Open
kemistep opened this issue Apr 13, 2021 · 0 comments
Open

简简单单之Docker部署Confluence #102

kemistep opened this issue Apr 13, 2021 · 0 comments

Comments

@kemistep
Copy link
Contributor

Step-1. 制作破解镜像

在宿主机上新建相关目录及文件

# 创建目录,用于制作镜像
mkdir -p /atlassian/build/confluence
# 创建目录,用于挂载配置信息
mkdir -p /atlassian/confluence
# 创建目录,用于挂载数据信息
mkdir -p /atlassian/application-data/confluence
# 进入目录
cd /atlassian/build/confluence
# 创建Dockerfile文件
vim Dockerfile
复制代码

在 Dockerfile 输入以下内容

FROM cptactionhank/atlassian-confluence
USER root

# 将代理破解包加入容器
COPY "atlassian-agent.jar" /opt/atlassian/confluence/
# 将中文字体加入容器
COPY fonts/MSYH.TTC /usr/share/fonts/chinese/

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

# 设置启动加载所需字体
RUN echo 'export CATALINA_OPTS="-Dconfluence.document.conversion.fontpath=/usr/share/fonts/chinese/ ${CATALINA_OPTS}"' >> /opt/atlassian/confluence/bin/setenv.sh
复制代码

制作镜像

docker build -f Dockerfile -t hub.conow.cn/atlassian/confluence .
复制代码

Step-2. 准备 MySQL 相关文件

创建数据库配置文件

# 创建目录
mkdir -p /atlassian/mysql/config
mkdir -p /atlassian/mysql/data
# 进入目录
cd /atlassian/mysql/config
# 创建my.cnf文件
vim my.cnf
复制代码

输入以下内容

[mysqld]
user=mysql
character-set-server=utf8
collation-server=utf8_bin
default-storage-engine=INNODB
max_allowed_packet=256M
innodb_log_file_size=2GB
transaction-isolation=READ-COMMITTED
binlog_format=row
default_authentication_plugin=mysql_native_password

[client]
default-character-set=utf8

[mysql]
default-character-set=utf8
复制代码

Step-3. 配置 docker-compose.yml 启动文件

cd /atlassian
vim docker-compose.yml
复制代码

在 docker-compose.yml 输入以下内容

version: '2'
services:
    mysql-atlassian:
        image: mysql/mysql-server:5.6.41
        restart: always
        privileged: true
        hostname: mysql-atlassian
        container_name: mysql-atlassian
        ports:
            - 3390:3306
        environment:
            MYSQL_USER: confluence
            MYSQL_PASSWORD: ********
            MYSQL_ROOT_PASSWORD: ********
        volumes:
            - /etc/localtime:/etc/localtime
            - /atlassian/mysql/config/my.cnf:/etc/my.cnf
            - /atlassian/mysql/data:/var/lib/mysql
    confluence:
        image: hub.conow.cn/atlassian/confluence
        restart: always
        hostname: confluence
        container_name: confluence
        ports:
            - 8090:8090
            - 8091:8091
        depends_on:
            - mysql-atlassian
        volumes:
            - /etc/localtime:/etc/localtime
            - /atlassian/confluence:/var/atlassian/confluence
            - /atlassian/application-data/confluence:/var/atlassian/application-data/confluence
            - /atlassian/build/confluence/conf/server.xml:/opt/atlassian/confluence/conf/server.xml
复制代码

Step-4. 启动

docker-compose up -d
复制代码

运行服务后,在页面获取到 Server ID 再执行下面命令

# 详情可执行:java -jar atlassian-agent.jar 
java -jar atlassian-agent.jar -d -m [email protected] -n conow -p conf -o http://172.16.2.12 -s B4VX-C9A0-CILF-EVL2
复制代码

-m 邮箱地址
-n 名称
-p 产品类型
-o 服务器地址
-s Server ID

配置集群节点

cd /atlassian/application-data/confluence
mkdir index/conow
# 页面配置的时候,在共享目录栏中输入:/var/atlassian/application-data/confluence/index/conow
复制代码

配置 MySQL

# 进入MySQL容器
docker-compose exec mysql-atlassian bash

# 进入mysql
> mysql -uroot -p
> 输入刚才启动服务时候指定的MYSQL_ROOT_PASSWORD密码
> use mysql
# 创建用户(启动容器命令中有写就可忽略)
> create user 'confluence'@'%' identified by '1qaz2wsx';
# 分配权限,允许远程访问
> GRANT ALL PRIVILEGES ON *.* TO 'confluence'@'%' WITH GRANT OPTION;
# 使修改生效
> flush privileges;
# 创建数据库
> create database wiki character set utf8 collate utf8_bin;
复制代码

https://juejin.cn/post/6844903877154717710

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant