系统运维个人学习创业公司DevOps工具链杂谈

创业公司基础设施如何搭建(三) —— Confluence(Do

2020-02-15  本文已影响0人  天行者YANG

知识库

DevOps、敏捷管理,对于整体流程和团队,2个工具是最不能少的,而且使用频率非常高,知识库 + 问题跟踪,我用的是Confluence + Jira,工欲善其事必先利其器,我们先需要把工具选择和准备好,再开始后面的事情,下面介绍下Confluence的安装流程

为什么是Confluence

工具包准备

安装和启动

这里介绍2种安装和启动方式

1.传统安装和启动

需要准备

一顿操作猛如虎。。。

## 解压安装包
cd your-path
tar -xvf atlassian-confluence-6.9.0.tar.gz
## 指定工作目录
vi /your-path/atlassian-confluence-6.9.0/confluence/WEB-INF/classes/confluence-init.properties
# 在文件中加入 confluence.home=/your-home-path/
## 用下载的atlassian-extras-decoder-v2-3.3.0.jar覆盖原有Jar
cp -aR /your-path/atlassian-extras-decoder-v2-3.3.0.jar /your-path/atlassian-confluence-6.9.0/confluence/WEB-INF/lib/
## mysql的驱动Jar去官网下载一个适合5.7的即可
cp mysql-connector-java-5.1.45.jar /your-path/atlassian-confluence-6.9.0/confluence/WEB-INF/lib
## 启动
/your-path/atlassian-confluence-6.9.0/bin/start-confluence.sh
# 默认是8090端口,在浏览器打开http://localhost:8090
2.Docker安装启动方式

需要准备

由于官方已经有镜像,我们在官方镜像上面加入自定义的内容即可,官方的6.9.0的Dockerfile的Repo地址,我们需要的是红框的2个文件,如下:

confluence-docker-1.png
我在本地Mac上面建立了一个Docker Build目录,包含下面几个文件
FROM openjdk:8-alpine

# Setup useful environment variables
ENV CONF_HOME     /var/atlassian/confluence
ENV CONF_INSTALL  /opt/atlassian/confluence
ENV CONF_VERSION  6.9.0

ENV JAVA_CACERTS  $JAVA_HOME/jre/lib/security/cacerts
ENV CERTIFICATE   $CONF_HOME/certificate

# [新增] 把build目录的必要文件复制到镜像内
COPY atlassian-confluence-${CONF_VERSION}.tar.gz /tmp/atlassian-confluence-${CONF_VERSION}.tar.gz
COPY atlassian-extras-decoder-v2-3.3.0.jar /tmp/atlassian-extras-decoder-v2-3.3.0.jar

# [新增] 创建Install目录,解压安装包,替换工具Jar包,删除安装包压缩文件
RUN mkdir -p ${CONF_INSTALL}
RUN tar -xzvf /tmp/atlassian-confluence-${CONF_VERSION}.tar.gz -C ${CONF_INSTALL} --strip-components=1 --no-same-owner \
    && mv ${CONF_INSTALL}/confluence/WEB-INF/lib/atlassian-extras-decoder-v2-3.3.0.jar ${CONF_INSTALL}/confluence/WEB-INF/lib/atlassian-extras-decoder-v2-3.3.0.jar.bak \
    && mv /tmp/atlassian-extras-decoder-v2-3.3.0.jar ${CONF_INSTALL}/confluence/WEB-INF/lib \
    && rm -rf /tmp/atlassian-confluence-${CONF_VERSION}.tar.gz

# Install Atlassian Confluence and helper tools and setup initial home
# directory structure.
RUN set -x \
    && apk --no-cache add curl xmlstarlet bash ttf-dejavu libc6-compat gcompat \
    && mkdir -p                "${CONF_HOME}" \
    && chmod -R 700            "${CONF_HOME}" \
    && chown daemon:daemon     "${CONF_HOME}" \
    && mkdir -p                "${CONF_INSTALL}/conf" \
    && curl -Ls                "https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.44.tar.gz" | tar -xz --directory "${CONF_INSTALL}/confluence/WEB-INF/lib" --strip-components=1 --no-same-owner "mysql-connector-java-5.1.44/mysql-connector-java-5.1.44-bin.jar" \
    && chmod -R 700            "${CONF_INSTALL}/conf" \
    && chmod -R 700            "${CONF_INSTALL}/temp" \
    && chmod -R 700            "${CONF_INSTALL}/logs" \
    && chmod -R 700            "${CONF_INSTALL}/work" \
    && chown -R daemon:daemon  "${CONF_INSTALL}/conf" \
    && chown -R daemon:daemon  "${CONF_INSTALL}/temp" \
    && chown -R daemon:daemon  "${CONF_INSTALL}/logs" \
    && chown -R daemon:daemon  "${CONF_INSTALL}/work" \
    && echo -e                 "\nconfluence.home=$CONF_HOME" >> "${CONF_INSTALL}/confluence/WEB-INF/classes/confluence-init.properties" \
    && xmlstarlet              ed --inplace \
        --delete               "Server/@debug" \
        --delete               "Server/Service/Connector/@debug" \
        --delete               "Server/Service/Connector/@useURIValidationHack" \
        --delete               "Server/Service/Connector/@minProcessors" \
        --delete               "Server/Service/Connector/@maxProcessors" \
        --delete               "Server/Service/Engine/@debug" \
        --delete               "Server/Service/Engine/Host/@debug" \
        --delete               "Server/Service/Engine/Host/Context/@debug" \
                               "${CONF_INSTALL}/conf/server.xml" \
    && touch -d "@0"           "${CONF_INSTALL}/conf/server.xml" \
    && chown daemon:daemon     "${JAVA_CACERTS}"

# Use the default unprivileged account. This could be considered bad practice
# on systems where multiple processes end up being executed by 'daemon' but
# here we only ever run one process anyway.
USER daemon:daemon

# Expose default HTTP connector port.
EXPOSE 8090 8091

# Set volume mount points for installation and home directory. Changes to the
# home directory needs to be persisted as well as parts of the installation
# directory due to eg. logs.
VOLUME ["/var/atlassian/confluence", "/opt/atlassian/confluence/logs"]

# Set the default working directory as the Confluence home directory.
WORKDIR /var/atlassian/confluence

COPY docker-entrypoint.sh /
ENTRYPOINT ["/docker-entrypoint.sh"]

# Run Atlassian Confluence as a foreground process by default.
CMD ["/opt/atlassian/confluence/bin/start-confluence.sh", "-fg"]

执行build

cd /your-docker-build-path
docker build -t michael/atlassian-confluence:6.9.0 .

启动镜像(配套如果使用MYSQL,建议Docker Compose启动Confluence + MYSQL)

docker run -d --rm --name=wiki -p 8090:8090 -p 8091:8091 \
-v /your-confluence-path/home:/var/atlassian/confluence \
-v /your-confluence-path/logs:/opt/atlassian/confluence/logs \
michael/atlassian-confluence:6.9.0 

配置

confluence-setup-2.png confluence-setup-4.png confluence-setup-5.png confluence-setup-6.png confluence-setup-7.png
confluence-setup-8.png
创业公司基础设施如何搭建(一) —— 前期准备
创业公司基础设施如何搭建(二) —— Docker安装
创业公司基础设施如何搭建(三) —— Confluence(Docker版本)
创业公司基础设施如何搭建(四) —— Jira(Docker版本)
创业公司基础设施如何搭建(五) —— Crowd(Docker版本)
上一篇下一篇

猜你喜欢

热点阅读