赞
踩
注
:
注
:官方镜像也是可以用的,但这里需要做些定制操作所以干脆自行制作镜像
操作如下
# 创建目录 mkdir DiyCrowdImage && cd DiyCrowdImage # 下载crwod包 wget https://product-downloads.atlassian.com/software/crowd/downloads/atlassian-crowd-3.7.2.tar.gz # 下载jdk 官网:https://www.oracle.com/cn/java/technologies/downloads/ 链接:https://pan.baidu.com/s/1rEJbDiGD2iwyv6NVxex_Kw?pwd=ud62 # 下载 Atlassian Crack Agent 作者:https://zhile.io/2018/12/20/atlassian-license-crack.html 链接:https://pan.baidu.com/s/1q9XU9o7LUjYC5howh_ZSPg?pwd=20ia # 下载mysql5.7驱动包 官网:https://downloads.mysql.com/archives/c-j/ 5.1.49 链接:https://pan.baidu.com/s/1ulTRJfEmV0X7I8JMueNFsw?pwd=a7cq # 准备完毕,目录下的文件如下所示 DiyCrowdImage/ ├── atlassian-agent.jar ├── atlassian-crowd-3.7.2.tar.gz ├── Dockerfile ├── jdk-8u411-linux-x64.tar.gz └── mysql-connector-java-5.1.49-bin.jar
Dockerfile
FROM hukanfa/rockylinux:9.3-base-v1.0 # 设置环境变量 ENV crowdData=/data \ crowdHome=/app/crowd \ crowdTomcatHome=/app/crowd/apache-tomcat \ crowdInitConfig=/app/crowd/crowd-webapp/WEB-INF/classes/crowd-init.properties \ crowdVersion=3.7.2 # 创建目录 RUN mkdir -p /app /data # java #ADD jdk1.8.0_77.tar.gz /usr/local/ ADD jdk-8u411-linux-x64.tar.gz /usr/local # crowd ADD atlassian-crowd-${crowdVersion}.tar.gz /app/ # rename RUN mv /app/atlassian-crowd-${crowdVersion} ${crowdHome} \ && mv /usr/local/jdk1.8.0_411 /usr/local/jdk # java 全局声明 ENV PATH=/usr/local/jdk/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin # 拷贝破解agent 和 mysql 驱动 COPY atlassian-agent.jar /app/crowd/apache-tomcat/bin/ COPY mysql-connector-java-5.1.49-bin.jar /app/crowd/apache-tomcat/lib/ # 设置 crowd.home RUN echo "crowd.home=${crowdData}" >> ${crowdInitConfig} # 在声明java参数前插入加载agent的启动配置 RUN sed -ri "/export JAVA_OPTS/i JAVA_OPTS=\"-javaagent:\$CATALINA_HOME\/bin\/atlassian-agent.jar \${JAVA_OPTS}\" " ${crowdTomcatHome}/bin/setenv.sh # 卷声明 VOLUME ["/data","/app/crowd/apache-tomcat/conf"] # 工作目录 WORKDIR $crowdTomcatHome # 端口 EXPOSE 8095 # 启动 CMD ["bin/catalina.sh", "run", "$@"]
# 此镜像已经同步推送到hub.docker.com,可直接拉取
docker build -t hukanfa/crowd:3.7.2-agent-mysql-v1.0 .
### 宿主机是 centos 直接执行以下命令 docker run -itd --privileged=true -p 8095:8095 --name crowd hukanfa/atlassian-crowd:3.7.2-agent-mysql-v1.0 ### 宿主机是 Rockylinux9.3 需要做些设置 # 路径: /usr/lib/systemd/system/docker.service 增加 --default-ulimit nofile [Service] Type=notify ExecStart=/usr/bin/dockerd --default-ulimit nofile=65535:65535 -H fd:// --containerd=/run/containerd/containerd.sock ExecReload=/bin/kill -s HUP $MAINPID # 重载配置 systemctl daemon-reload # 重启docker服务 systemctl restart docker # 最后执行下面命令 docker run -itd --privileged=true -p 8095:8095 --name crowd hukanfa/atlassian-crowd:3.7.2-agent-mysql-v1.0
访问http://ip:8095
,出现以下界面说明镜像制没问题
操作如下
docker-compose.yaml
version: '3'
services:
confluence:
image: hukanfa/atlassian-crowd:3.7.2-agent-mysql-v1.0
container_name: crowd-srv
user: root
privileged: true
restart: unless-stopped
environment:
- TZ=Asia/Shanghai
ports:
- "8095:8095"
volumes:
- ./data:/data
- ./webConf:/app/crowd/apache-tomcat/conf
# 创建临时容器
docker run -itd --privileged=true -p 8095:8095 --name crowd hukanfa/atlassian-crowd:3.7.2-agent-mysql-v1.0
# 进入容器
docker exec -it crowd /bin/bash
# 打包配置目录
tar -zcvf conf.tar.gz ./conf/
# 另开窗口,拷贝到外面
docker cp crowd:/app/crowd/apache-tomcat/conf.tar.gz ./
# 解压
tar -zxvf conf.tar.gz
# 重命名
mv conf webConf
docker-compose up -d
mysql5.7
# mysq请自行部署,提供5.7容器方式部署demo下载链接,解压运行即可
https://pan.baidu.com/s/1bWL03T9q0PwDbUINu4HnOA?pwd=0m1t
# my.cnf 文件需加入以下配置
[mysqld]
...
transaction-isolation = READ-COMMITTED
# 创建用户及数据库并授权,crowd 此版本只支持 utf8 格式
CREATE USER 'crowd'@'%' IDENTIFIED BY 'UxqibGbgx3';
create database crowd CHARACTER SET utf8 COLLATE utf8_bin;
GRANT ALL ON crowd.* TO 'crowd'@'%';
flush privileges;
操作如下
http://ip:8095
,点击 Set up Crowd# Server ID B8VY-UDPW-7NRD-1R6H # 获取 License_key docker exec -it crowd-srv java -jar /app/crowd/apache-tomcat/bin/atlassian-agent.jar \ -p crowd \ -m hukanfa@example.com \ -n crowd_license \ -o https://www.hukanfa.com \ -s B8VY-UDPW-7NRD-1R6H # 替换为 Server ID # 将生成的 license 粘贴到页面的文本框中 AAABlQ0ODAoPeJxtkU+PmzAQxe/+FEg9ViQYCAmRLG0WiJYq5A8k2eZUedlJcBcMtQ0s/fQlCblUK /niGc97P7/5FpVci2inmYaGnbntzk1X85J9fzdt5AmgipXcpwrItaIbE900UNDQvL51yJnmEpAPM hWsulUOPGcFU/Cu5SwFLkF767RMqUrOx+O/GcthxEq0ERfKmbyLPLpt246y+oPyMx2lZYFSUbbvo 9VdZt9VsKYFEG8TRUHshYvV8CBRVCgQA4tXckVTFUSU5WRQe4JPWlS981V1wHqhMiORZ3jLnfds8 fZPieVlcZz4S/YzOf/4HU7G1ml/CQ+LOrPGu/gUFssudrffG7trjp5ZmdaOoN6FK+CUpxB8Vkx0Q 1YzVzem/UEDfeiTVegnwVpf4Sl2sGu7jotte/hCD8waIErUgBIQDYh+4Hl2POkHf/uqT9exr+PYe UEf0B1ByGtq2DGMqTGzLPww+ZpgW4s0oxL+3+LdeV0XbyA254PsZYmOH/E8XEzUQ5MvwIecbyu5S f0aJv8BzejCkzAsAhRxb9+rU5GnV6uaUHhvmZmjvJH3nwIUFbxqhLgFf/XCrc+hXhWVHrLkVnY=X 02jj
# JDBC_URL 前面配置的账号密码: crowd UxqibGbgx3
jdbc:mysql://192.168.26.5:3307/crowd?autoReconnect=true&characterEncoding=utf8&useUnicode=true
重要:
数据库初始化完成后,需要把库和相关表字符集调整成utf8mb4
### 目的:支持带有表情包的用户名称,兼容其他数据源的数据迁移导入而不报错
# 修改数据库字符集
ALTER DATABASE crowd CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci;
# 修改用户表字符集
ALTER TABLE cwd_user CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
说明
crowd(tomcat)
的jvm大小操作如下
setenv.sh
调整# 容器内路径: /app/crowd/apache-tomcat/bin/setenv.sh ,主要是前三行 jvmXms=${JVM_TOMCAT_XMS:=128m} jvmXmx=${JVM_TOMCAT_XMX:=512m} JAVA_OPTS="-Xms${jvmXms} -Xmx${jvmXmx} -Dfile.encoding=UTF-8 $JAVA_OPTS" JAVA_OPTS="-javaagent:$CATALINA_HOME/bin/atlassian-agent.jar ${JAVA_OPTS}" export JAVA_OPTS # set the location of the pid file if [ -z "$CATALINA_PID" ] ; then if [ -n "$CATALINA_BASE" ] ; then CATALINA_PID="$CATALINA_BASE"/work/catalina.pid elif [ -n "$CATALINA_HOME" ] ; then CATALINA_PID="$CATALINA_HOME"/work/catalina.pid fi fi export CATALINA_PID
docker-compose.yaml
version: '3' services: confluence: image: hukanfa/atlassian-crowd:3.7.2-agent-mysql-v1.0 container_name: crowd-srv user: root privileged: true restart: unless-stopped environment: - TZ=Asia/Shanghai - JVM_TOMCAT_XMS="500m" - JVM_TOMCAT_XMX="2000m" ports: - "8095:8095" volumes: - ./data:/data - ./webConf:/app/crowd/apache-tomcat/conf - ./setenv.sh:/app/crowd/apache-tomcat/bin/setenv.sh
[root@hukanfa crowd]# docker top crowd-srv
System Information
显示的 JVM statistics 也相应变化说明
.xml
格式的备份文件操作如下
# 最多保留50份备份
/data/shared/backups
说明
数据迁移注意事项说明
操作如下
#
/home/hukanfa/crowd/data/shared/backups
[root@hukanfa backups]# ls
atlassian-crowd-2024-05-21-020000-automated-backup-3.7.0.xml
# 注意,在4.1.3节初始配置中提到。数据迁移操作需对crowd数据库和cwd_user表字符集先转成utf8mb4先
/data/shared/backups/atlassian-crowd-2024-05-21-020000-automated-backup-3.7.0.xml
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。