欢迎来到无限飞翔,在这里,你会找到许多有趣的技术 : )

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

Docker 265℃

项目与事务跟踪工具

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

为什么是Jira

  • 缺陷跟踪
  • 需求收集
  • 流程审批
  • 任务跟踪
  • 项目跟踪和敏捷管理
  • 完全自定义的workflow

工具包准备

安装和启动

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

  • 传统安装启动方式
  • Docker安装启动方式(推荐)
1.传统安装和启动

需要准备

  • CentOS 7.x
  • JDK 1.8(配置好JAVA_HOME)
  • MYSQL 5.7.X(二进制安装或者Docker镜像)

一顿操作猛如虎。。。

## 解压安装包
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安装启动方式

需要准备

  • Docker

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

jira-setup-1.png

我在本地Mac上面建立了一个Docker Build目录,包含下面几个文件

  • Dockerfile(上面的官方repo下载)
  • atlassian-jira-software-7.10.0.tar.gz(官方二进制包,主要是Dockerfile里面的Curl自动下载的速度实在是慢的可以,我在提前下载好,COPY进去,这块不是非必须用这个包,可以依赖Dockerfile的Curl到官方下载安装包)
  • atlassian-extras-3.2.jar(百度网盘工具包)
  • docker-entrypoint.sh(上面的官方repo下载)
    修改Dockerfile
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

配置

  • 选择我将设置它自己

    jira-setup-2.png

  • 配置数据库

    jira-setup-3.png

  • 设置应用程序的属性

    jira-setup-4.png

  • 指定许可证(需要先去官网注册新账号,相当于注册一个试用的code,生成许可证)

    jira-setup-6.png

    jira-setup-5.png

  • 配置管理员相关信息

    jira-setup-7.png

    jira-setup-8.png

上一篇 创业公司基础设施如何搭建(三) —— Confluence(Docker版本)

转载请注明:无限飞翔 » 创业公司基础设施如何搭建(四):Jira(Docker 版本)

喜欢 (0)or分享 (0)