创业公司DevOps工具链杂谈

创业公司基础设施如何搭建(四) —— Jira(Docker版本

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

项目与事务跟踪工具

Jira是做需求、Bug、任务等等管理的系统,工作流支持全部自定义,自由度极强,下面介绍下Jira的安装流程

为什么是Jira

工具包准备

安装和启动

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

1.传统安装和启动

需要准备

一顿操作猛如虎。。。

## 解压安装包
cd your-path
tar -xvf atlassian-jira-software-7.10.0.tar.gz
mv /your-path/atlassian-jira-software-7.10.0-standalone/ /your-path/atlassian-jira-7.10.0
## 配置环境变量JIRA_HOME
vim ~/.zshrc #看大家用的什么系统,环境文件有所不同
export JIRA_HOME=/tmp/jira-home
## mysql的驱动Jar去官网下载一个适合5.7的即可
cp mysql-connector-java-5.1.45.jar /your-path/atlassian-jira-7.10.0/atlassian-jira/WEB-INF/lib
# 请复制atlassian-extras-3.2.jar到/your-path/atlassian-jira-7.10.0/atlassian-jira/WEB-INF/lib
cp atlassian-extras-3.2.jar /your-path/atlassian-jira-7.10.0/atlassian-jira/WEB-INF/lib
## 启动
/your-path/atlassian-jira-7.10.0/bin/start-jira.sh
# 默认是8080端口,在浏览器打开http://localhost:8080
2.Docker安装启动方式

需要准备

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

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

# Configuration variables.
ENV JIRA_HOME     /var/atlassian/jira
ENV JIRA_INSTALL  /opt/atlassian/jira
ENV JIRA_VERSION  7.10.0

# [新增]
COPY atlassian-jira-software-${JIRA_VERSION}.tar.gz /tmp/atlassian-jira-software-${JIRA_VERSION}.tar.gz
COPY atlassian-extras-3.2.jar /tmp/atlassian-extras-3.2.jar
# [新增]
RUN mkdir -p ${JIRA_INSTALL}
RUN tar -xzvf /tmp/atlassian-jira-software-${JIRA_VERSION}.tar.gz -C ${JIRA_INSTALL} --strip-components=1 --no-same-owner \
    && mv ${JIRA_INSTALL}/atlassian-jira/WEB-INF/lib/atlassian-extras-3.2.jar ${JIRA_INSTALL}/atlassian-jira/WEB-INF/lib/atlassian-extras-3.2.jar.bak \
    && mv /tmp/atlassian-extras-3.2.jar ${JIRA_INSTALL}/atlassian-jira/WEB-INF/lib \
    && rm -rf /tmp/atlassian-jira-software-${JIRA_VERSION}.tar.gz

# Install Atlassian JIRA and helper tools and setup initial home
# directory structure.
RUN set -x \
    && apk add --no-cache curl xmlstarlet bash ttf-dejavu libc6-compat \
    && mkdir -p                "${JIRA_HOME}" \
    && mkdir -p                "${JIRA_HOME}/caches/indexes" \
    && chmod -R 700            "${JIRA_HOME}" \
    && chown -R daemon:daemon  "${JIRA_HOME}" \
    && mkdir -p                "${JIRA_INSTALL}/conf/Catalina" \
    && curl -Ls                "https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.38.tar.gz" | tar -xz --directory "${JIRA_INSTALL}/lib" --strip-components=1 --no-same-owner "mysql-connector-java-5.1.38/mysql-connector-java-5.1.38-bin.jar" \
    && rm -f                   "${JIRA_INSTALL}/lib/postgresql-9.4.1212.jar" \ # [修改] 之前的要删除的jar发现lib没有
    && curl -Ls                "https://jdbc.postgresql.org/download/postgresql-42.2.1.jar" -o "${JIRA_INSTALL}/lib/postgresql-42.2.1.jar" \
    && chmod -R 700            "${JIRA_INSTALL}/conf" \
    && chmod -R 700            "${JIRA_INSTALL}/logs" \
    && chmod -R 700            "${JIRA_INSTALL}/temp" \
    && chmod -R 700            "${JIRA_INSTALL}/work" \
    && chown -R daemon:daemon  "${JIRA_INSTALL}/conf" \
    && chown -R daemon:daemon  "${JIRA_INSTALL}/logs" \
    && chown -R daemon:daemon  "${JIRA_INSTALL}/temp" \
    && chown -R daemon:daemon  "${JIRA_INSTALL}/work" \
    && sed --in-place          "s/java version/openjdk version/g" "${JIRA_INSTALL}/bin/check-java.sh" \
    && echo -e                 "\njira.home=$JIRA_HOME" >> "${JIRA_INSTALL}/atlassian-jira/WEB-INF/classes/jira-application.properties" \
    && touch -d "@0"           "${JIRA_INSTALL}/conf/server.xml"

# 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 8080

# 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/jira", "/opt/atlassian/jira/logs"]

# Set the default working directory as the installation directory.
WORKDIR /var/atlassian/jira

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

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

执行build

cd /your-docker-build-path
docker build -t michael/atlassian-jira:7.10.0 .

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

docker run -d --rm --name=jira -p 8080:8080 \
-v /Users/liuyang/CodeMonkey/workspace/docker-workspace/jira/home:/var/atlassian/jira \
-v /Users/liuyang/CodeMonkey/workspace/docker-workspace/jira/logs:/opt/atlassian/jira/logs \
michael/atlassian-jira:7.10.0

配置

创业公司基础设施如何搭建(一) —— 前期准备
创业公司基础设施如何搭建(二) —— Docker安装
创业公司基础设施如何搭建(三) —— Confluence(Docker版本)
创业公司基础设施如何搭建(四) —— Jira(Docker版本)
创业公司基础设施如何搭建(五) —— Crowd(Docker版本)
上一篇下一篇

猜你喜欢

热点阅读