赞
踩
原文地址:Docker 部署 Atlassian Confluence 搭建企业Wiki
公司企业wiki就是使用Confluence搭建的,产品研发过程中的需求文档、产品设计文档、项目管理文档、技术文档、运维文档等等都统一发布在wiki中,并不断地迭代维护。所以想着自己的协同的办公也可使用Confluence来实现。
一开始是通过非容器的形式部署Confluence,但是过程稍显繁杂,后面从运维那得知Docker中有Confluence的镜像,一切就变得简单了。
在一切开始之前先启动我们的CentOS7.2,然后再启动Docker,因为后面mysql和confluence的安装和部署全部是在Docker中完成(CentOS系统、Docker的安装和使用可以查看博主相关的博文)
下面是启动docker的指令
[root@centos7-1 ~]# systemctl start docker
建议重新安装mysql,博主在部署完confluence使用现有的mysql时出现了各种问题,主要出在配置文件上,但是配置文件的内容适用于博主的以往的其他服务,在不影响以往服务和数据的前提下,博主选择重新安装并配置mysql。
[root@centos7-1 ~]# docker search mysql
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
mysql MySQL is a widely used, open-source relation… 8474 [OK]
mariadb MariaDB is a community-developed fork of MyS… 2923 [OK]
mysql/mysql-server Optimized MySQL Server Docker images. Create… 626 [OK]
percona Percona Server is a fork of the MySQL relati… 441 [OK]
centurylink/mysql Image containing mysql. Optimized to be link… 60
...
[root@centos7-1 ~]# docker pull mysql:5.7
[root@centos7-1 ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
mysql 5.7 2151acc12881 2 weeks ago 445MB
[root@centos7-1 ~]# mkdir -p /export/config/mysql
[root@centos7-1 ~]# touch /export/config/mysql/mysqld.cnf
[root@centos7-1 ~]# mkdir -p /export/data/mysql
[root@centos7-1 ~]# vi /export/config/mysql/mysqld.cnf
mysqld.cnf配置的内容如下(前面一部分是mysql默认的配置内容,后面7行配置时confluence官网指定的自定义配置),直接粘贴复制到mysqld.cnf文件即可
# Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; version 2 of the License. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # # The MySQL Server configuration file. # # For explanations see # http://dev.mysql.com/doc/mysql/en/server-system-variables.html [mysqld] pid-file = /var/run/mysqld/mysqld.pid socket = /var/run/mysqld/mysqld.sock datadir = /var/lib/mysql log-error = /var/log/mysql/error.log # By default we only accept connections from localhost #bind-address = 127.0.0.1 # Disabling symbolic-links is recommended to prevent assorted security risks symbolic-links=0 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
[root@centos7-1 ~]# docker run --name mysql8 -p 3306:3306 -v /export/config/mysql8/mysqld.cnf:/etc/mysql/my.cnf -v /export/data/mysql8:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=123456 -d mysql
[root@centos7-1 ~]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
a948c9eb4389 mysql "docker-entrypoint.s…" 8 minutes ago Up 8 minutes 0.0.0.0:3306->3306/tcp, 33060/tcp mysql8
[root@centos7-1 ~]# docker exec -it mysql bash
root@a948c9eb4389:/#
root@a948c9eb4389:/# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.27 MySQL Community Server (GPL)
Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
在上面的过程中需要输入密码,密码为启动容器时设定的密码123456
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '1Aa@11';
Query OK, 0 rows affected (0.51 sec)
mysql>
安全考虑,设置root用户只能本地登录
mysql> CREATE USER 'zaomianbao'@'%' IDENTIFIED WITH mysql_native_password BY '1Aa@11';
Query OK, 0 rows affected (0.02 sec)
mysql>
mysql> GRANT ALL PRIVILEGES ON *.* TO 'zaomianbao'@'%';
Query OK, 0 rows affected (0.01 sec)
mysql>
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
mysql>
[root@centos7-1 ~]# docker search confluence
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
atlassian/confluence-server Official Confluence Server image – create, o… 319 [OK]
blacklabelops/confluence Dockerized Atlassian Confluence 41 [OK]
derjudge/confluence A batteries-included image for running Atlas… 12 [OK]
goellnerit/confluence-docker 8 [OK]
...
[root@centos7-1 ~]# docker pull atlassian/confluence-server
...
[root@centos7-1 ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
atlassian/confluence-server latest 8e02e7d24a38 1 minites ago 822MB
...
[root@centos7-1 ~]# mkdir /export/data/confluence
[root@centos7-1 ~]# docker run -v /export/data/confluence/:/var/atlassian/application-data/confluence/ --name="confluence" -d -p 8090:8090 -p 8091:8091 atlassian/confluence-server
e6b421dc43d352f1e1f57a4d50d8cdd8441683bfc087d99829753ad1bea0ee67
[root@centos7-1 ~]#
[root@centos7-1 ~]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
e6b421dc43d3 atlassian/confluence-server "/tini -- /entrypoin…" 40 seconds ago Up 38 seconds 0.0.0.0:8090-8091->8090-8091/tcp confluence
a948c9eb4389 mysql "docker-entrypoint.s…" 48 minutes ago Up 48 minutes 0.0.0.0:3306->3306/tcp, 33060/tcp mysql8
上面显示"Up 38 seconds",已运行38秒,代表容器正常启动了
[root@centos7-1 ~]# mkdir -p /export/software
[root@centos7-1 ~]# cd /export/software/
[root@centos7-1 software]# wget http://cdn-blog.oss-cn-beijing.aliyuncs.com/k2p-frp/atlassian-extras-decoder-v2-3.2.jar
[root@centos7-1 software]# wget http://cdn-blog.oss-cn-beijing.aliyuncs.com/k2p-frp/atlassian-universal-plugin-manager-plugin-2.22.jar
[root@centos7-1 software]# ls
atlassian-universal-plugin-manager-plugin-2.22.jar atlassian-extras-decoder-v2-3.2.jar
[root@centos7-1 software]# cd
[root@centos7-1 ~]# docker exec -it confluence bash
root@e6b421dc43d3:/var/atlassian/application-data/confluence#
先备份confluence中原先的jar,这里是将2个jar移至mnt目录下
root@e6b421dc43d3:/var/atlassian/application-data/confluence# mv /opt/atlassian/confluence/confluence/WEB-INF/lib/atlassian-extras-decoder-v2-3.4.1.jar /mnt/
root@e6b421dc43d3:/var/atlassian/application-data/confluence# mv /opt/atlassian/confluence/confluence/WEB-INF/atlassian-bundled-plugins/atlassian-universal-plugin-manager-plugin-3.0.1.jar /mnt/
备份好文件后,退出confluence容器。拷贝下载的文件到confluence容器中
root@e6b421dc43d3:/var/atlassian/application-data/confluence# exit
exit
[root@centos7-1 ~]# cd /export/software/
[root@centos7-1 software]# docker cp atlassian-extras-decoder-v2-3.2.jar confluence:/opt/atlassian/confluence/confluence/WEB-INF/lib/
[root@centos7-1 software]# docker cp atlassian-universal-plugin-manager-plugin-2.22.jar confluence:/opt/atlassian/confluence/confluence/WEB-INF/atlassian-bundled-plugins/
重新启动confluence
[root@centos7-1 software]# cd
[root@centos7-1 ~]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
e6b421dc43d3 atlassian/confluence-server "/tini -- /entrypoin…" 48 minutes ago Up 48 minutes 0.0.0.0:8090-8091->8090-8091/tcp confluence
a948c9eb4389 mysql "docker-entrypoint.s…" 2 hours ago Up 2 hours 0.0.0.0:3306->3306/tcp, 33060/tcp mysql8
[root@centos7-1 ~]# docker restart e6b421dc43d3
e6b421dc43d3
[root@centos7-1 ~]#
选完"中文"后,点击”Next“
切换成Mysql会显示出以下画面
这里下载就省略了,大家自行找到对应的驱动下载即可,如果本地有maven的仓库,直接使用即可
[root@centos7-1 ~]# cd /export/software/
[root@centos7-1 software]# ll
-rw-r--r--. 1 root root 960372 7月 26 17:50 mysql-connector-java-5.1.34.jar
-rw-r--r--. 1 root root 1007502 7月 26 16:51 mysql-connector-java-5.1.47.jar
-rw-r--r--. 1 root root 2132635 7月 26 17:02 mysql-connector-java-8.0.13.jar
[root@centos7-1 software]# docker cp mysql-connector-java-8.0.13.jar confluence:/opt/atlassian/confluence/confluence/WEB-INF/lib/
[root@centos7-1 software]#
[root@centos7-1 software]# docker restart confluence
confluence
[root@centos7-1 software]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
e6b421dc43d3 atlassian/confluence-server "/tini -- /entrypoin…" 2 hours ago Up 5 seconds 0.0.0.0:8090-8091->8090-8091/tcp confluence
注意这里需要时utf-8的编码
选择右上方"齿轮图标" —— 选择”一般设置“ —— 拉倒最下面,左侧目录选择"授权细节"
可以看到破解成功!
到这里整个搭建部署的过程就结束了,后面的使用过程大家可以自己摸索。在整个搭建的过程中遇到了一些问题,在这里整理一下。
如果问题可在博客下方留言。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。