├── doc
├── issue.md
├── install.md
├── test.md
├── build.md
└── developer.md
├── .mvn
├── jvm.config
└── wrapper
│ └── maven-wrapper.properties
├── package
├── src
│ ├── main
│ │ ├── webapp
│ │ │ └── WEB-INF
│ │ │ │ ├── install.lock
│ │ │ │ ├── plugins
│ │ │ │ └── .gitkeep
│ │ │ │ ├── db.properties
│ │ │ │ └── web.xml
│ │ └── java
│ │ │ └── com
│ │ │ └── zrlog
│ │ │ └── web
│ │ │ ├── dev
│ │ │ ├── SwsDevApplication.java
│ │ │ └── JakartaServletDevApplication.java
│ │ │ └── GraalvmAgentApplication.java
│ ├── deb
│ │ ├── control
│ │ │ ├── control
│ │ │ └── postinst
│ │ └── init.d
│ │ │ └── zrlog
│ └── assembly
│ │ ├── native-zip.xml
│ │ ├── faas-zip.xml
│ │ └── java-zip.xml
└── pom.xml
├── bin
├── mvn-run.cmd
├── run.sh
├── start.bat
├── config
│ └── zrlog.properties
├── start.sh
├── mvn-run.sh
├── mvn-run-blog.sh
├── mvn-run-admin.sh
├── mvn-native-dev-run.sh
├── mvn-run-install.sh
├── add-build-info.sh
└── build-system-info.sh
├── conf
├── db.properties
└── install.lock
├── shell
├── java
│ ├── package-dev-java-zip.sh
│ ├── package-java-zip.sh
│ └── build-final-java.sh
├── native
│ ├── .graalvm_rc
│ ├── package-native-zip.sh
│ ├── package-native-deb.sh
│ ├── package-native.sh
│ ├── package-faas-zip.sh
│ └── build-final-native.sh
├── upload-bin.sh
└── version.sh
├── .gitpod.yml
├── zrlog-web
├── src
│ └── main
│ │ └── java
│ │ └── com
│ │ └── zrlog
│ │ └── web
│ │ ├── util
│ │ └── UpdaterUtils.java
│ │ ├── setup
│ │ └── install
│ │ │ ├── ZrLogInstallAction.java
│ │ │ ├── InstallWebSetup.java
│ │ │ └── ZrLogInstallConfig.java
│ │ ├── filter
│ │ └── ZrLogSwsServletFilter.java
│ │ ├── config
│ │ ├── ZrLogConfigImpl.java
│ │ └── SetupConfig.java
│ │ └── Application.java
└── pom.xml
├── .github
└── workflows
│ ├── java-build-preview-package-zip.yml
│ ├── java-build-release-package-zip.yml
│ ├── faas-build-preview-package-zip.yml
│ ├── faas-build-release-package-zip.yml
│ ├── native-build-preview-package-zip.yml
│ ├── native-build-release-package-zip.yml
│ ├── deb-build-preview-deb.yml
│ └── deb-build-release-deb.yml
├── .gitignore
├── README.md
├── README.en-us.md
├── mvnw.cmd
├── pom.xml
├── mvnw
└── LICENSE
/doc/issue.md:
--------------------------------------------------------------------------------
1 | ### Knows issus list
2 |
--------------------------------------------------------------------------------
/.mvn/jvm.config:
--------------------------------------------------------------------------------
1 | -Xmx512m -Dfile.encoding=UTF-8
--------------------------------------------------------------------------------
/package/src/main/webapp/WEB-INF/install.lock:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/package/src/main/webapp/WEB-INF/plugins/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/bin/mvn-run.cmd:
--------------------------------------------------------------------------------
1 | .\mvnw clean package && bin\start.bat
--------------------------------------------------------------------------------
/conf/db.properties:
--------------------------------------------------------------------------------
1 | ../package/src/main/webapp/WEB-INF/db.properties
--------------------------------------------------------------------------------
/conf/install.lock:
--------------------------------------------------------------------------------
1 | ../package/src/main/webapp/WEB-INF/install.lock
--------------------------------------------------------------------------------
/bin/run.sh:
--------------------------------------------------------------------------------
1 | java -Xmx128m -Dfile.encoding=UTF-8 -jar zrlog-starter.jar $@
--------------------------------------------------------------------------------
/bin/start.bat:
--------------------------------------------------------------------------------
1 | java -Xmx48m -Dfile.encoding=UTF-8 -jar zrlog-starter.jar
--------------------------------------------------------------------------------
/bin/config/zrlog.properties:
--------------------------------------------------------------------------------
1 | vmArgs=-XX:StackSize=262144 -XX:MaxHeapSize=134217728 -XX:+ExitOnOutOfMemoryError
--------------------------------------------------------------------------------
/bin/start.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | nohup java -Xmx48m -Dfile.encoding=UTF-8 -jar zrlog-starter.jar $@ &
--------------------------------------------------------------------------------
/shell/java/package-dev-java-zip.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | bash -e shell/java/package-java-zip.sh "dev"
3 |
--------------------------------------------------------------------------------
/shell/native/.graalvm_rc:
--------------------------------------------------------------------------------
1 | export JAVA_HOME=${HOME}/dev/graalvm-jdk-latest
2 | export PATH=${JAVA_HOME}/bin:$PATH
--------------------------------------------------------------------------------
/package/src/main/webapp/WEB-INF/db.properties:
--------------------------------------------------------------------------------
1 | jdbcUrl=jdbc\:webapi\://faas-test-db.zrlog.com\:443/zrlog_test?supportHttp2\=true
2 | password=123456
3 | user=zrlog_test
4 |
--------------------------------------------------------------------------------
/doc/install.md:
--------------------------------------------------------------------------------
1 | ## ZrLog 安装详细教程
2 |
3 | [如何安装 ZrLog](https://blog.zrlog.com/run-zrlog-in-docker.html)
4 |
5 |
6 | ## FaaS 部署(无服务)
7 |
8 | [cloudflare d1 & aws lambda](https://blog.zrlog.com/serverless-with-aws-lambda-and-cf-d1.html)
--------------------------------------------------------------------------------
/shell/native/package-native-zip.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | bash -e shell/native/package-native.sh "${1}" "${2}"
3 | ./mvnw -Dproject.build.outputTimestamp=2013-01-01T00:00:00Z -Ppackage-native-zip assembly:single -f "package/pom.xml"
4 |
--------------------------------------------------------------------------------
/bin/mvn-run.sh:
--------------------------------------------------------------------------------
1 | bash -e bin/add-build-info.sh "dev" "开发版"
2 | export DEV_MODE=true
3 | ./mvnw -Dproject.build.outputTimestamp=2013-01-01T00:00:00Z -Djakarta-scope='provided' -Dlambda-scope='provided' -Dservlet-scope='provided' -Pjar clean package -U
4 | sh bin/run.sh
--------------------------------------------------------------------------------
/bin/mvn-run-blog.sh:
--------------------------------------------------------------------------------
1 | bash -e bin/add-build-info.sh "dev" "开发版"
2 | ./mvnw -Dproject.build.outputTimestamp=2013-01-01T00:00:00Z -Djakarta-scope='provided' -Dlambda-scope='provided' -Dservlet-scope='provided' -Pjar clean package -U
3 | rm -rf lib/admin-*.jar
4 | rm -rf lib/zrlog-install-web-*.jar
5 | sh bin/run.sh
--------------------------------------------------------------------------------
/bin/mvn-run-admin.sh:
--------------------------------------------------------------------------------
1 | bash -e bin/add-build-info.sh "dev" "开发版"
2 | ./mvnw -Dproject.build.outputTimestamp=2013-01-01T00:00:00Z -Djakarta-scope='provided' -Dlambda-scope='provided' -Dservlet-scope='provided' -Pjar clean package -U
3 | rm -rf lib/zrlog-install-web-*.jar
4 | rm -rf lib/blog-web-*.jar
5 | sh bin/run.sh
--------------------------------------------------------------------------------
/bin/mvn-native-dev-run.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | source shell/native/.graalvm_rc
3 | bash -e bin/add-build-info.sh "dev" "开发版"
4 | export JAVA_HOME=${HOME}/dev/graalvm-jdk-latest
5 | export PATH=${JAVA_HOME}/bin:$PATH
6 | export DEV_MODE=true
7 | bash -e shell/native/package-native.sh
8 | ./zrlog --port=28080
9 |
10 |
--------------------------------------------------------------------------------
/shell/upload-bin.sh:
--------------------------------------------------------------------------------
1 | #upload
2 | aws --version
3 | aws configure set aws_access_key_id ${1}
4 | aws configure set aws_secret_access_key ${2}
5 | aws configure set region auto
6 | aws configure set output json
7 | #do upload
8 | originalPath="${4}/${5}"
9 | aws s3 cp ${originalPath} s3://${3}/${5}/ --recursive --checksum-algorithm CRC32 --endpoint-url ${6}
--------------------------------------------------------------------------------
/doc/test.md:
--------------------------------------------------------------------------------
1 | ## 测试
2 |
3 | ### 升级逻辑(war)
4 |
5 | #### root
6 |
7 | ```
8 | wget https://www.zrlog.com/install/zrlog-upgrade-jakarta-war.sh
9 | ```
10 |
11 | #### blog
12 |
13 | ```
14 | wget https://www.zrlog.com/install/zrlog-upgrade-jakarta-war-sub.sh
15 | ```
16 |
17 | ### 最新包
18 |
19 | ```
20 | wget https://www.zrlog.com/install/zrlog-last-war.sh
21 | ```
--------------------------------------------------------------------------------
/bin/mvn-run-install.sh:
--------------------------------------------------------------------------------
1 | bash -e bin/add-build-info.sh "dev" "开发版"
2 | ./mvnw -Dproject.build.outputTimestamp=2013-01-01T00:00:00Z -Djakarta-scope='provided' -Dlambda-scope='provided' -Dservlet-scope='provided' -Pjar clean package -U
3 | export INSTALL_LOCK_FILE_NAME=temp/install.lock
4 | export DB_PROPERTIES_FILE_NAME=temp/db.properties
5 | rm conf/${INSTALL_LOCK_FILE_NAME}
6 | rm conf/${DB_PROPERTIES_FILE_NAME}
7 | sh bin/run.sh
--------------------------------------------------------------------------------
/shell/java/package-java-zip.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | rm -rf lib
3 | rm -rf zrlog.*
4 | rm -rf conf/plugins/*
5 | bash -e bin/add-build-info.sh "${1}"
6 | ./mvnw -Dproject.build.outputTimestamp=2013-01-01T00:00:00Z -Djakarta-scope='provided' -Dlambda-scope='provided' -Dservlet-scope='provided' -Pjar clean package -U
7 | ./mvnw -Dproject.build.outputTimestamp=2013-01-01T00:00:00Z -Djakarta-scope='provided' -Dlambda-scope='provided' -Pwar -DpackageType=war package -U
--------------------------------------------------------------------------------
/doc/build.md:
--------------------------------------------------------------------------------
1 | ## 构建 ZrLog
2 |
3 | > ZrLog 提供多种运行包 .zip .war .deb,可以运行在大部分操作系统上,甚至是 Android(需原生 arm64 的 Linux 环境) 和树莓派上
4 |
5 | ### shell 目录
6 |
7 | ```
8 | ├── java
9 | │ ├── build-final-java.sh
10 | │ ├── package-dev-java-zip.sh
11 | │ └── package-java-zip.sh
12 | ├── native
13 | │ ├── build-final-native.sh
14 | │ ├── package-faas-zip.sh
15 | │ ├── package-native-deb.sh
16 | │ ├── package-native-zip.sh
17 | │ └── package-native.sh
18 | ```
19 |
--------------------------------------------------------------------------------
/.gitpod.yml:
--------------------------------------------------------------------------------
1 | # This configuration file was automatically generated by Gitpod.
2 | # Please adjust to your needs (see https://www.gitpod.io/docs/introduction/learn-gitpod/gitpod-yaml)
3 | # and commit this file to your remote git repository to share the goodness with others.
4 |
5 | # Learn more from ready-to-use templates: https://www.gitpod.io/docs/introduction/getting-started/quickstart
6 |
7 | tasks:
8 | - init: ./mvnw install -DskipTests=false
9 |
10 |
11 |
--------------------------------------------------------------------------------
/package/src/deb/control/control:
--------------------------------------------------------------------------------
1 | Version: [[version]]+[[gitCommitId]]
2 | Section: build-web-system
3 | Priority: optional
4 | Maintainer: "zrlog" support@zrlog.com
5 | Package: [[packageName]]
6 | Architecture: [[architecture]]
7 | Depends:
8 | Homepage: https://www.zrlog.com
9 | Description: ZrLog is a blog/CMS program developed in Java. It is simple, easy to use, componentized, and has low memory footprint. Bring your own Markdown editor and let more focus on writing, rather than spending a lot of time learning the use of the program.
--------------------------------------------------------------------------------
/shell/native/package-native-deb.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | bash -e shell/native/package-native.sh "${1}"
3 | function buildProp() {
4 | grep "${1}" "zrlog-web/src/main/resources/build.properties"|awk -F "${1}"'=' '{print $2}'
5 | }
6 |
7 | # shellcheck disable=SC2034
8 | version="$(buildProp 'version')"
9 | buildId="$(git log -1 --format=%cd --date=format:'%Y%m%d%H%M%S')-$(buildProp 'buildId')"
10 | ./mvnw -Dproject.build.outputTimestamp=2013-01-01T00:00:00Z -Darchitecture="$(dpkg --print-architecture)" -Pjdeb package -DgitCommitId="${buildId}"
--------------------------------------------------------------------------------
/shell/version.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | baseVersion=3.2
3 | releaseVersion=${baseVersion}.${1}
4 | nextVersion=${baseVersion}.$((${1}+1))-SNAPSHOT
5 | tagName="v${releaseVersion}"
6 | ./mvnw versions:set -DnewVersion=${releaseVersion}
7 | git add -A
8 | git commit -m '[shell-release]release version '${releaseVersion}
9 | git checkout release
10 | git reset --hard master
11 | git tag ${tagName}
12 | git push origin ${tagName}
13 | git push origin release -f
14 | git checkout master
15 | ./mvnw versions:set -DnewVersion=${nextVersion}
16 | git add -A
17 | git commit -m '[shell-release]next version '${nextVersion}
18 | git push -f
--------------------------------------------------------------------------------
/package/src/main/webapp/WEB-INF/web.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 | SwsFilter
8 | com.zrlog.web.filter.ZrLogSwsServletFilter
9 |
10 |
11 | SwsFilter
12 | /*
13 |
14 |
--------------------------------------------------------------------------------
/zrlog-web/src/main/java/com/zrlog/web/util/UpdaterUtils.java:
--------------------------------------------------------------------------------
1 | package com.zrlog.web.util;
2 |
3 |
4 | import com.hibegin.common.util.EnvKit;
5 | import com.zrlog.admin.web.plugin.NativeImageUpdater;
6 | import com.zrlog.admin.web.plugin.ZipUpdater;
7 | import com.zrlog.common.Updater;
8 |
9 | import java.io.File;
10 |
11 | public class UpdaterUtils {
12 |
13 | public static Updater getUpdater(String[] args, File file) {
14 | if (EnvKit.isNativeImage()) {
15 | return new NativeImageUpdater(args, file);
16 | }
17 | try {
18 | File jarFile = new File(System.getProperty("java.class.path"));
19 | return new ZipUpdater(args, jarFile);
20 | } catch (Throwable e) {
21 | return null;
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/package/src/deb/control/postinst:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -e
3 | # 配置变量
4 | SERVICE_USER="zrlog"
5 | SERVICE_GROUP="zrlog"
6 | USER_HOME="/nonexistent" # 用户无需登录,设置为无效目录
7 | USER_SHELL="/usr/sbin/nologin"
8 |
9 | # 创建用户组
10 | if ! getent group "${SERVICE_GROUP}" > /dev/null; then
11 | groupadd --system "${SERVICE_GROUP}"
12 | else
13 | echo "Group ${SERVICE_GROUP} already exists"
14 | fi
15 |
16 | # 创建用户
17 | if ! id -u "${SERVICE_USER}" > /dev/null 2>&1; then
18 | useradd --system --no-create-home \
19 | --home "${USER_HOME}" \
20 | --shell "${USER_SHELL}" \
21 | --gid "${SERVICE_GROUP}" \
22 | "${SERVICE_USER}"
23 | else
24 | echo "User ${SERVICE_USER} already exists"
25 | fi
26 |
27 | setcap cap_net_bind_service=+ep /usr/bin/${SERVICE_USER}
28 | systemctl daemon-reload
29 | # 开始启动
30 | service zrlog restart
31 | # 开机启动
32 | update-rc.d zrlog defaults
33 | exit 0
--------------------------------------------------------------------------------
/shell/native/package-native.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | rm -rf lib
3 | rm -rf zrlog.*
4 | rm -rf zrlog-.*
5 | rm -rf conf/plugins
6 | java -version
7 | bash -e bin/add-build-info.sh "${1}"
8 | export JDK_JAVA_OPTIONS='--add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/java.text=ALL-UNNAMED --add-opens java.desktop/java.awt.font=ALL-UNNAMED'
9 | ./mvnw -Dproject.build.outputTimestamp=2013-01-01T00:00:00Z clean install -U
10 | ./mvnw -Dproject.build.outputTimestamp=2013-01-01T00:00:00Z -Djakarta-scope='provided' ${2} -Pnative -Dagent exec:exec@java-agent -U -f package/pom.xml
11 | ./mvnw -Dproject.build.outputTimestamp=2013-01-01T00:00:00Z -Djakarta-scope='provided' ${2} -Pnative package -U -f package/pom.xml
12 | if [ -f 'package/target/zrlog.exe' ];
13 | then
14 | mv package/target/zrlog.exe zrlog.exe
15 | fi
16 | #copy file
17 | if [ -f 'package/target/zrlog' ];
18 | then
19 | mv package/target/zrlog zrlog
20 | fi
--------------------------------------------------------------------------------
/bin/add-build-info.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | # shellcheck disable=SC2016
3 | version=$(printf 'VER\t${project.version}' | ./mvnw help:evaluate | grep '^VER' | cut -f2)
4 | # https://dl.zrlog.com mirror folder
5 | mirrorWebSite=https://dl.zrlog.com/
6 | runMode=${1}
7 | if [[ $runMode == 'release' ]]; then
8 | runModeDesc="\\u6B63\\u5F0F\\u7248\\u672C"
9 | elif [[ $runMode == 'preview' ]]; then
10 | runModeDesc="\\u9884\\u89C8\\u7248\\u672C"
11 | else
12 | runModeDesc="\\u5F00\\u53D1\\u7248\\u672C"
13 | fi
14 |
15 | Date=$(git log -1 --format=%cd --date=format:'%Y-%m-%d %H:%M:%S%z' | sed "s/\([+-]\)\([0-9][0-9]\)\([0-9][0-9]\)/\1\2:\3/")
16 | buildId=$(git rev-parse --short HEAD)
17 |
18 | mkdir -p zrlog-web/src/main/resources/
19 | printf "version=%s\nrunMode=%s\nrunModeDesc=%s\nbuildId=%s\nbuildTime=%s\nmirrorWebSite=%s\n" \
20 | "$version" "$runMode" "$runModeDesc" "$buildId" "$Date" "$mirrorWebSite" \
21 | > zrlog-web/src/main/resources/build.properties
22 |
23 | bash bin/build-system-info.sh
--------------------------------------------------------------------------------
/.github/workflows/java-build-preview-package-zip.yml:
--------------------------------------------------------------------------------
1 | name: build preview zip & war
2 | on:
3 | push:
4 | branches:
5 | - master
6 | jobs:
7 | build:
8 | name: ZrLog package ${{ matrix.os }} ${{ matrix.architecture }}
9 | runs-on: ${{ matrix.os }}
10 | concurrency:
11 | group: deploy-preview-on-${{ matrix.os }}-java # 同一个 group 的任务会排队执行
12 | cancel-in-progress: false # 不取消前一个任务,而是等待
13 | strategy:
14 | matrix:
15 | os: [ ubuntu-22.04 ]
16 | architecture: [ amd64 ]
17 | steps:
18 | - uses: actions/checkout@v3
19 | - uses: actions/setup-java@v3
20 | with:
21 | distribution: 'temurin'
22 | java-version: '11'
23 | cache: 'maven'
24 | - name: Build with Maven
25 | run: |
26 | mkdir -p /tmp/download
27 | bash -e shell/java/build-final-java.sh preview /tmp/download
28 | bash shell/upload-bin.sh ${{ secrets.SECRET_ID }} ${{ secrets.SECRET_KEY }} ${{ secrets.BUCKET }} /tmp/download preview ${{ secrets.HOST }}
--------------------------------------------------------------------------------
/.github/workflows/java-build-release-package-zip.yml:
--------------------------------------------------------------------------------
1 | name: build release zip & war
2 | on:
3 | push:
4 | branches:
5 | - release
6 | jobs:
7 | build:
8 | name: ZrLog package ${{ matrix.os }} ${{ matrix.architecture }}
9 | runs-on: ${{ matrix.os }}
10 | concurrency:
11 | group: deploy-release-on-${{ matrix.os }}-java # 同一个 group 的任务会排队执行
12 | cancel-in-progress: false # 不取消前一个任务,而是等待
13 | strategy:
14 | matrix:
15 | os: [ ubuntu-22.04 ]
16 | architecture: [ amd64 ]
17 | steps:
18 | - uses: actions/checkout@v3
19 | - uses: actions/setup-java@v3
20 | with:
21 | distribution: 'temurin'
22 | java-version: '11'
23 | cache: 'maven'
24 | - name: Build with Maven
25 | run: |
26 | mkdir -p /tmp/download
27 | bash -e shell/java/build-final-java.sh release /tmp/download
28 | bash shell/upload-bin.sh ${{ secrets.SECRET_ID }} ${{ secrets.SECRET_KEY }} ${{ secrets.BUCKET }} /tmp/download release ${{ secrets.HOST }}
--------------------------------------------------------------------------------
/.mvn/wrapper/maven-wrapper.properties:
--------------------------------------------------------------------------------
1 | # Licensed to the Apache Software Foundation (ASF) under one
2 | # or more contributor license agreements. See the NOTICE file
3 | # distributed with this work for additional information
4 | # regarding copyright ownership. The ASF licenses this file
5 | # to you under the Apache License, Version 2.0 (the
6 | # "License"); you may not use this file except in compliance
7 | # with the License. You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing,
12 | # software distributed under the License is distributed on an
13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | # KIND, either express or implied. See the License for the
15 | # specific language governing permissions and limitations
16 | # under the License.
17 | wrapperVersion=3.3.2
18 | distributionType=only-script
19 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.10/apache-maven-3.9.10-bin.zip
20 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.class
2 | *.war
3 | *.ear
4 | /target
5 |
6 | *~
7 | .classpath
8 | *.iml
9 | .idea
10 | .project
11 | .attach_pid*
12 | 1.log
13 | logs
14 | .settings
15 | target
16 | hs_err*.log
17 | /static/
18 | conf/classes
19 | conf/plugins/*
20 | zrlog-web/log
21 | zrlog-web/logs
22 | rebel.xml
23 | lib/*.jar
24 | zrlog-starter.jar
25 | *.hprof
26 | log/
27 | zrlog-web/sim.pid
28 | sim.pid
29 | .DS_Store
30 | .vscode
31 | pom.xml.versionsBackup
32 | zrlog-web/src/main/zrlog
33 | zrlog-web/src/main/lib
34 | conf/update-temp/zrlog.zip
35 | zrlog.zip
36 | /zrlog-web/src/main/resources/build.properties
37 | node_modules
38 | *.zip
39 | temp
40 | cache/**
41 | ._.DS_Store
42 | zrlog.bgv
43 | /zrlog
44 | /conf/update-temp/
45 | 1
46 | package/src/main/webapp/cache
47 | package/src/main/webapp/WEB-INF/plugins/*
48 | !package/src/main/webapp/WEB-INF/plugins/.gitkeep
49 | tomcat.*
50 | package/src/main/webapp/static/attached/*
51 | doc/build_system_info.md
52 | bootstrap
53 | conf/*.sql
54 | conf/sqlite-db.properties
55 | /zrlog-web/src/main/resources/build_system_info.md
56 |
--------------------------------------------------------------------------------
/package/src/assembly/native-zip.xml:
--------------------------------------------------------------------------------
1 |
5 | zip
6 |
7 | zip
8 |
9 | false
10 |
11 |
12 |
13 | ../
14 | /
15 |
16 | zrlog
17 | zrlog.exe
18 |
19 | doc/install.md
20 | doc/build_system_info.md
21 | LICENSE
22 | README.en-us.md
23 | README.md
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/package/src/main/java/com/zrlog/web/dev/SwsDevApplication.java:
--------------------------------------------------------------------------------
1 | package com.zrlog.web.dev;
2 |
3 | import com.hibegin.http.server.util.PathUtil;
4 | import com.zrlog.web.Application;
5 |
6 | import java.io.File;
7 | import java.net.URISyntaxException;
8 |
9 | /**
10 | * 以 SimpleWebServer 容器进行运行,除 war 包以外都用这个入口启动调试
11 | * 该文件不打包进入生产环境,仅开发调试用
12 | */
13 | public class SwsDevApplication {
14 |
15 |
16 | static {
17 | System.setProperty("sws.run.mode", "dev");
18 | }
19 |
20 | private static void initDevEnv() throws URISyntaxException {
21 | String programDir = new File(SwsDevApplication.class.getProtectionDomain().getCodeSource().getLocation().toURI()).getPath();
22 | //对应的开发模式
23 | if (programDir.contains("package/target/class") || programDir.contains("package\\target\\class")) {
24 | programDir = new File(programDir).getParentFile().getParentFile().getParent();
25 | }
26 | PathUtil.setRootPath(programDir);
27 | }
28 |
29 | public static void main(String[] args) throws Exception {
30 | initDevEnv();
31 | Application.start(args);
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/zrlog-web/src/main/java/com/zrlog/web/setup/install/ZrLogInstallAction.java:
--------------------------------------------------------------------------------
1 | package com.zrlog.web.setup.install;
2 |
3 | import com.hibegin.common.util.EnvKit;
4 | import com.zrlog.common.ZrLogConfig;
5 | import com.zrlog.install.web.config.DefaultInstallAction;
6 |
7 | import java.io.File;
8 |
9 | public class ZrLogInstallAction extends DefaultInstallAction {
10 |
11 | private final ZrLogConfig zrLogConfig;
12 | private final File lockFile;
13 |
14 | public ZrLogInstallAction(ZrLogConfig zrLogConfig, File lockFile) {
15 | this.zrLogConfig = zrLogConfig;
16 | this.lockFile = lockFile;
17 | }
18 |
19 | @Override
20 | public void installSuccess() {
21 | try {
22 | zrLogConfig.configDatabase();
23 | zrLogConfig.startPlugins(!EnvKit.isFaaSMode());
24 | } catch (Exception e) {
25 | throw new RuntimeException(e);
26 | }
27 | }
28 |
29 | @Override
30 | public boolean isInstalled() {
31 | return zrLogConfig.isInstalled();
32 | }
33 |
34 | @Override
35 | public File getLockFile() {
36 | return lockFile;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/.github/workflows/faas-build-preview-package-zip.yml:
--------------------------------------------------------------------------------
1 | name: build faas preview package
2 | on:
3 | push:
4 | branches:
5 | - master
6 | jobs:
7 | build:
8 | name: ZrLog on ${{ matrix.os }}
9 | runs-on: ${{ matrix.os }}
10 | concurrency:
11 | group: deploy-preview-on-${{ matrix.os }}-faas # 同一个 group 的任务会排队执行
12 | cancel-in-progress: false # 不取消前一个任务,而是等待
13 | strategy:
14 | matrix:
15 | os: [ ubuntu-22.04,ubuntu-24.04-arm ]
16 | steps:
17 | - uses: actions/checkout@v3
18 | with:
19 | fetch-depth: 0
20 | - uses: graalvm/setup-graalvm@v1
21 | with:
22 | java-version: '25'
23 | distribution: 'graalvm' # See 'Options' for all available distributions
24 | cache: 'maven'
25 | github-token: ${{ secrets.GITHUB_TOKEN }}
26 | native-image-job-reports: 'true'
27 |
28 | - name: Build and upload binary
29 | run: |
30 | mkdir -p /tmp/download
31 | bash -e shell/native/build-final-native.sh preview /tmp/download faas
32 | bash -e shell/upload-bin.sh ${{ secrets.SECRET_ID }} ${{ secrets.SECRET_KEY }} ${{ secrets.BUCKET }} /tmp/download preview ${{ secrets.HOST }}
--------------------------------------------------------------------------------
/.github/workflows/faas-build-release-package-zip.yml:
--------------------------------------------------------------------------------
1 | name: build faas release package
2 | on:
3 | push:
4 | branches:
5 | - release
6 | jobs:
7 | build:
8 | name: ZrLog on ${{ matrix.os }}
9 | runs-on: ${{ matrix.os }}
10 | concurrency:
11 | group: deploy-release-on-${{ matrix.os }}-faas # 同一个 group 的任务会排队执行
12 | cancel-in-progress: false # 不取消前一个任务,而是等待
13 | strategy:
14 | matrix:
15 | os: [ ubuntu-22.04,ubuntu-24.04-arm ]
16 | steps:
17 | - uses: actions/checkout@v3
18 | with:
19 | fetch-depth: 0
20 | - uses: graalvm/setup-graalvm@v1
21 | with:
22 | java-version: '25'
23 | distribution: 'graalvm' # See 'Options' for all available distributions
24 | cache: 'maven'
25 | github-token: ${{ secrets.GITHUB_TOKEN }}
26 | native-image-job-reports: 'true'
27 |
28 | - name: Build and upload binary
29 | run: |
30 | mkdir -p /tmp/download
31 | bash -e shell/native/build-final-native.sh release /tmp/download faas
32 | bash -e shell/upload-bin.sh ${{ secrets.SECRET_ID }} ${{ secrets.SECRET_KEY }} ${{ secrets.BUCKET }} /tmp/download release ${{ secrets.HOST }}
--------------------------------------------------------------------------------
/.github/workflows/native-build-preview-package-zip.yml:
--------------------------------------------------------------------------------
1 | name: build native preview package
2 | on:
3 | push:
4 | branches:
5 | - master
6 | jobs:
7 | build:
8 | name: ZrLog on ${{ matrix.os }}
9 | runs-on: ${{ matrix.os }}
10 | concurrency:
11 | group: deploy-preview-on-${{ matrix.os }}-native # 同一个 group 的任务会排队执行
12 | cancel-in-progress: false # 不取消前一个任务,而是等待
13 | strategy:
14 | matrix:
15 | os: [ ubuntu-22.04,ubuntu-24.04-arm,macos-15-intel,macos-14,windows-2022 ]
16 | steps:
17 | - uses: actions/checkout@v3
18 | with:
19 | fetch-depth: 0
20 | - uses: graalvm/setup-graalvm@v1
21 | with:
22 | java-version: '25'
23 | distribution: 'graalvm' # See 'Options' for all available distributions
24 | cache: 'maven'
25 | github-token: ${{ secrets.GITHUB_TOKEN }}
26 | native-image-job-reports: 'true'
27 |
28 | - name: Build and upload binary
29 | run: |
30 | mkdir -p /tmp/download
31 | bash -e shell/native/build-final-native.sh preview /tmp/download zip
32 | bash -e shell/upload-bin.sh ${{ secrets.SECRET_ID }} ${{ secrets.SECRET_KEY }} ${{ secrets.BUCKET }} /tmp/download preview ${{ secrets.HOST }}
--------------------------------------------------------------------------------
/.github/workflows/native-build-release-package-zip.yml:
--------------------------------------------------------------------------------
1 | name: build native release package
2 | on:
3 | push:
4 | branches:
5 | - release
6 | jobs:
7 | build:
8 | name: ZrLog on ${{ matrix.os }}
9 | runs-on: ${{ matrix.os }}
10 | concurrency:
11 | group: deploy-release-on-${{ matrix.os }}-native # 同一个 group 的任务会排队执行
12 | cancel-in-progress: false # 不取消前一个任务,而是等待
13 | strategy:
14 | matrix:
15 | os: [ ubuntu-22.04,ubuntu-24.04-arm,macos-15-intel,macos-14,windows-2022 ]
16 | steps:
17 | - uses: actions/checkout@v3
18 | with:
19 | fetch-depth: 0
20 | - uses: graalvm/setup-graalvm@v1
21 | with:
22 | java-version: '25'
23 | distribution: 'graalvm' # See 'Options' for all available distributions
24 | cache: 'maven'
25 | github-token: ${{ secrets.GITHUB_TOKEN }}
26 | native-image-job-reports: 'true'
27 |
28 | - name: Build and upload binary
29 | run: |
30 | mkdir -p /tmp/download
31 | bash -e shell/native/build-final-native.sh release /tmp/download zip
32 | bash -e shell/upload-bin.sh ${{ secrets.SECRET_ID }} ${{ secrets.SECRET_KEY }} ${{ secrets.BUCKET }} /tmp/download release ${{ secrets.HOST }}
--------------------------------------------------------------------------------
/package/src/assembly/faas-zip.xml:
--------------------------------------------------------------------------------
1 |
5 | zip
6 |
7 | zip
8 |
9 | false
10 |
11 |
12 |
13 | ../
14 | /
15 |
16 | zrlog
17 | bootstrap
18 | conf/plugins/
19 | static/include/templates/*.zip
20 |
21 | doc/install.md
22 | doc/build_system_info.md
23 | LICENSE
24 | README.en-us.md
25 | README.md
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/.github/workflows/deb-build-preview-deb.yml:
--------------------------------------------------------------------------------
1 | name: build preview deb
2 | on:
3 | push:
4 | branches:
5 | - master
6 | jobs:
7 | build:
8 | name: ZrLog on ${{ matrix.os }}
9 | # runs-on: [self-hosted, Linux, X64]
10 | # runs-on: buildjet-4vcpu-ubuntu-2204-arm
11 | runs-on: ${{ matrix.os }}
12 | concurrency:
13 | group: deploy-preview-on-${{ matrix.os }}-deb # 同一个 group 的任务会排队执行
14 | cancel-in-progress: false # 不取消前一个任务,而是等待
15 | strategy:
16 | matrix:
17 | os: [ ubuntu-22.04,ubuntu-24.04-arm ]
18 | steps:
19 | - uses: actions/checkout@v3
20 | with:
21 | fetch-depth: 0
22 | - uses: graalvm/setup-graalvm@v1
23 | with:
24 | java-version: '25'
25 | distribution: 'graalvm' # See 'Options' for all available distributions
26 | cache: 'maven'
27 | github-token: ${{ secrets.GITHUB_TOKEN }}
28 | native-image-job-reports: 'true'
29 |
30 | - name: Build and upload binary
31 | run: |
32 | mkdir -p /tmp/download
33 | bash -e shell/native/build-final-native.sh preview /tmp/download deb
34 | bash -e shell/upload-bin.sh ${{ secrets.SECRET_ID }} ${{ secrets.SECRET_KEY }} ${{ secrets.BUCKET }} /tmp/download preview ${{ secrets.HOST }}
--------------------------------------------------------------------------------
/.github/workflows/deb-build-release-deb.yml:
--------------------------------------------------------------------------------
1 | name: build release deb
2 | on:
3 | push:
4 | branches:
5 | - release
6 | jobs:
7 | build:
8 | name: ZrLog on ${{ matrix.os }}
9 | # runs-on: [self-hosted, Linux, X64]
10 | # runs-on: buildjet-4vcpu-ubuntu-2204-arm
11 | runs-on: ${{ matrix.os }}
12 | concurrency:
13 | group: deploy-release-on-${{ matrix.os }}-deb # 同一个 group 的任务会排队执行
14 | cancel-in-progress: false # 不取消前一个任务,而是等待
15 | strategy:
16 | matrix:
17 | os: [ ubuntu-22.04,ubuntu-24.04-arm ]
18 | steps:
19 | - uses: actions/checkout@v3
20 | with:
21 | fetch-depth: 0
22 | - uses: graalvm/setup-graalvm@v1
23 | with:
24 | java-version: '25'
25 | distribution: 'graalvm' # See 'Options' for all available distributions
26 | cache: 'maven'
27 | github-token: ${{ secrets.GITHUB_TOKEN }}
28 | native-image-job-reports: 'true'
29 |
30 | - name: Build and upload binary
31 | run: |
32 | mkdir -p /tmp/download
33 | bash -e shell/native/build-final-native.sh release /tmp/download deb
34 | bash -e shell/upload-bin.sh ${{ secrets.SECRET_ID }} ${{ secrets.SECRET_KEY }} ${{ secrets.BUCKET }} /tmp/download release ${{ secrets.HOST }}
--------------------------------------------------------------------------------
/package/src/assembly/java-zip.xml:
--------------------------------------------------------------------------------
1 |
5 | zip
6 |
7 | zip
8 |
9 | false
10 |
11 |
12 |
13 | ../
14 | /
15 |
16 | lib/**
17 | zrlog-starter.jar
18 |
19 | bin/start.sh
20 | bin/start.bat
21 | bin/run.sh
22 |
23 | doc/install.md
24 | doc/build_system_info.md
25 | LICENSE
26 | README.en-us.md
27 | README.md
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/shell/native/package-faas-zip.sh:
--------------------------------------------------------------------------------
1 | mkdir -p conf/plugins
2 | rm -rf conf/plugins/*
3 | mkdir -p conf/plugins/installed-plugins
4 | mkdir -p static/include/templates
5 | rm -rf static/include/templates/*
6 | arch=${1}
7 | urls=(
8 | "static-plus-${arch}.bin"
9 | "rss-${arch}.bin"
10 | "comment-${arch}.bin"
11 | "article-arranger-${arch}.bin"
12 | "mail-${arch}.bin"
13 | "statistics-${arch}.bin"
14 | # 这里可以继续添加其他插件
15 | )
16 | UA="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36"
17 | mirrorWebSite=https://pub-c16cba848aff4e6b8d8e0d00f0f741f0.r2.dev
18 |
19 | for url in "${urls[@]}"; do
20 | filename=$(basename "$url")
21 | wget --user-agent="${UA}" -O "conf/plugins/installed-plugins/$filename" "${mirrorWebSite}/plugin/$url?v=$(date +%s)"
22 | done
23 | wget --user-agent="${UA}" -O "conf/plugins/plugin-core-${arch}.bin" "${mirrorWebSite}/plugin/core/faas/plugin-core-${arch}.bin?v=$(date +%s)"
24 | #tempaltes
25 | wget --user-agent="${UA}" -O "static/include/templates/template-sheshui.zip" "${mirrorWebSite}/attachment/template/template-sheshui.zip?v=$(date +%s)"
26 | wget --user-agent="${UA}" -O "static/include/templates/template-www.zip" "${mirrorWebSite}/attachment/template/template-www.zip?v=$(date +%s)"
27 | #cd conf && zip -r plugins.zip plugins/** plugins/**/**
28 | #cd ..
29 | ln -s zrlog bootstrap
30 | ./mvnw -Dproject.build.outputTimestamp=2013-01-01T00:00:00Z -Ppackage-faas-zip assembly:single -f "package/pom.xml"
--------------------------------------------------------------------------------
/package/src/main/java/com/zrlog/web/dev/JakartaServletDevApplication.java:
--------------------------------------------------------------------------------
1 | package com.zrlog.web.dev;
2 |
3 | import com.zrlog.common.Constants;
4 | import com.zrlog.util.ZrLogUtil;
5 | import org.apache.catalina.LifecycleException;
6 | import org.apache.catalina.startup.Tomcat;
7 |
8 | import java.io.File;
9 |
10 | /**
11 | * 以标准 web 能运行的程序(Servlet,仅 war 包)
12 | * 该文件不打包进入生产环境,仅开发调试用
13 | */
14 | public class JakartaServletDevApplication {
15 |
16 | static {
17 | System.setProperty("sws.run.mode", "dev");
18 | }
19 |
20 | public static void main(String[] args) throws LifecycleException {
21 | // Declare an alternative location for your "target/classes" dir
22 | Constants.init();
23 | File additionWebInfClasses = new File("target/classes");
24 | String webappDirLocation = "src/main/webapp/";
25 | Tomcat tomcat = new Tomcat();
26 | tomcat.setPort(ZrLogUtil.getPort(args));
27 | //创建服务
28 | tomcat.getConnector();
29 | tomcat.setBaseDir(additionWebInfClasses.toString());
30 | //idea的路径eclipse启动的路径有区别
31 | if (!new File("").getAbsolutePath().endsWith(File.separator + "package")) {
32 | webappDirLocation = "package/" + webappDirLocation;
33 | }
34 | tomcat.setAddDefaultWebXmlToWebapp(true);
35 | tomcat.addWebapp(ZrLogUtil.getContextPath(args), new File(webappDirLocation).getAbsolutePath());
36 | tomcat.start();
37 | tomcat.getServer().await();
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/zrlog-web/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | zrlog-web-parent
7 | com.hibegin
8 | 3.2.3-SNAPSHOT
9 |
10 | 4.0.0
11 | zrlog-web
12 |
13 |
14 |
15 | com.hibegin
16 | zrlog-blog-web
17 |
18 |
19 | com.hibegin
20 | zrlog-admin-web
21 |
22 |
23 | jakarta.servlet
24 | jakarta.servlet-api
25 |
26 |
27 | com.hibegin
28 | simplewebserver-servlet-api-impl
29 |
30 |
31 | com.hibegin
32 | simplewebserver-lambda-function-impl
33 |
34 |
35 | com.hibegin
36 | zrlog-install-web
37 |
38 |
39 |
--------------------------------------------------------------------------------
/package/src/main/java/com/zrlog/web/GraalvmAgentApplication.java:
--------------------------------------------------------------------------------
1 | package com.zrlog.web;
2 |
3 | import com.hibegin.http.server.WebServerBuilder;
4 | import com.hibegin.http.server.util.NativeImageUtils;
5 | import com.hibegin.http.server.util.PathUtil;
6 | import com.hibegin.lambda.rest.ApiGatewayHttp;
7 | import com.hibegin.lambda.rest.ApiGatewayRequestContext;
8 | import com.hibegin.lambda.rest.LambdaApiGatewayRequest;
9 | import com.hibegin.lambda.rest.LambdaApiGatewayResponse;
10 | import com.zrlog.common.Constants;
11 | import com.zrlog.common.ZrLogConfig;
12 | import com.zrlog.util.BlogBuildInfoUtil;
13 | import com.zrlog.util.ZrLogUtil;
14 |
15 | import java.util.Arrays;
16 |
17 | /**
18 | * 该类仅提供基础的 graalvm native image agent 运行依赖反射扫描等功能,不作为实际的启动入口
19 | */
20 | public class GraalvmAgentApplication {
21 |
22 | private static void lambdaJson() {
23 | NativeImageUtils.gsonNativeAgentByClazz(Arrays.asList(LambdaApiGatewayRequest.class, ApiGatewayHttp.class,
24 | ApiGatewayRequestContext.class, LambdaApiGatewayResponse.class));
25 | }
26 |
27 | public static void main(String[] args) throws Exception {
28 | ZrLogConfig.nativeImageAgent = true;
29 | BlogBuildInfoUtil.getBlogProp();
30 | PathUtil.setRootPath(System.getProperty("user.dir").replace("/package/target", ""));
31 | lambdaJson();
32 | //last
33 | webserver(args);
34 | }
35 |
36 | private static void webserver(String[] args) {
37 | WebServerBuilder webServerBuilder = Application.webServerBuilder(0, ZrLogUtil.getContextPath(args), null);
38 | Constants.zrLogConfig.getServerConfig().addCreateSuccessHandle(() -> {
39 | System.exit(0);
40 | return null;
41 | });
42 | webServerBuilder.start();
43 | }
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/shell/java/build-final-java.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | echo "current "$PWD
3 | PWD=`pwd`
4 | bash -e shell/java/package-java-zip.sh "${1}"
5 | function buildProp() {
6 | grep "${1}" "zrlog-web/src/main/resources/build.properties"|awk -F ${1}'=' '{print $2}'
7 | }
8 |
9 | mirrorWebSite=$(buildProp 'mirrorWebSite')
10 | version=$(buildProp 'version')
11 | runMode=$(buildProp 'runMode')
12 | Date=$(buildProp 'buildTime')
13 | buildId=$(buildProp 'buildId')
14 | runModeDesc=$(buildProp 'runModeDesc')
15 | mv target/zrlog-${version}.zip zrlog.zip
16 | cp target/zrlog-"${version}".war zrlog.war
17 | #zip zrlog.war -d WEB-INF/install.lock WEB-INF/db.properties
18 | #finnally workPath
19 | syncPath=${2}
20 | mkdir -p ${syncPath}/${runMode}
21 | relativeFileName=${runMode}/zrlog-${version}-${buildId}-${runMode}.war
22 | finalFileName=${syncPath}/${runMode}/zrlog.war
23 | zipFileName=${runMode}/zrlog-${version}-${buildId}-${runMode}.zip
24 | zipFinalFileName=${syncPath}/${runMode}/zrlog.zip
25 | cp zrlog.zip ${zipFinalFileName}
26 | cp zrlog.zip ${syncPath}/${zipFileName}
27 | cp zrlog.war ${finalFileName}
28 | cp zrlog.war ${syncPath}/${relativeFileName}
29 | fileSize=$(ls ${finalFileName} -ls | awk '{print $6}')
30 | md5sum=$(md5sum ${finalFileName} | awk '{print $1}')
31 | zipFileSize=$(ls ${zipFinalFileName} -ls | awk '{print $6}')
32 | zipMd5sum=$(md5sum ${zipFinalFileName} | awk '{print $1}')
33 | echo -e '{"md5sum":"54db99172e53542a152c505f0c23a845","zipMd5sum":"'${zipMd5sum}'","warMd5sum":"'${md5sum}'","downloadUrl":"'${mirrorWebSite}release/javax-war/zrlog.war'","zipDownloadUrl":"'${mirrorWebSite}${zipFileName}'" ,"warDownloadUrl":"'${mirrorWebSite}${relativeFileName}'","type":"'${runModeDesc}'","version":"'${version}'","buildId":"'${buildId}'","fileSize":10794045,"warFileSize":'${fileSize}',"zipFileSize":'${zipFileSize}',"releaseDate":"'${Date}'"}' > ${syncPath}/${runMode}/last.version.json
34 |
--------------------------------------------------------------------------------
/bin/build-system-info.sh:
--------------------------------------------------------------------------------
1 | REPORT_FILE=zrlog-web/src/main/resources/build_system_info.md
2 |
3 | mkdir -p "$(dirname "$REPORT_FILE")"
4 |
5 | echo "### 🧾 Build System info" > "$REPORT_FILE"
6 | echo "" >> "$REPORT_FILE"
7 |
8 | # OS Info
9 | echo "#### 🖥 OS Info" >> "$REPORT_FILE"
10 | {
11 | echo '```'
12 | uname -srmv
13 | echo
14 | [ -f /etc/os-release ] && cat /etc/os-release
15 | command -v sw_vers &> /dev/null && sw_vers
16 | echo '```'
17 | } >> "$REPORT_FILE"
18 | echo "" >> "$REPORT_FILE"
19 |
20 | # CPU Info
21 | echo "#### 🧠 CPU Info" >> "$REPORT_FILE"
22 | {
23 | echo '```'
24 | if command -v lscpu &> /dev/null; then
25 | lscpu
26 | elif [[ "$OSTYPE" == "darwin"* ]]; then
27 | sysctl -a | grep machdep.cpu
28 | elif command -v wmic &> /dev/null; then
29 | powershell -Command "(Get-CimInstance Win32_Processor)[0] | ForEach-Object { 'Name=' + \$_.Name; 'Cores=' + \$_.NumberOfCores; 'Threads=' + \$_.NumberOfLogicalProcessors }"
30 | else
31 | echo "CPU info not available for this platform"
32 | fi
33 | echo '```'
34 | } >> "$REPORT_FILE"
35 | echo "" >> "$REPORT_FILE"
36 |
37 | # Java Version
38 | echo "#### ☕ Java Version" >> "$REPORT_FILE"
39 | {
40 | echo '```'
41 | java -version 2>&1
42 | echo '```'
43 | } >> "$REPORT_FILE"
44 | echo "" >> "$REPORT_FILE"
45 |
46 | # GitHub Runner Context (optional)
47 | echo "#### 🤖 Runner Context" >> "$REPORT_FILE"
48 | {
49 | echo '```'
50 | echo "RUNNER_OS=$RUNNER_OS"
51 | echo "RUNNER_ARCH=$RUNNER_ARCH"
52 | echo "GITHUB_REPOSITORY=$GITHUB_REPOSITORY"
53 | echo "GITHUB_SHA=$GITHUB_SHA"
54 | echo '```'
55 | } >> "$REPORT_FILE"
56 |
57 | # Build properties info
58 | echo "#### 📃 Build.properties Info" >> "$REPORT_FILE"
59 | {
60 | echo '```properties'
61 | # shellcheck disable=SC2046
62 | echo "$(cat 'zrlog-web/src/main/resources/build.properties')"
63 | echo '```'
64 | } >> "$REPORT_FILE"
65 |
66 | cp ${REPORT_FILE} "doc/"
--------------------------------------------------------------------------------
/zrlog-web/src/main/java/com/zrlog/web/filter/ZrLogSwsServletFilter.java:
--------------------------------------------------------------------------------
1 | package com.zrlog.web.filter;
2 |
3 | import com.hibegin.common.util.EnvKit;
4 | import com.hibegin.common.util.ObjectUtil;
5 | import com.hibegin.http.server.PortDetector;
6 | import com.hibegin.http.server.config.AbstractServerConfig;
7 | import com.hibegin.http.server.web.SwsServletFilter;
8 | import com.zrlog.admin.web.plugin.WarUpdater;
9 | import com.zrlog.common.Constants;
10 | import com.zrlog.common.Updater;
11 | import com.zrlog.util.ZrLogUtil;
12 | import com.zrlog.web.util.UpdaterUtils;
13 | import com.zrlog.web.config.ZrLogConfigImpl;
14 |
15 | import java.io.File;
16 | import java.lang.management.ManagementFactory;
17 |
18 | /**
19 | * 适配标准 Servlet 容器
20 | */
21 | public class ZrLogSwsServletFilter extends SwsServletFilter {
22 |
23 |
24 | private String getWarFile() {
25 | String contextPath = getServletContext().getContextPath();
26 | String webappPath = new File(getServletContext().getRealPath("/")).getParent();
27 | if ("/".equals(contextPath) || "".equals(contextPath)) {
28 | return webappPath + "/ROOT.war";
29 | } else {
30 | return webappPath + contextPath + ".war";
31 | }
32 | }
33 |
34 | @Override
35 | protected AbstractServerConfig getServerConfig() {
36 | Constants.zrLogConfig = new ZrLogConfigImpl(ObjectUtil.requireNonNullElse(PortDetector.detectHttpPort(), ZrLogUtil.getPort(ManagementFactory.getRuntimeMXBean().getInputArguments().toArray(new String[0]))),
37 | getUpdater(), getFilterConfig().getServletContext().getContextPath());
38 | return Constants.zrLogConfig;
39 | }
40 |
41 | private Updater getUpdater() {
42 | if (EnvKit.isDevMode()) {
43 | return UpdaterUtils.getUpdater(new String[0], null);
44 | }
45 | return new WarUpdater(new File(getWarFile()));
46 | }
47 |
48 | @Override
49 | public void init() {
50 | super.init();
51 | Constants.zrLogConfig.startPlugins(!EnvKit.isFaaSMode());
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/zrlog-web/src/main/java/com/zrlog/web/setup/install/InstallWebSetup.java:
--------------------------------------------------------------------------------
1 | package com.zrlog.web.setup.install;
2 |
3 | import com.hibegin.common.util.LoggerUtil;
4 | import com.hibegin.http.server.util.NativeImageUtils;
5 | import com.zrlog.common.Updater;
6 | import com.zrlog.common.ZrLogConfig;
7 | import com.zrlog.install.util.InstallNativeImageResourceUtils;
8 | import com.zrlog.install.web.InstallAction;
9 | import com.zrlog.install.web.InstallConstants;
10 | import com.zrlog.install.web.config.InstallRouters;
11 | import com.zrlog.install.web.interceptor.BlogInstallInterceptor;
12 | import com.zrlog.web.WebSetup;
13 |
14 | import java.io.File;
15 | import java.util.Arrays;
16 | import java.util.logging.Level;
17 | import java.util.logging.Logger;
18 |
19 | public class InstallWebSetup implements WebSetup {
20 |
21 | private static final Logger LOGGER = LoggerUtil.getLogger(InstallWebSetup.class);
22 | private final ZrLogConfig zrLogConfig;
23 | private final File dbPropertiesFile;
24 | private final File lockFile;
25 | private final Updater updater;
26 |
27 | public InstallWebSetup(ZrLogConfig zrLogConfig, File dbPropertiesFile, File lockFile, Updater updater) {
28 | this.zrLogConfig = zrLogConfig;
29 | this.dbPropertiesFile = dbPropertiesFile;
30 | this.lockFile = lockFile;
31 | if (zrLogConfig.getServerConfig().isNativeImageAgent()) {
32 | InstallNativeImageResourceUtils.reg();
33 | }
34 | this.updater = updater;
35 | }
36 |
37 | @Override
38 | public void setup() {
39 | InstallConstants.installConfig = new ZrLogInstallConfig(zrLogConfig, dbPropertiesFile, lockFile, updater);
40 | InstallRouters.configRouter(zrLogConfig.getServerConfig());
41 | zrLogConfig.getServerConfig().addInterceptor(BlogInstallInterceptor.class);
42 | InstallAction action = InstallConstants.installConfig.getAction();
43 | if (action.isInstalled()) {
44 | return;
45 | }
46 | LOGGER.log(Level.WARNING, "Not found lock file(" + action.getLockFile() + "), Please visit the http://yourHostName:port" + zrLogConfig.getServerConfig().getContextPath() + "/install start installation");
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/doc/developer.md:
--------------------------------------------------------------------------------
1 | ## ZrLog 开发指南
2 |
3 | ### 实际源码仓库
4 |
5 | | 工程 | 最新版本 |
6 | |--------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
7 | | [基础库 (Base)](https://github.com/zrlog-extensions/zrlog-base) | [](https://central.sonatype.com/artifact/com.hibegin/zrlog-base) |
8 | | [初始化程序 (Install)](https://github.com/zrlog-extensions/zrlog-install-web) | [](https://central.sonatype.com/artifact/com.hibegin/zrlog-install-web) |
9 | | [服务端页面渲染 (Pages)](https://github.com/zrlog-extensions/zrlog-blog-web) | [](https://central.sonatype.com/artifact/com.hibegin/zrlog-blog-web) |
10 | | [管理后台 (Admin)](https://github.com/zrlog-extensions/zrlog-admin-web ) | [](https://central.sonatype.com/artifact/com.hibegin/zrlog-admin-web) |
11 | | [DAO](https://github.com/94fzb/common-dao ) | [](https://central.sonatype.com/artifact/com.hibegin/common-dao) |
12 | | [Web Core](https://github.com/94fzb/simplewebserver ) | [](https://central.sonatype.com/artifact/com.hibegin/simplewebserver) |
13 |
14 | ### 开发流程
15 |
16 | 1. 当前工程,仅完成打包和 web模块的载入,变更上述仓库的代码进行实际变更
17 | 2. 通过工程那的 shell 脚本进行打包(实际需要将代码发布 maven 中央仓库)
18 | 3. 改工程修改对应模块的依赖,完成代码变更
19 |
20 | 注:开发环境下可以通对应工程的 `Application` 进行调试开发,或者通过 `./mvnw clean install` 使用 SNAPSHOT 的方式进行快速预览
21 |
22 | ### 开发资源
23 |
24 | [开发必看](https://blog.zrlog.com/for-developer)
--------------------------------------------------------------------------------
/shell/native/build-final-native.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | echo "current "$PWD
3 | PWD=`pwd`
4 | function buildProp() {
5 | grep "${1}" "zrlog-web/src/main/resources/build.properties"|awk -F ${1}'=' '{print $2}'
6 | }
7 | buildSubType=${3}
8 | OS="$(uname)"
9 | case $OS in
10 | Linux)
11 | OS='linux'
12 | ;;
13 | Darwin)
14 | OS='mac'
15 | ;;
16 | *)
17 | OS='windows'
18 | ;;
19 | esac
20 | packageExt="zip"
21 | # 判断操作系统类型
22 | if [[ "${OS}" == "windows" ]]; then
23 | fileArch=Windows-$(uname -m)
24 | elif [[ ${buildSubType} == "deb" ]]; then
25 | fileArch=$(uname -s)-$(dpkg --print-architecture)
26 | packageExt="deb"
27 | elif [[ "${OS}" == "linux" ]]; then
28 | fileArch=$(uname -s)-$(dpkg --print-architecture)
29 | else
30 | fileArch=$(uname -s)-$(uname -m)
31 | fi
32 | if [[ "${buildSubType}" == "faas" ]]; then
33 | bash -e shell/native/package-native-${packageExt}.sh "${1}" "-Dmysql-scope='provided'"
34 | else
35 | bash -e shell/native/package-native-${packageExt}.sh "${1}"
36 | fi
37 |
38 | mirrorWebSite=$(buildProp 'mirrorWebSite')
39 | version=$(buildProp 'version')
40 | runMode=$(buildProp 'runMode')
41 | Date=$(buildProp 'buildTime')
42 | buildId=$(buildProp 'buildId')
43 | runModeDesc=$(buildProp 'runModeDesc')
44 |
45 | syncPath=${2}
46 | mkdir -p ${syncPath}/${runMode}
47 | #faas
48 | if [[ "${OS}" == "linux" && "${buildSubType}" == "faas" ]]; then
49 | bash -e shell/native/package-${buildSubType}-${packageExt}.sh ${fileArch}
50 | cp target/zrlog-${version}-${buildSubType}.${packageExt} ${syncPath}/${runMode}/zrlog-${version}-${buildId}-${runMode}-${fileArch}-${buildSubType}.${packageExt}
51 | cp target/zrlog-${version}-${buildSubType}.${packageExt} ${syncPath}/${runMode}/zrlog-${fileArch}-${buildSubType}.${packageExt}
52 | else
53 | #
54 | buildFile=target/zrlog-${version}-native.${packageExt}
55 | zipFileName=${runMode}/zrlog-${version}-${buildId}-${runMode}-${fileArch}.${packageExt}
56 | zipFinalFileName=${syncPath}/${runMode}/zrlog-${fileArch}.${packageExt}
57 | cp ${buildFile} ${zipFinalFileName}
58 | cp ${buildFile} ${syncPath}/${zipFileName}
59 | zipFileSize=$(ls -ls ${zipFinalFileName} | awk '{print $6}')
60 | if command -v md5sum >/dev/null 2>&1; then
61 | zipMd5sum=$(md5sum ${zipFinalFileName} | awk '{ print $1 }')
62 | else
63 | zipMd5sum=$(md5 ${zipFinalFileName} | awk '{ print $NF }')
64 | fi
65 | if [[ "${packageExt}" == "zip" ]]; then
66 | echo -e '{"zipMd5sum":"'${zipMd5sum}'","zipDownloadUrl":"'${mirrorWebSite}${zipFileName}'","type":"'${runModeDesc}'","version":"'${version}'","buildId":"'${buildId}'","zipFileSize":'${zipFileSize}',"releaseDate":"'${Date}'"}' > ${syncPath}/${runMode}/last.${fileArch}.version.json
67 | fi
68 | fi
--------------------------------------------------------------------------------
/zrlog-web/src/main/java/com/zrlog/web/config/ZrLogConfigImpl.java:
--------------------------------------------------------------------------------
1 | package com.zrlog.web.config;
2 |
3 | import com.hibegin.common.dao.DataSourceWrapper;
4 | import com.mysql.cj.jdbc.AbandonedConnectionCleanupThread;
5 | import com.zrlog.business.plugin.CacheManagerPlugin;
6 | import com.zrlog.business.plugin.PluginCorePluginImpl;
7 | import com.zrlog.business.service.DbUpgradeService;
8 | import com.zrlog.common.TokenService;
9 | import com.zrlog.common.Updater;
10 | import com.zrlog.common.ZrLogConfig;
11 | import com.zrlog.common.vo.PublicWebSiteInfo;
12 | import com.zrlog.data.cache.CacheServiceImpl;
13 | import com.zrlog.plugin.Plugins;
14 | import com.zrlog.web.WebSetup;
15 | import com.zrlog.web.inteceptor.DefaultInterceptor;
16 |
17 | import java.util.Objects;
18 | import java.util.logging.Level;
19 |
20 | /**
21 | * 核心一些参数的配置。
22 | */
23 | public class ZrLogConfigImpl extends ZrLogConfig {
24 |
25 | private final SetupConfig setupConfig;
26 |
27 | public ZrLogConfigImpl(Integer port, Updater updater, String contextPath) {
28 | super(port, updater, contextPath);
29 | this.setupConfig = new SetupConfig(this, dbPropertiesFile, installLockFile, contextPath, webSetups, updater);
30 | //config
31 | this.webSetups.forEach(WebSetup::setup);
32 | if (!setupConfig.isIncludeBlog()) {
33 | serverConfig.getInterceptors().add(DefaultInterceptor.class);
34 | }
35 | }
36 |
37 | @Override
38 | public DataSourceWrapper configDatabase() throws Exception {
39 | this.dataSource = super.configDatabase();
40 | if (Objects.nonNull(dataSource)) {
41 | this.cacheService = new CacheServiceImpl();
42 | new DbUpgradeService(this.dataSource, this.cacheService.getCurrentSqlVersion()).tryDoUpgrade();
43 | }
44 | return dataSource;
45 | }
46 |
47 | @Override
48 | protected TokenService initTokenService() {
49 | if (Objects.isNull(cacheService)) {
50 | return null;
51 | }
52 | PublicWebSiteInfo publicWebSiteInfo = this.cacheService.getPublicWebSiteInfo();
53 | return setupConfig.buildAdminTokenService(publicWebSiteInfo.getSession_timeout());
54 | }
55 |
56 | @Override
57 | public Plugins getBasePluginList() {
58 | Plugins plugins = new Plugins();
59 | if (isTest()) {
60 | return plugins;
61 | }
62 | try {
63 | plugins.add(new PluginCorePluginImpl(dbPropertiesFile, serverConfig.getContextPath()));
64 | plugins.add(new CacheManagerPlugin(this));
65 | } catch (Exception e) {
66 | LOGGER.log(Level.WARNING, "configPlugin exception ", e);
67 | }
68 | return plugins;
69 | }
70 |
71 | @Override
72 | public void stop() {
73 | super.stop();
74 | if (Objects.nonNull(this.dataSource)) {
75 | if (this.dataSource.isWebApi()) {
76 | return;
77 | }
78 | }
79 | AbandonedConnectionCleanupThread.checkedShutdown();
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ## ZrLog   [](http://www.apache.org/licenses/LICENSE-2.0)
2 |
3 | [中文](README.md) | [English](README.en-us.md)
4 |
5 | ZrLog是使用 Java 开发的博客/CMS程序,具有简约,易用,组件化,内存占用低等特点。自带 Markdown
6 | 编辑器,让更多的精力放在写作上,而不是花费大量时间在学习程序的使用上。
7 |
8 | ### 程序主页
9 |
10 | [https://www.zrlog.com](https://www.zrlog.com)
11 |
12 | ### 一图胜千言
13 |
14 | #### 文章详情页
15 |
16 | 
17 |
18 | #### 文章编辑页
19 |
20 | 
21 |
22 | #### 文章编辑页【暗黑模式】
23 |
24 | 
25 |
26 | #### 文章编辑页【PWA全屏】
27 |
28 | 
29 |
30 | #### 文章编辑页【PWA全屏-打开设置抽屉】
31 |
32 | 
33 |
34 | ### 特性
35 |
36 | 1. 提供日志,分类,标签,评论的管理
37 | 2. 支持插件模式 [如何编写一个插件](https://blog.zrlog.com/zrlog-plugin-dev.html)
38 | 3. 高度可定制的主题功能 [如何制作一套主题](https://blog.zrlog.com/make-theme-for-zrlog.html)
39 | 4. 支持第三方评论插件
40 | 5. 提供 `markdown` 富文本编辑器,基本上满足了管理员的编辑需求
41 | 6. 页面静态化,缓存公共数据,访问速度更快
42 | 7. 支持扩展第三方云存储(默认七牛)
43 | 8. 支持数据库定时备份
44 | 9. 在线更新升级
45 | 10. ...
46 |
47 | ### 快速开始
48 |
49 | - 直接通过内嵌入容器的方式进行启动,找到 `com.zrlog.web.Application` 通过这个 `main()` 进行启动
50 | - 通过 Maven 命令的方式进行启动(不依赖任何 IDE)
51 | - Windows 使用 `bin\mvn-run.cmd`
52 | - Unix 使用 `sh bin/mvn-run.sh`
53 |
54 | ### 程序安装
55 |
56 | * 部署环境前提
57 | * JDK 版本 >= 21(若选择 GraalVM Native Image 包,可以不安装 JDK)
58 | * MySQL >= 5.7 或者 Cloudflare D1(webapi 方式访问)
59 |
60 | * 数据初始化
61 | * 下载 [最新 zip](https://www.zrlog.com/download) 解压,运行 bin/start.sh 或者是 bin/start.bat
62 | * 访问 `http://host:port/install`
63 | * 填写数据库,管理员信息,完成安装
64 |
65 | ### 变更日志
66 |
67 | [查看完整的ChangeLog](https://www.zrlog.com/changelog/index.html?ref=md)
68 |
69 | ### 示例网站
70 |
71 | * 网址 [https://demo.zrlog.com](https://demo.zrlog.com)
72 | * 管理地址 [admin/login](https://demo.zrlog.com/admin/login)
73 | * 用户名 admin
74 | * 密码 123456
75 |
76 | ### 获取帮助
77 |
78 | * 微信号 hibegin
79 | * 邮件 support@zrlog.com
80 | * 对程序有任何问题,欢迎反馈 [https://blog.zrlog.com/feedback.html](https://blog.zrlog.com/feedback.html)
81 |
82 | ### 常见问题
83 |
84 | #### docker模式下,输入正确的数据库信息,仍无法完成安装
85 |
86 | - https://blog.zrlog.com/faq-collect.html
87 |
88 | #### 其它问题
89 |
90 | 如何你遇到了一些问题,可以先去这里找下 [常见问题](https://blog.zrlog.com/faq-collect.html)
91 |
92 | ### 感谢
93 |
94 | * [JFinal](https://jfinal.com)
95 | * [Editor.md](https://pandao.github.io/editor.md/)
96 | * [SheShui.me](http://sheshui.me)
97 | * [Gentelella](https://github.com/puikinsh/gentelella)
98 | * [AntD](https://ant.design)
99 | * [Jetbrains](https://www.jetbrains.com/)
100 | * [e-lionel](http://www.e-lionel.com)
101 | * [Cloudflare](https://www.cloudflare.com)
102 |
103 | ### 协议
104 |
105 | ZrLog is Open Source software released under the [Apache 2.0 license](https://www.apache.org/licenses/LICENSE-2.0.html).
106 |
--------------------------------------------------------------------------------
/README.en-us.md:
--------------------------------------------------------------------------------
1 | ## ZrLog   [](http://www.apache.org/licenses/LICENSE-2.0)
2 |
3 | [Chinese](README.md) | [English](README.en-us.md)
4 |
5 | ZrLog is a blog/CMS program developed in Java. It is simple, easy to use, componentized, and has low memory footprint.
6 | Bring your own Markdown editor and let more focus on writing, rather than spending a lot of time learning the use of the
7 | program.
8 |
9 | ### Homepage
10 |
11 | [https://www.zrlog.com](https://www.zrlog.com)
12 |
13 | ### Pictures
14 |
15 | 
16 |
17 | 
18 |
19 | ### Features
20 |
21 | 1. Provide management of logs, categories, tags, and comments
22 | 2. Support plugin mode [How to write a plugin](https://blog.zrlog.com/zrlog-plugin-dev.html)
23 | 3. Highly customizable theme features [How to make a set of themes](https://blog.zrlog.com/ake-theme-for-zrlog.html)
24 | 4. Support third party comment plugin
25 | 5. Provide `markdown` mainstream rich text editor, basically meet the editing needs of administrators
26 | 6. Page static, cache public data, faster access
27 | 7. Support for extending third-party cloud storage (default seven cattle)
28 | 8. Support database scheduled backup
29 | 9. Online update upgrade
30 | 10. ...
31 |
32 | ### Quick start
33 |
34 | - Start directly by embedding tomcat and find `com.zrlog.web.Application` to start with this `main()`
35 | - Start with Maven commands (without relying on any IDE)
36 | - Windows uses `bin\mvn-run.cmd`
37 | - Unix uses `sh bin/mvn-run.sh`
38 |
39 | ### Program installation
40 |
41 | - Deployment environment prerequisites
42 | - 1.jdk version >= 21
43 | - 2.mysql/cloudflare d1
44 | - Data initialization
45 | - 1.Download [latest zip](https://www.zrlog.com/download) unzip, and run sh bin/run.sh or bin\run.bat (for windows)
46 | - 2.Visit `http://host:port/install`
47 | - 3.Fill in the database, administrator information, complete the installation
48 |
49 | ### ChangeLog
50 |
51 | [View the full ChangeLog](https://www.zrlog.com/changelog/index.html?ref=md)
52 |
53 | ### Sample Website
54 |
55 | * Website [http://demo.zrlog.com](https://demo.zrlog.com)
56 | * Management address [admin/login](https://demo.zrlog.com/admin/login)
57 | * Username admin
58 | * Password 123456
59 |
60 | ### Getting help
61 |
62 | * QQ group 6399942
63 | * Mail support@zrlog.com
64 | * Have any questions about the program, welcome feedback [http://blog.zrlog.com/feedback.html](https://blog.zrlog.com/feedback.html)
65 |
66 | ### FAQ
67 |
68 | If you have some problems, you can go here to find [FAQ](https://blog.zrlog.com/faq-collect.html)
69 |
70 | ### Thanks
71 |
72 | * [JFinal](https://jfinal.com)
73 | * [Editor.md](https://pandao.github.io/editor.md/)
74 | * [SheShui.me](http://sheshui.me)
75 | * [Gentelella](https://github.com/puikinsh/gentelella)
76 | * [AntD](https://ant.design)
77 | * [Jetbrains](https://www.jetbrains.com/)
78 | * [e-lionel](http://www.e-lionel.com)
79 | * [Cloudflare](https://www.cloudflare.com)
80 |
81 | ### License
82 |
83 | ZrLog is Open Source software released under the [Apache 2.0 license](https://www.apache.org/licenses/LICENSE-2.0.html).
84 |
--------------------------------------------------------------------------------
/zrlog-web/src/main/java/com/zrlog/web/Application.java:
--------------------------------------------------------------------------------
1 | package com.zrlog.web;
2 |
3 | import com.hibegin.common.util.EnvKit;
4 | import com.hibegin.common.util.ParseArgsUtil;
5 | import com.hibegin.http.server.WebServerBuilder;
6 | import com.hibegin.http.server.util.PathUtil;
7 | import com.hibegin.lambda.LambdaApplication;
8 | import com.zrlog.admin.web.plugin.ZipUpdater;
9 | import com.zrlog.common.Constants;
10 | import com.zrlog.common.Updater;
11 | import com.zrlog.common.exception.NotImplementException;
12 | import com.zrlog.util.BlogBuildInfoUtil;
13 | import com.zrlog.util.ZrLogBaseNativeImageUtils;
14 | import com.zrlog.util.ZrLogUtil;
15 | import com.zrlog.web.util.UpdaterUtils;
16 | import com.zrlog.web.config.ZrLogConfigImpl;
17 |
18 | import java.io.File;
19 | import java.util.Objects;
20 |
21 | import static com.zrlog.common.Constants.getZrLogHome;
22 |
23 | /**
24 | * 实际的启动入口,开发阶段不使用这个类启动,使用对应的 package 模块下的对应的启动方式
25 | * JakartaServletDevApplication, 内嵌 web 容器方式(war)
26 | * SwsDevApplication,标准的 zip 包的启动方式
27 | */
28 | public class Application {
29 |
30 |
31 | static {
32 | if (EnvKit.isLambda()) {
33 | LambdaApplication.initLambdaEnv();
34 | }
35 | }
36 |
37 | private static void initZrLogEnv() {
38 | String home = getZrLogHome();
39 | if (Objects.isNull(home)) {
40 | return;
41 | }
42 | PathUtil.setRootPath(home);
43 | }
44 |
45 | public static void main(String[] args) throws Exception {
46 | Application.initZrLogEnv();
47 | if (EnvKit.isNativeImage()) {
48 | nativeStart(args);
49 | return;
50 | }
51 | start(args);
52 | }
53 |
54 | public static void start(String[] args) {
55 | //parse tips args
56 | if (ParseArgsUtil.justTips(args, "zrlog", BlogBuildInfoUtil.getVersionInfoFull())) {
57 | return;
58 | }
59 | webServerBuilder(ZrLogUtil.getPort(args), ZrLogUtil.getContextPath(args), UpdaterUtils.getUpdater(args, null)).start();
60 | }
61 |
62 | private static void nativeStart(String[] args) throws Exception {
63 | int port = ZrLogUtil.getPort(args);
64 | File execFile = new File(ZrLogBaseNativeImageUtils.getExecFile());
65 | if (EnvKit.isFaaSMode()) {
66 | WebServerBuilder webServerBuilder = webServerBuilder(port, ZrLogUtil.getContextPath(args), UpdaterUtils.getUpdater(args, execFile));
67 | webServerBuilder.startInBackground();
68 | if (EnvKit.isLambda()) {
69 | LambdaApplication.startHandle(Constants.zrLogConfig);
70 | return;
71 | }
72 | throw new NotImplementException();
73 | }
74 | //parse args
75 | if (ParseArgsUtil.justTips(args, execFile.getName(), BlogBuildInfoUtil.getVersionInfoFull())) {
76 | return;
77 | }
78 | WebServerBuilder webServerBuilder = webServerBuilder(port, ZrLogUtil.getContextPath(args), UpdaterUtils.getUpdater(args, execFile));
79 | webServerBuilder.start();
80 | }
81 |
82 | public static WebServerBuilder webServerBuilder(int port, String contextPath, Updater updater) {
83 | Constants.zrLogConfig = new ZrLogConfigImpl(port, updater, contextPath);
84 | WebServerBuilder builder = new WebServerBuilder.Builder().config(Constants.zrLogConfig).build();
85 | Constants.zrLogConfig.getServerConfig().addCreateErrorHandle(() -> {
86 | if (updater instanceof ZipUpdater) {
87 | Thread.sleep(1000);
88 | builder.start();
89 | return null;
90 | }
91 | System.exit(-1);
92 | return null;
93 | });
94 | return builder;
95 | }
96 |
97 |
98 | }
99 |
--------------------------------------------------------------------------------
/zrlog-web/src/main/java/com/zrlog/web/config/SetupConfig.java:
--------------------------------------------------------------------------------
1 | package com.zrlog.web.config;
2 |
3 | import com.hibegin.common.util.LoggerUtil;
4 | import com.zrlog.admin.business.service.AdminResource;
5 | import com.zrlog.admin.web.token.AdminTokenService;
6 | import com.zrlog.common.Updater;
7 | import com.zrlog.common.ZrLogConfig;
8 | import com.zrlog.web.WebSetup;
9 |
10 | import java.io.File;
11 | import java.lang.reflect.InvocationTargetException;
12 | import java.util.AbstractMap;
13 | import java.util.List;
14 | import java.util.Objects;
15 | import java.util.logging.Logger;
16 |
17 | public class SetupConfig {
18 |
19 | protected static final Logger LOGGER = LoggerUtil.getLogger(ZrLogConfig.class);
20 |
21 | private final ZrLogConfig zrLogConfig;
22 | private final File dbPropertiesFile;
23 | private final File installLockFile;
24 | private final boolean includeBlog;
25 | private final Updater updater;
26 |
27 | public boolean isIncludeBlog() {
28 | return includeBlog;
29 | }
30 |
31 | public AdminTokenService buildAdminTokenService(long sessionTimeout) {
32 | return new AdminTokenService(sessionTimeout);
33 | }
34 |
35 | private boolean initBlog(List webSetups, String contextPath) {
36 | try {
37 | WebSetup webSetup = setupBlog(contextPath);
38 | webSetups.add(webSetup);
39 | return true;
40 | } catch (Throwable e) {
41 | LOGGER.warning("Setup blog error: " + e.getMessage());
42 | }
43 | return false;
44 | }
45 |
46 | public SetupConfig(ZrLogConfig zrLogConfig, File dbPropertiesFile,
47 | File installLockFile, String contextPath,
48 | List webSetups,
49 | Updater updater) {
50 | this.zrLogConfig = zrLogConfig;
51 | this.dbPropertiesFile = dbPropertiesFile;
52 | this.installLockFile = installLockFile;
53 | this.updater = updater;
54 | List disableModules = List.of(Objects.requireNonNullElse(System.getenv("DISABLE_MODULES"), "").split(","));
55 | if (!disableModules.contains("admin")) {
56 | try {
57 | AbstractMap.SimpleEntry webSetupObjectSimpleEntry = setupAdmin(contextPath);
58 | if (Objects.nonNull(webSetupObjectSimpleEntry.getKey())) {
59 | webSetups.add(webSetupObjectSimpleEntry.getKey());
60 | }
61 | } catch (Throwable e) {
62 | LOGGER.warning("Setup admin web error: " + e.getMessage());
63 | }
64 | }
65 | if (!disableModules.contains("install")) {
66 | try {
67 | WebSetup webSetup = setupInstall();
68 | webSetups.add(webSetup);
69 | } catch (Throwable e) {
70 | LOGGER.warning("Setup install web error: " + e.getMessage());
71 | }
72 | }
73 | if (!disableModules.contains("blog")) {
74 | this.includeBlog = initBlog(webSetups, contextPath);
75 | } else {
76 | this.includeBlog = false;
77 | }
78 | }
79 |
80 | private AbstractMap.SimpleEntry setupAdmin(String contextPath) throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException {
81 | Class.forName("com.zrlog.admin.web.token.AdminTokenService");
82 | Class> aClass = Class.forName("com.zrlog.admin.web.AdminWebSetup");
83 | AdminResource adminResource = (AdminResource) Class.forName("com.zrlog.admin.business.service.AdminResourceImpl").getConstructor(String.class).newInstance(contextPath);
84 | return new AbstractMap.SimpleEntry<>((WebSetup) aClass.getConstructor(ZrLogConfig.class, Class.forName("com.zrlog.admin.business.service.AdminResource"), String.class).newInstance(zrLogConfig, adminResource, contextPath), adminResource);
85 | }
86 |
87 | private WebSetup setupInstall() throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException {
88 | Class> aClass = Class.forName("com.zrlog.web.setup.install.InstallWebSetup");
89 | return (WebSetup) aClass.getConstructor(ZrLogConfig.class, File.class, File.class, Updater.class).newInstance(zrLogConfig, dbPropertiesFile, installLockFile, updater);
90 | }
91 |
92 | private WebSetup setupBlog(String contextPath) throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException {
93 | Class> aClass = Class.forName("com.zrlog.blog.web.BlogWebSetup");
94 | return (WebSetup) aClass.getConstructor(ZrLogConfig.class, String.class).newInstance(zrLogConfig, contextPath);
95 | }
96 | }
97 |
--------------------------------------------------------------------------------
/package/src/deb/init.d/zrlog:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | ### BEGIN INIT INFO
3 | # Provides: zrlog
4 | # Required-Start: $local_fs $network $named $time $syslog
5 | # Required-Stop: $local_fs $network $named $time $syslog
6 | # Default-Start: 2 3 4 5
7 | # Default-Stop: 0 1 6
8 | # Description: ZrLog is a blog/CMS program developed in Java
9 | ### END INIT INFO
10 | # shellcheck disable=SC2188
11 | if [ "$(whoami &2>/dev/null)" != "root" ] && [ "$(id -un &2>/dev/null)" != "root" ]
12 | then
13 | echo "You must be root to run this script!"
14 | exit 1
15 | fi
16 |
17 | PROCESS_NAME=zrlog
18 | SERVICE_USER=zrlog # 运行服务的用户
19 | PIDFILE=/var/run/${PROCESS_NAME}/${PROCESS_NAME}.pid
20 | PORTFILE=/var/run/${PROCESS_NAME}/http-${PROCESS_NAME}.port
21 | STOP_SCHEDULE="${STOP_SCHEDULE:-QUIT/1/TERM/5/KILL/1}"
22 | ENABLE_DEV_MODE='false'
23 | UPGRADE_VERSION='release'
24 | configFile="/etc/${PROCESS_NAME}/${PROCESS_NAME}.properties"
25 |
26 | prop() {
27 | sed -n -e "s/^$1=\(.*\)/\1/p" "$configFile"
28 | }
29 |
30 | VM_ARG=$(prop "vmArgs")
31 |
32 | dirs="
33 | /etc/${PROCESS_NAME}
34 | /var/cache/${PROCESS_NAME}
35 | /var/run/${PROCESS_NAME}
36 | /var/log/${PROCESS_NAME}
37 | /var/${PROCESS_NAME}
38 | /var/lib/${PROCESS_NAME}
39 | "
40 |
41 | for dir in $dirs; do
42 | mkdir -p "$dir"
43 | chown -hR ${SERVICE_USER}:${SERVICE_USER} "$dir"
44 | done
45 |
46 | backup() {
47 | # Create the /var/backups directory if it doesn't exist.
48 | if [ ! -d /var/backups ]; then
49 | mkdir /var/backups
50 | fi
51 | if [ -d /etc/${PROCESS_NAME} ]; then
52 | tar -czf /var/backups/${PROCESS_NAME}_v1.tar.gz -C /etc ${PROCESS_NAME}
53 | fi
54 | }
55 |
56 |
57 | start() {
58 | # shellcheck disable=SC2046
59 | if [ -f ${PIDFILE} ] && [ -d /proc/$(cat ${PIDFILE})/ ];
60 | then
61 | echo ${PROCESS_NAME}' already running';
62 | exit 0;
63 | fi
64 | echo 'Starting service…'
65 | sudo -u $SERVICE_USER -- env \
66 | PATH="$PATH" \
67 | ZRLOG_PID_FILE=${PIDFILE} \
68 | ZRLOG_HOME="/var/lib/${PROCESS_NAME}" \
69 | ZRLOG_HTTP_PORT_FILE=${PORTFILE} \
70 | ZRLOG_DISABLE_BIND_PORT_ERROR_RETRY_ABLE="true" \
71 | DEV_MODE=${ENABLE_DEV_MODE} \
72 | SYSTEM_SERVICE_MODE="true" \
73 | bash -c "/usr/bin/${PROCESS_NAME} ${VM_ARG} /dev/null 2>&1 & disown"
74 | echo 'Service started'
75 | }
76 |
77 | reload() {
78 | if [ ! -f ${PIDFILE} ]; then
79 | echo ${PROCESS_NAME}' not running'
80 | return 2
81 | fi
82 | # shellcheck disable=SC2046
83 | kill -HUP $(cat ${PIDFILE})
84 | echo ${PROCESS_NAME}' config reloaded';
85 | exit 0;
86 | }
87 |
88 | dump() {
89 | if [ ! -f ${PIDFILE} ]; then
90 | echo ${PROCESS_NAME}' not running'
91 | return 1
92 | fi
93 | # shellcheck disable=SC2046
94 | kill -USR1 $(cat ${PIDFILE})
95 | echo ${PROCESS_NAME}' dump success';
96 | exit 0;
97 | }
98 |
99 | dev() {
100 | if [ ! -f ${PIDFILE} ]; then
101 | echo ${PROCESS_NAME}' not running'
102 | return 2
103 | fi
104 | # shellcheck disable=SC2046
105 | kill -USR2 $(cat ${PIDFILE})
106 | echo ${PROCESS_NAME}' dev enabled';
107 | exit 0;
108 | }
109 |
110 | stop() {
111 | # shellcheck disable=SC2046
112 | if [ ! -f ${PIDFILE} ]; then
113 | echo 'Service not running'
114 | return 1
115 | fi
116 | # shellcheck disable=SC2046
117 | if [ ! -d /proc/$(cat ${PIDFILE})/ ]; then
118 | echo 'Process not running'
119 | return 2
120 | fi
121 | echo 'Stopping service…'
122 | start-stop-daemon --stop --quiet --retry="${STOP_SCHEDULE}" --pidfile ${PIDFILE} --user ${SERVICE_USER}
123 | rm -f ${PIDFILE}
124 | echo 'Service stopped'
125 | }
126 |
127 | upgrade() {
128 | architecture=$(dpkg --print-architecture)
129 | fileName=${PROCESS_NAME}-Linux-${architecture}.deb
130 | fullFileName=/tmp/${fileName}
131 | test -f "${fullFileName}" && rm "${fullFileName}"
132 | sudo -u $SERVICE_USER \
133 | bash -c "wget -q --show-progress https://dl.zrlog.com/${UPGRADE_VERSION}/${fileName} -O ${fullFileName}"
134 | dpkg -i "${fullFileName}"
135 | exit 0
136 | }
137 |
138 | case "$1" in
139 | reload)
140 | reload
141 | ;;
142 | dump)
143 | dump
144 | ;;
145 | dev)
146 | dev
147 | ;;
148 | start)
149 | start
150 | ;;
151 | start-dev)
152 | ENABLE_DEV_MODE='true'
153 | start
154 | ;;
155 | stop)
156 | stop
157 | ;;
158 | restart)
159 | stop
160 | start
161 | ;;
162 | force-start)
163 | stop
164 | start
165 | ;;
166 | upgrade)
167 | backup
168 | upgrade
169 | ;;
170 | upgrade-preview)
171 | backup
172 | UPGRADE_VERSION="preview"
173 | upgrade
174 | ;;
175 | *)
176 | echo "Usage: $0 {start|force-start|start-dev|stop|reload|restart|upgrade|upgrade-preview|dump|dev}"
177 | esac
178 |
--------------------------------------------------------------------------------
/zrlog-web/src/main/java/com/zrlog/web/setup/install/ZrLogInstallConfig.java:
--------------------------------------------------------------------------------
1 | package com.zrlog.web.setup.install;
2 |
3 | import com.hibegin.common.util.EnvKit;
4 | import com.hibegin.common.util.SecurityUtils;
5 | import com.hibegin.common.util.StringUtils;
6 | import com.zrlog.admin.web.plugin.UpdateVersionTimerTask;
7 | import com.zrlog.business.service.DbUpgradeService;
8 | import com.zrlog.common.Constants;
9 | import com.zrlog.common.Updater;
10 | import com.zrlog.common.UpdaterTypeEnum;
11 | import com.zrlog.common.ZrLogConfig;
12 | import com.zrlog.common.vo.Version;
13 | import com.zrlog.install.business.response.LastVersionInfo;
14 | import com.zrlog.install.web.InstallAction;
15 | import com.zrlog.install.web.config.DefaultInstallConfig;
16 | import com.zrlog.util.BlogBuildInfoUtil;
17 | import com.zrlog.util.I18nUtil;
18 | import com.zrlog.util.ZrLogUtil;
19 |
20 | import java.io.File;
21 | import java.util.Map;
22 | import java.util.Objects;
23 |
24 | public class ZrLogInstallConfig extends DefaultInstallConfig {
25 |
26 | private final ZrLogConfig zrLogConfig;
27 | private final File dbPropertiesFile;
28 | private final LastVersionInfo lastVersionInfo;
29 | private final Updater updater;
30 | private final InstallAction installAction;
31 |
32 | public ZrLogInstallConfig(ZrLogConfig zrLogConfig, File dbPropertiesFile, File lockFile, Updater updater) {
33 | this.zrLogConfig = zrLogConfig;
34 | this.dbPropertiesFile = dbPropertiesFile;
35 | this.updater = updater;
36 | this.lastVersionInfo = prefetchVersion(updater);
37 | this.installAction = new ZrLogInstallAction(zrLogConfig, lockFile);
38 | }
39 |
40 | private LastVersionInfo prefetchVersion(Updater updater) {
41 | if (zrLogConfig.isInstalled()) {
42 | return null;
43 | }
44 | UpdateVersionTimerTask versionTimerTask = new UpdateVersionTimerTask(!BlogBuildInfoUtil.isRelease(), Constants.DEFAULT_LANGUAGE);
45 | versionTimerTask.run();
46 | Version lastVersion = versionTimerTask.getVersion();
47 | return getLastVersionInfo(updater, lastVersion);
48 | }
49 |
50 | private static LastVersionInfo getLastVersionInfo(Updater updater, Version lastVersion) {
51 | LastVersionInfo lastVersionInfo = new LastVersionInfo();
52 | if (Objects.isNull(lastVersion)) {
53 | lastVersionInfo.setLatestVersion(true);
54 | return lastVersionInfo;
55 | }
56 | boolean upgradable = ZrLogUtil.greatThenCurrentVersion(lastVersion.getBuildId(), lastVersion.getBuildDate(), lastVersion.getVersion());
57 | lastVersionInfo.setLatestVersion(!upgradable);
58 | if (lastVersionInfo.getLatestVersion()) {
59 | return lastVersionInfo;
60 | }
61 | lastVersionInfo.setNewVersion(lastVersion.getVersion());
62 | if (Objects.nonNull(updater) && updater.getType() == UpdaterTypeEnum.WAR) {
63 | lastVersionInfo.setDownloadUrl(lastVersion.getWarDownloadUrl());
64 | } else {
65 | lastVersionInfo.setDownloadUrl(lastVersion.getZipDownloadUrl());
66 | }
67 | lastVersionInfo.setChangeLog(lastVersion.getChangeLog());
68 | return lastVersionInfo;
69 | }
70 |
71 | @Override
72 | public InstallAction getAction() {
73 | return installAction;
74 | }
75 |
76 | @Override
77 | public boolean isWarMode() {
78 | return Objects.nonNull(updater) && updater.getType() == UpdaterTypeEnum.WAR;
79 | }
80 |
81 | @Override
82 | public String getAcceptLanguage() {
83 | return I18nUtil.getCurrentLocale();
84 | }
85 |
86 | @Override
87 | public String encryptPassword(String password) {
88 | return SecurityUtils.md5(password);
89 | }
90 |
91 | @Override
92 | public String defaultTemplatePath() {
93 | return Constants.DEFAULT_TEMPLATE_PATH;
94 | }
95 |
96 | @Override
97 | public String getZrLogSqlVersion() {
98 | return DbUpgradeService.SQL_VERSION + "";
99 | }
100 |
101 | @Override
102 | public File getDbPropertiesFile() {
103 | return dbPropertiesFile;
104 | }
105 |
106 | @Override
107 | public String getBuildVersion() {
108 | return BlogBuildInfoUtil.getVersion();
109 | }
110 |
111 | @Override
112 | public LastVersionInfo getLastVersionInfo() {
113 | return lastVersionInfo;
114 | }
115 |
116 | @Override
117 | public String getJdbcUrlQueryStr(String dbType, Map paramMap) {
118 | if (Objects.equals(dbType, "mysql")) {
119 | return Constants.MYSQL_JDBC_PARAMS;
120 | }
121 | return "";
122 | }
123 |
124 | @Override
125 | public boolean isContainerMode() {
126 | //return true;
127 | return ZrLogUtil.isDockerMode() || EnvKit.isFaaSMode();
128 | }
129 |
130 | @Override
131 | public boolean isMissingConfig() {
132 | if (!isContainerMode()) {
133 | return false;
134 | }
135 | return StringUtils.isEmpty(ZrLogUtil.getDbInfoByEnv());
136 | }
137 | }
138 |
--------------------------------------------------------------------------------
/mvnw.cmd:
--------------------------------------------------------------------------------
1 | <# : batch portion
2 | @REM ----------------------------------------------------------------------------
3 | @REM Licensed to the Apache Software Foundation (ASF) under one
4 | @REM or more contributor license agreements. See the NOTICE file
5 | @REM distributed with this work for additional information
6 | @REM regarding copyright ownership. The ASF licenses this file
7 | @REM to you under the Apache License, Version 2.0 (the
8 | @REM "License"); you may not use this file except in compliance
9 | @REM with the License. You may obtain a copy of the License at
10 | @REM
11 | @REM http://www.apache.org/licenses/LICENSE-2.0
12 | @REM
13 | @REM Unless required by applicable law or agreed to in writing,
14 | @REM software distributed under the License is distributed on an
15 | @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 | @REM KIND, either express or implied. See the License for the
17 | @REM specific language governing permissions and limitations
18 | @REM under the License.
19 | @REM ----------------------------------------------------------------------------
20 |
21 | @REM ----------------------------------------------------------------------------
22 | @REM Apache Maven Wrapper startup batch script, version 3.3.2
23 | @REM
24 | @REM Optional ENV vars
25 | @REM MVNW_REPOURL - repo url base for downloading maven distribution
26 | @REM MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven
27 | @REM MVNW_VERBOSE - true: enable verbose log; others: silence the output
28 | @REM ----------------------------------------------------------------------------
29 |
30 | @IF "%__MVNW_ARG0_NAME__%"=="" (SET __MVNW_ARG0_NAME__=%~nx0)
31 | @SET __MVNW_CMD__=
32 | @SET __MVNW_ERROR__=
33 | @SET __MVNW_PSMODULEP_SAVE=%PSModulePath%
34 | @SET PSModulePath=
35 | @FOR /F "usebackq tokens=1* delims==" %%A IN (`powershell -noprofile "& {$scriptDir='%~dp0'; $script='%__MVNW_ARG0_NAME__%'; icm -ScriptBlock ([Scriptblock]::Create((Get-Content -Raw '%~f0'))) -NoNewScope}"`) DO @(
36 | IF "%%A"=="MVN_CMD" (set __MVNW_CMD__=%%B) ELSE IF "%%B"=="" (echo %%A) ELSE (echo %%A=%%B)
37 | )
38 | @SET PSModulePath=%__MVNW_PSMODULEP_SAVE%
39 | @SET __MVNW_PSMODULEP_SAVE=
40 | @SET __MVNW_ARG0_NAME__=
41 | @SET MVNW_USERNAME=
42 | @SET MVNW_PASSWORD=
43 | @IF NOT "%__MVNW_CMD__%"=="" (%__MVNW_CMD__% %*)
44 | @echo Cannot start maven from wrapper >&2 && exit /b 1
45 | @GOTO :EOF
46 | : end batch / begin powershell #>
47 |
48 | $ErrorActionPreference = "Stop"
49 | if ($env:MVNW_VERBOSE -eq "true") {
50 | $VerbosePreference = "Continue"
51 | }
52 |
53 | # calculate distributionUrl, requires .mvn/wrapper/maven-wrapper.properties
54 | $distributionUrl = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionUrl
55 | if (!$distributionUrl) {
56 | Write-Error "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties"
57 | }
58 |
59 | switch -wildcard -casesensitive ( $($distributionUrl -replace '^.*/','') ) {
60 | "maven-mvnd-*" {
61 | $USE_MVND = $true
62 | $distributionUrl = $distributionUrl -replace '-bin\.[^.]*$',"-windows-amd64.zip"
63 | $MVN_CMD = "mvnd.cmd"
64 | break
65 | }
66 | default {
67 | $USE_MVND = $false
68 | $MVN_CMD = $script -replace '^mvnw','mvn'
69 | break
70 | }
71 | }
72 |
73 | # apply MVNW_REPOURL and calculate MAVEN_HOME
74 | # maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/
75 | if ($env:MVNW_REPOURL) {
76 | $MVNW_REPO_PATTERN = if ($USE_MVND) { "/org/apache/maven/" } else { "/maven/mvnd/" }
77 | $distributionUrl = "$env:MVNW_REPOURL$MVNW_REPO_PATTERN$($distributionUrl -replace '^.*'+$MVNW_REPO_PATTERN,'')"
78 | }
79 | $distributionUrlName = $distributionUrl -replace '^.*/',''
80 | $distributionUrlNameMain = $distributionUrlName -replace '\.[^.]*$','' -replace '-bin$',''
81 | $MAVEN_HOME_PARENT = "$HOME/.m2/wrapper/dists/$distributionUrlNameMain"
82 | if ($env:MAVEN_USER_HOME) {
83 | $MAVEN_HOME_PARENT = "$env:MAVEN_USER_HOME/wrapper/dists/$distributionUrlNameMain"
84 | }
85 | $MAVEN_HOME_NAME = ([System.Security.Cryptography.MD5]::Create().ComputeHash([byte[]][char[]]$distributionUrl) | ForEach-Object {$_.ToString("x2")}) -join ''
86 | $MAVEN_HOME = "$MAVEN_HOME_PARENT/$MAVEN_HOME_NAME"
87 |
88 | if (Test-Path -Path "$MAVEN_HOME" -PathType Container) {
89 | Write-Verbose "found existing MAVEN_HOME at $MAVEN_HOME"
90 | Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD"
91 | exit $?
92 | }
93 |
94 | if (! $distributionUrlNameMain -or ($distributionUrlName -eq $distributionUrlNameMain)) {
95 | Write-Error "distributionUrl is not valid, must end with *-bin.zip, but found $distributionUrl"
96 | }
97 |
98 | # prepare tmp dir
99 | $TMP_DOWNLOAD_DIR_HOLDER = New-TemporaryFile
100 | $TMP_DOWNLOAD_DIR = New-Item -Itemtype Directory -Path "$TMP_DOWNLOAD_DIR_HOLDER.dir"
101 | $TMP_DOWNLOAD_DIR_HOLDER.Delete() | Out-Null
102 | trap {
103 | if ($TMP_DOWNLOAD_DIR.Exists) {
104 | try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null }
105 | catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" }
106 | }
107 | }
108 |
109 | New-Item -Itemtype Directory -Path "$MAVEN_HOME_PARENT" -Force | Out-Null
110 |
111 | # Download and Install Apache Maven
112 | Write-Verbose "Couldn't find MAVEN_HOME, downloading and installing it ..."
113 | Write-Verbose "Downloading from: $distributionUrl"
114 | Write-Verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName"
115 |
116 | $webclient = New-Object System.Net.WebClient
117 | if ($env:MVNW_USERNAME -and $env:MVNW_PASSWORD) {
118 | $webclient.Credentials = New-Object System.Net.NetworkCredential($env:MVNW_USERNAME, $env:MVNW_PASSWORD)
119 | }
120 | [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
121 | $webclient.DownloadFile($distributionUrl, "$TMP_DOWNLOAD_DIR/$distributionUrlName") | Out-Null
122 |
123 | # If specified, validate the SHA-256 sum of the Maven distribution zip file
124 | $distributionSha256Sum = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionSha256Sum
125 | if ($distributionSha256Sum) {
126 | if ($USE_MVND) {
127 | Write-Error "Checksum validation is not supported for maven-mvnd. `nPlease disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties."
128 | }
129 | Import-Module $PSHOME\Modules\Microsoft.PowerShell.Utility -Function Get-FileHash
130 | if ((Get-FileHash "$TMP_DOWNLOAD_DIR/$distributionUrlName" -Algorithm SHA256).Hash.ToLower() -ne $distributionSha256Sum) {
131 | Write-Error "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised. If you updated your Maven version, you need to update the specified distributionSha256Sum property."
132 | }
133 | }
134 |
135 | # unzip and move
136 | Expand-Archive "$TMP_DOWNLOAD_DIR/$distributionUrlName" -DestinationPath "$TMP_DOWNLOAD_DIR" | Out-Null
137 | Rename-Item -Path "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" -NewName $MAVEN_HOME_NAME | Out-Null
138 | try {
139 | Move-Item -Path "$TMP_DOWNLOAD_DIR/$MAVEN_HOME_NAME" -Destination $MAVEN_HOME_PARENT | Out-Null
140 | } catch {
141 | if (! (Test-Path -Path "$MAVEN_HOME" -PathType Container)) {
142 | Write-Error "fail to move MAVEN_HOME"
143 | }
144 | } finally {
145 | try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null }
146 | catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" }
147 | }
148 |
149 | Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD"
150 |
--------------------------------------------------------------------------------
/pom.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 | com.hibegin
5 | zrlog-base
6 | 3.2.125
7 |
8 | 4.0.0
9 | zrlog-web-parent
10 | pom
11 | 3.2.3-SNAPSHOT
12 |
13 | zrlog-web
14 | package
15 |
16 | zrlog
17 | ZrLog是使用Java开发的博客/CMS程序,具有简约,易用,组件化,内存占用低等特点。自带Markdown编辑器,让更多的精力放在写作上,而不是花费大量时间在学习程序的使用上。
18 |
19 | https://www.zrlog.com
20 |
21 |
22 | 11
23 | ${java.version}
24 | ${java.version}
25 | UTF-8
26 | true
27 | zrlog
28 | compile
29 | compile
30 | compile
31 | 6.1.0
32 | 3.2.30
33 | 3.2.122
34 | 3.2.128-SNAPSHOT
35 | compile
36 |
37 |
38 |
39 |
40 | central-snapshots
41 | https://central.sonatype.com/repository/maven-snapshots/
42 |
43 | true
44 |
45 |
46 |
47 | central-center
48 | https://repo1.maven.org/maven2/
49 |
50 | true
51 |
52 |
53 |
54 |
55 |
56 |
57 | xiaochun
58 | support@zrlog.com
59 | https://xiaochun.zrlog.com
60 |
61 | owner
62 |
63 |
64 |
65 | weekdragon
66 | 790774717@qq.com
67 | https://www.weekdragon.cn
68 |
69 | developer
70 |
71 |
72 |
73 | e-lionel
74 | lionel0724@163.com
75 | https://github.com/e-lionel
76 |
77 | reporter
78 |
79 |
80 |
81 |
82 |
83 | Github Issue
84 | https://github.com/94fzb/zrlog
85 |
86 |
87 |
88 |
89 | The Apache Software License, Version 2.0
90 | https://apache.org/licenses/LICENSE-2.0.txt
91 |
92 |
93 |
94 |
95 |
96 | com.mysql
97 | mysql-connector-j
98 |
99 |
100 |
101 |
102 |
103 |
104 | com.hibegin
105 | zrlog-admin-web
106 | ${zrlog-admin-web.version}
107 |
108 |
109 | com.hibegin
110 | simplewebserver-servlet-api-impl
111 | ${sws.version}
112 | ${servlet-scope}
113 |
114 |
115 | com.hibegin
116 | simplewebserver-lambda-function-impl
117 | ${sws.version}
118 | ${lambda-scope}
119 |
120 |
121 | com.hibegin
122 | zrlog-install-web
123 | ${zrlog-install-web.version}
124 |
125 |
126 | com.hibegin
127 | zrlog-blog-web
128 | ${zrlog-blog-web.version}
129 |
130 |
131 | com.hibegin
132 | zrlog-web
133 | 3.2.3-SNAPSHOT
134 |
135 |
136 | com.mysql
137 | mysql-connector-j
138 | 9.3.0
139 | ${mysql-scope}
140 |
141 |
142 | jakarta.servlet
143 | jakarta.servlet-api
144 | ${servlet-api.version}
145 | provided
146 |
147 |
148 |
149 |
150 |
151 | src/main/java
152 | src/test/java
153 |
154 |
155 | org.apache.maven.plugins
156 | maven-compiler-plugin
157 | 3.11.0
158 |
159 | ${java.version}
160 | ${java.version}
161 | ${java.version}
162 |
163 |
164 |
165 | org.codehaus.mojo
166 | versions-maven-plugin
167 | 2.7
168 |
169 |
170 | org.apache.maven.plugins
171 | maven-jar-plugin
172 | 3.2.0
173 |
174 |
175 |
176 |
177 |
178 | org.apache.maven.plugins
179 | maven-dependency-plugin
180 | 3.6.1
181 |
182 |
183 | org.apache.maven.plugins
184 | maven-war-plugin
185 | 3.4.0
186 |
187 |
188 |
189 |
190 |
191 |
--------------------------------------------------------------------------------
/mvnw:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # ----------------------------------------------------------------------------
3 | # Licensed to the Apache Software Foundation (ASF) under one
4 | # or more contributor license agreements. See the NOTICE file
5 | # distributed with this work for additional information
6 | # regarding copyright ownership. The ASF licenses this file
7 | # to you under the Apache License, Version 2.0 (the
8 | # "License"); you may not use this file except in compliance
9 | # with the License. You may obtain a copy of the License at
10 | #
11 | # http://www.apache.org/licenses/LICENSE-2.0
12 | #
13 | # Unless required by applicable law or agreed to in writing,
14 | # software distributed under the License is distributed on an
15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 | # KIND, either express or implied. See the License for the
17 | # specific language governing permissions and limitations
18 | # under the License.
19 | # ----------------------------------------------------------------------------
20 |
21 | # ----------------------------------------------------------------------------
22 | # Apache Maven Wrapper startup batch script, version 3.3.2
23 | #
24 | # Optional ENV vars
25 | # -----------------
26 | # JAVA_HOME - location of a JDK home dir, required when download maven via java source
27 | # MVNW_REPOURL - repo url base for downloading maven distribution
28 | # MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven
29 | # MVNW_VERBOSE - true: enable verbose log; debug: trace the mvnw script; others: silence the output
30 | # ----------------------------------------------------------------------------
31 |
32 | set -euf
33 | [ "${MVNW_VERBOSE-}" != debug ] || set -x
34 |
35 | # OS specific support.
36 | native_path() { printf %s\\n "$1"; }
37 | case "$(uname)" in
38 | CYGWIN* | MINGW*)
39 | [ -z "${JAVA_HOME-}" ] || JAVA_HOME="$(cygpath --unix "$JAVA_HOME")"
40 | native_path() { cygpath --path --windows "$1"; }
41 | ;;
42 | esac
43 |
44 | # set JAVACMD and JAVACCMD
45 | set_java_home() {
46 | # For Cygwin and MinGW, ensure paths are in Unix format before anything is touched
47 | if [ -n "${JAVA_HOME-}" ]; then
48 | if [ -x "$JAVA_HOME/jre/sh/java" ]; then
49 | # IBM's JDK on AIX uses strange locations for the executables
50 | JAVACMD="$JAVA_HOME/jre/sh/java"
51 | JAVACCMD="$JAVA_HOME/jre/sh/javac"
52 | else
53 | JAVACMD="$JAVA_HOME/bin/java"
54 | JAVACCMD="$JAVA_HOME/bin/javac"
55 |
56 | if [ ! -x "$JAVACMD" ] || [ ! -x "$JAVACCMD" ]; then
57 | echo "The JAVA_HOME environment variable is not defined correctly, so mvnw cannot run." >&2
58 | echo "JAVA_HOME is set to \"$JAVA_HOME\", but \"\$JAVA_HOME/bin/java\" or \"\$JAVA_HOME/bin/javac\" does not exist." >&2
59 | return 1
60 | fi
61 | fi
62 | else
63 | JAVACMD="$(
64 | 'set' +e
65 | 'unset' -f command 2>/dev/null
66 | 'command' -v java
67 | )" || :
68 | JAVACCMD="$(
69 | 'set' +e
70 | 'unset' -f command 2>/dev/null
71 | 'command' -v javac
72 | )" || :
73 |
74 | if [ ! -x "${JAVACMD-}" ] || [ ! -x "${JAVACCMD-}" ]; then
75 | echo "The java/javac command does not exist in PATH nor is JAVA_HOME set, so mvnw cannot run." >&2
76 | return 1
77 | fi
78 | fi
79 | }
80 |
81 | # hash string like Java String::hashCode
82 | hash_string() {
83 | str="${1:-}" h=0
84 | while [ -n "$str" ]; do
85 | char="${str%"${str#?}"}"
86 | h=$(((h * 31 + $(LC_CTYPE=C printf %d "'$char")) % 4294967296))
87 | str="${str#?}"
88 | done
89 | printf %x\\n $h
90 | }
91 |
92 | verbose() { :; }
93 | [ "${MVNW_VERBOSE-}" != true ] || verbose() { printf %s\\n "${1-}"; }
94 |
95 | die() {
96 | printf %s\\n "$1" >&2
97 | exit 1
98 | }
99 |
100 | trim() {
101 | # MWRAPPER-139:
102 | # Trims trailing and leading whitespace, carriage returns, tabs, and linefeeds.
103 | # Needed for removing poorly interpreted newline sequences when running in more
104 | # exotic environments such as mingw bash on Windows.
105 | printf "%s" "${1}" | tr -d '[:space:]'
106 | }
107 |
108 | # parse distributionUrl and optional distributionSha256Sum, requires .mvn/wrapper/maven-wrapper.properties
109 | while IFS="=" read -r key value; do
110 | case "${key-}" in
111 | distributionUrl) distributionUrl=$(trim "${value-}") ;;
112 | distributionSha256Sum) distributionSha256Sum=$(trim "${value-}") ;;
113 | esac
114 | done <"${0%/*}/.mvn/wrapper/maven-wrapper.properties"
115 | [ -n "${distributionUrl-}" ] || die "cannot read distributionUrl property in ${0%/*}/.mvn/wrapper/maven-wrapper.properties"
116 |
117 | case "${distributionUrl##*/}" in
118 | maven-mvnd-*bin.*)
119 | MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/
120 | case "${PROCESSOR_ARCHITECTURE-}${PROCESSOR_ARCHITEW6432-}:$(uname -a)" in
121 | *AMD64:CYGWIN* | *AMD64:MINGW*) distributionPlatform=windows-amd64 ;;
122 | :Darwin*x86_64) distributionPlatform=darwin-amd64 ;;
123 | :Darwin*arm64) distributionPlatform=darwin-aarch64 ;;
124 | :Linux*x86_64*) distributionPlatform=linux-amd64 ;;
125 | *)
126 | echo "Cannot detect native platform for mvnd on $(uname)-$(uname -m), use pure java version" >&2
127 | distributionPlatform=linux-amd64
128 | ;;
129 | esac
130 | distributionUrl="${distributionUrl%-bin.*}-$distributionPlatform.zip"
131 | ;;
132 | maven-mvnd-*) MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ ;;
133 | *) MVN_CMD="mvn${0##*/mvnw}" _MVNW_REPO_PATTERN=/org/apache/maven/ ;;
134 | esac
135 |
136 | # apply MVNW_REPOURL and calculate MAVEN_HOME
137 | # maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/
138 | [ -z "${MVNW_REPOURL-}" ] || distributionUrl="$MVNW_REPOURL$_MVNW_REPO_PATTERN${distributionUrl#*"$_MVNW_REPO_PATTERN"}"
139 | distributionUrlName="${distributionUrl##*/}"
140 | distributionUrlNameMain="${distributionUrlName%.*}"
141 | distributionUrlNameMain="${distributionUrlNameMain%-bin}"
142 | MAVEN_USER_HOME="${MAVEN_USER_HOME:-${HOME}/.m2}"
143 | MAVEN_HOME="${MAVEN_USER_HOME}/wrapper/dists/${distributionUrlNameMain-}/$(hash_string "$distributionUrl")"
144 |
145 | exec_maven() {
146 | unset MVNW_VERBOSE MVNW_USERNAME MVNW_PASSWORD MVNW_REPOURL || :
147 | exec "$MAVEN_HOME/bin/$MVN_CMD" "$@" || die "cannot exec $MAVEN_HOME/bin/$MVN_CMD"
148 | }
149 |
150 | if [ -d "$MAVEN_HOME" ]; then
151 | verbose "found existing MAVEN_HOME at $MAVEN_HOME"
152 | exec_maven "$@"
153 | fi
154 |
155 | case "${distributionUrl-}" in
156 | *?-bin.zip | *?maven-mvnd-?*-?*.zip) ;;
157 | *) die "distributionUrl is not valid, must match *-bin.zip or maven-mvnd-*.zip, but found '${distributionUrl-}'" ;;
158 | esac
159 |
160 | # prepare tmp dir
161 | if TMP_DOWNLOAD_DIR="$(mktemp -d)" && [ -d "$TMP_DOWNLOAD_DIR" ]; then
162 | clean() { rm -rf -- "$TMP_DOWNLOAD_DIR"; }
163 | trap clean HUP INT TERM EXIT
164 | else
165 | die "cannot create temp dir"
166 | fi
167 |
168 | mkdir -p -- "${MAVEN_HOME%/*}"
169 |
170 | # Download and Install Apache Maven
171 | verbose "Couldn't find MAVEN_HOME, downloading and installing it ..."
172 | verbose "Downloading from: $distributionUrl"
173 | verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName"
174 |
175 | # select .zip or .tar.gz
176 | if ! command -v unzip >/dev/null; then
177 | distributionUrl="${distributionUrl%.zip}.tar.gz"
178 | distributionUrlName="${distributionUrl##*/}"
179 | fi
180 |
181 | # verbose opt
182 | __MVNW_QUIET_WGET=--quiet __MVNW_QUIET_CURL=--silent __MVNW_QUIET_UNZIP=-q __MVNW_QUIET_TAR=''
183 | [ "${MVNW_VERBOSE-}" != true ] || __MVNW_QUIET_WGET='' __MVNW_QUIET_CURL='' __MVNW_QUIET_UNZIP='' __MVNW_QUIET_TAR=v
184 |
185 | # normalize http auth
186 | case "${MVNW_PASSWORD:+has-password}" in
187 | '') MVNW_USERNAME='' MVNW_PASSWORD='' ;;
188 | has-password) [ -n "${MVNW_USERNAME-}" ] || MVNW_USERNAME='' MVNW_PASSWORD='' ;;
189 | esac
190 |
191 | if [ -z "${MVNW_USERNAME-}" ] && command -v wget >/dev/null; then
192 | verbose "Found wget ... using wget"
193 | wget ${__MVNW_QUIET_WGET:+"$__MVNW_QUIET_WGET"} "$distributionUrl" -O "$TMP_DOWNLOAD_DIR/$distributionUrlName" || die "wget: Failed to fetch $distributionUrl"
194 | elif [ -z "${MVNW_USERNAME-}" ] && command -v curl >/dev/null; then
195 | verbose "Found curl ... using curl"
196 | curl ${__MVNW_QUIET_CURL:+"$__MVNW_QUIET_CURL"} -f -L -o "$TMP_DOWNLOAD_DIR/$distributionUrlName" "$distributionUrl" || die "curl: Failed to fetch $distributionUrl"
197 | elif set_java_home; then
198 | verbose "Falling back to use Java to download"
199 | javaSource="$TMP_DOWNLOAD_DIR/Downloader.java"
200 | targetZip="$TMP_DOWNLOAD_DIR/$distributionUrlName"
201 | cat >"$javaSource" <<-END
202 | public class Downloader extends java.net.Authenticator
203 | {
204 | protected java.net.PasswordAuthentication getPasswordAuthentication()
205 | {
206 | return new java.net.PasswordAuthentication( System.getenv( "MVNW_USERNAME" ), System.getenv( "MVNW_PASSWORD" ).toCharArray() );
207 | }
208 | public static void main( String[] args ) throws Exception
209 | {
210 | setDefault( new Downloader() );
211 | java.nio.file.Files.copy( java.net.URI.create( args[0] ).toURL().openStream(), java.nio.file.Paths.get( args[1] ).toAbsolutePath().normalize() );
212 | }
213 | }
214 | END
215 | # For Cygwin/MinGW, switch paths to Windows format before running javac and java
216 | verbose " - Compiling Downloader.java ..."
217 | "$(native_path "$JAVACCMD")" "$(native_path "$javaSource")" || die "Failed to compile Downloader.java"
218 | verbose " - Running Downloader.java ..."
219 | "$(native_path "$JAVACMD")" -cp "$(native_path "$TMP_DOWNLOAD_DIR")" Downloader "$distributionUrl" "$(native_path "$targetZip")"
220 | fi
221 |
222 | # If specified, validate the SHA-256 sum of the Maven distribution zip file
223 | if [ -n "${distributionSha256Sum-}" ]; then
224 | distributionSha256Result=false
225 | if [ "$MVN_CMD" = mvnd.sh ]; then
226 | echo "Checksum validation is not supported for maven-mvnd." >&2
227 | echo "Please disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2
228 | exit 1
229 | elif command -v sha256sum >/dev/null; then
230 | if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | sha256sum -c >/dev/null 2>&1; then
231 | distributionSha256Result=true
232 | fi
233 | elif command -v shasum >/dev/null; then
234 | if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | shasum -a 256 -c >/dev/null 2>&1; then
235 | distributionSha256Result=true
236 | fi
237 | else
238 | echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." >&2
239 | echo "Please install either command, or disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2
240 | exit 1
241 | fi
242 | if [ $distributionSha256Result = false ]; then
243 | echo "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised." >&2
244 | echo "If you updated your Maven version, you need to update the specified distributionSha256Sum property." >&2
245 | exit 1
246 | fi
247 | fi
248 |
249 | # unzip and move
250 | if command -v unzip >/dev/null; then
251 | unzip ${__MVNW_QUIET_UNZIP:+"$__MVNW_QUIET_UNZIP"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -d "$TMP_DOWNLOAD_DIR" || die "failed to unzip"
252 | else
253 | tar xzf${__MVNW_QUIET_TAR:+"$__MVNW_QUIET_TAR"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -C "$TMP_DOWNLOAD_DIR" || die "failed to untar"
254 | fi
255 | printf %s\\n "$distributionUrl" >"$TMP_DOWNLOAD_DIR/$distributionUrlNameMain/mvnw.url"
256 | mv -- "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" "$MAVEN_HOME" || [ -d "$MAVEN_HOME" ] || die "fail to move MAVEN_HOME"
257 |
258 | clean || :
259 | exec_maven "$@"
260 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 |
2 | Apache License
3 | Version 2.0, January 2004
4 | http://www.apache.org/licenses/
5 |
6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7 |
8 | 1. Definitions.
9 |
10 | "License" shall mean the terms and conditions for use, reproduction,
11 | and distribution as defined by Sections 1 through 9 of this document.
12 |
13 | "Licensor" shall mean the copyright owner or entity authorized by
14 | the copyright owner that is granting the License.
15 |
16 | "Legal Entity" shall mean the union of the acting entity and all
17 | other entities that control, are controlled by, or are under common
18 | control with that entity. For the purposes of this definition,
19 | "control" means (i) the power, direct or indirect, to cause the
20 | direction or management of such entity, whether by contract or
21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
22 | outstanding shares, or (iii) beneficial ownership of such entity.
23 |
24 | "You" (or "Your") shall mean an individual or Legal Entity
25 | exercising permissions granted by this License.
26 |
27 | "Source" form shall mean the preferred form for making modifications,
28 | including but not limited to software source code, documentation
29 | source, and configuration files.
30 |
31 | "Object" form shall mean any form resulting from mechanical
32 | transformation or translation of a Source form, including but
33 | not limited to compiled object code, generated documentation,
34 | and conversions to other media types.
35 |
36 | "Work" shall mean the work of authorship, whether in Source or
37 | Object form, made available under the License, as indicated by a
38 | copyright notice that is included in or attached to the work
39 | (an example is provided in the Appendix below).
40 |
41 | "Derivative Works" shall mean any work, whether in Source or Object
42 | form, that is based on (or derived from) the Work and for which the
43 | editorial revisions, annotations, elaborations, or other modifications
44 | represent, as a whole, an original work of authorship. For the purposes
45 | of this License, Derivative Works shall not include works that remain
46 | separable from, or merely link (or bind by name) to the interfaces of,
47 | the Work and Derivative Works thereof.
48 |
49 | "Contribution" shall mean any work of authorship, including
50 | the original version of the Work and any modifications or additions
51 | to that Work or Derivative Works thereof, that is intentionally
52 | submitted to Licensor for inclusion in the Work by the copyright owner
53 | or by an individual or Legal Entity authorized to submit on behalf of
54 | the copyright owner. For the purposes of this definition, "submitted"
55 | means any form of electronic, verbal, or written communication sent
56 | to the Licensor or its representatives, including but not limited to
57 | communication on electronic mailing lists, source code control systems,
58 | and issue tracking systems that are managed by, or on behalf of, the
59 | Licensor for the purpose of discussing and improving the Work, but
60 | excluding communication that is conspicuously marked or otherwise
61 | designated in writing by the copyright owner as "Not a Contribution."
62 |
63 | "Contributor" shall mean Licensor and any individual or Legal Entity
64 | on behalf of whom a Contribution has been received by Licensor and
65 | subsequently incorporated within the Work.
66 |
67 | 2. Grant of Copyright License. Subject to the terms and conditions of
68 | this License, each Contributor hereby grants to You a perpetual,
69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70 | copyright license to reproduce, prepare Derivative Works of,
71 | publicly display, publicly perform, sublicense, and distribute the
72 | Work and such Derivative Works in Source or Object form.
73 |
74 | 3. Grant of Patent License. Subject to the terms and conditions of
75 | this License, each Contributor hereby grants to You a perpetual,
76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77 | (except as stated in this section) patent license to make, have made,
78 | use, offer to sell, sell, import, and otherwise transfer the Work,
79 | where such license applies only to those patent claims licensable
80 | by such Contributor that are necessarily infringed by their
81 | Contribution(s) alone or by combination of their Contribution(s)
82 | with the Work to which such Contribution(s) was submitted. If You
83 | institute patent litigation against any entity (including a
84 | cross-claim or counterclaim in a lawsuit) alleging that the Work
85 | or a Contribution incorporated within the Work constitutes direct
86 | or contributory patent infringement, then any patent licenses
87 | granted to You under this License for that Work shall terminate
88 | as of the date such litigation is filed.
89 |
90 | 4. Redistribution. You may reproduce and distribute copies of the
91 | Work or Derivative Works thereof in any medium, with or without
92 | modifications, and in Source or Object form, provided that You
93 | meet the following conditions:
94 |
95 | (a) You must give any other recipients of the Work or
96 | Derivative Works a copy of this License; and
97 |
98 | (b) You must cause any modified files to carry prominent notices
99 | stating that You changed the files; and
100 |
101 | (c) You must retain, in the Source form of any Derivative Works
102 | that You distribute, all copyright, patent, trademark, and
103 | attribution notices from the Source form of the Work,
104 | excluding those notices that do not pertain to any part of
105 | the Derivative Works; and
106 |
107 | (d) If the Work includes a "NOTICE" text file as part of its
108 | distribution, then any Derivative Works that You distribute must
109 | include a readable copy of the attribution notices contained
110 | within such NOTICE file, excluding those notices that do not
111 | pertain to any part of the Derivative Works, in at least one
112 | of the following places: within a NOTICE text file distributed
113 | as part of the Derivative Works; within the Source form or
114 | documentation, if provided along with the Derivative Works; or,
115 | within a display generated by the Derivative Works, if and
116 | wherever such third-party notices normally appear. The contents
117 | of the NOTICE file are for informational purposes only and
118 | do not modify the License. You may add Your own attribution
119 | notices within Derivative Works that You distribute, alongside
120 | or as an addendum to the NOTICE text from the Work, provided
121 | that such additional attribution notices cannot be construed
122 | as modifying the License.
123 |
124 | You may add Your own copyright statement to Your modifications and
125 | may provide additional or different license terms and conditions
126 | for use, reproduction, or distribution of Your modifications, or
127 | for any such Derivative Works as a whole, provided Your use,
128 | reproduction, and distribution of the Work otherwise complies with
129 | the conditions stated in this License.
130 |
131 | 5. Submission of Contributions. Unless You explicitly state otherwise,
132 | any Contribution intentionally submitted for inclusion in the Work
133 | by You to the Licensor shall be under the terms and conditions of
134 | this License, without any additional terms or conditions.
135 | Notwithstanding the above, nothing herein shall supersede or modify
136 | the terms of any separate license agreement you may have executed
137 | with Licensor regarding such Contributions.
138 |
139 | 6. Trademarks. This License does not grant permission to use the trade
140 | names, trademarks, service marks, or product names of the Licensor,
141 | except as required for reasonable and customary use in describing the
142 | origin of the Work and reproducing the content of the NOTICE file.
143 |
144 | 7. Disclaimer of Warranty. Unless required by applicable law or
145 | agreed to in writing, Licensor provides the Work (and each
146 | Contributor provides its Contributions) on an "AS IS" BASIS,
147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148 | implied, including, without limitation, any warranties or conditions
149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150 | PARTICULAR PURPOSE. You are solely responsible for determining the
151 | appropriateness of using or redistributing the Work and assume any
152 | risks associated with Your exercise of permissions under this License.
153 |
154 | 8. Limitation of Liability. In no event and under no legal theory,
155 | whether in tort (including negligence), contract, or otherwise,
156 | unless required by applicable law (such as deliberate and grossly
157 | negligent acts) or agreed to in writing, shall any Contributor be
158 | liable to You for damages, including any direct, indirect, special,
159 | incidental, or consequential damages of any character arising as a
160 | result of this License or out of the use or inability to use the
161 | Work (including but not limited to damages for loss of goodwill,
162 | work stoppage, computer failure or malfunction, or any and all
163 | other commercial damages or losses), even if such Contributor
164 | has been advised of the possibility of such damages.
165 |
166 | 9. Accepting Warranty or Additional Liability. While redistributing
167 | the Work or Derivative Works thereof, You may choose to offer,
168 | and charge a fee for, acceptance of support, warranty, indemnity,
169 | or other liability obligations and/or rights consistent with this
170 | License. However, in accepting such obligations, You may act only
171 | on Your own behalf and on Your sole responsibility, not on behalf
172 | of any other Contributor, and only if You agree to indemnify,
173 | defend, and hold each Contributor harmless for any liability
174 | incurred by, or claims asserted against, such Contributor by reason
175 | of your accepting any such warranty or additional liability.
176 |
177 | END OF TERMS AND CONDITIONS
178 |
179 | APPENDIX: How to apply the Apache License to your work.
180 |
181 | To apply the Apache License to your work, attach the following
182 | boilerplate notice, with the fields enclosed by brackets "[]"
183 | replaced with your own identifying information. (Don't include
184 | the brackets!) The text should be enclosed in the appropriate
185 | comment syntax for the file format. We also recommend that a
186 | file or class name and description of purpose be included on the
187 | same "printed page" as the copyright notice for easier
188 | identification within third-party archives.
189 |
190 | Copyright [yyyy] [name of copyright owner]
191 |
192 | Licensed under the Apache License, Version 2.0 (the "License");
193 | you may not use this file except in compliance with the License.
194 | You may obtain a copy of the License at
195 |
196 | http://www.apache.org/licenses/LICENSE-2.0
197 |
198 | Unless required by applicable law or agreed to in writing, software
199 | distributed under the License is distributed on an "AS IS" BASIS,
200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201 | See the License for the specific language governing permissions and
202 | limitations under the License.
203 |
--------------------------------------------------------------------------------
/package/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | com.hibegin
7 | zrlog-web-parent
8 | 3.2.3-SNAPSHOT
9 |
10 | 4.0.0
11 | package
12 | ${packageType}
13 |
14 |
15 | UTF-8
16 | zrlog
17 | 0.11.2
18 | lib
19 | ../
20 | zrlog
21 | all
22 | jar
23 | 0000000
24 | 10.1.47
25 |
26 |
27 |
28 |
29 | com.hibegin
30 | zrlog-web
31 |
32 |
33 | com.hibegin
34 | simplewebserver-lambda-function-impl
35 | ${lambda-scope}
36 |
37 |
38 | org.apache.tomcat.embed
39 | tomcat-embed-core
40 | ${tomcat.version}
41 | ${jakarta-scope}
42 |
43 |
44 | org.apache.tomcat.embed
45 | tomcat-embed-jasper
46 | ${tomcat.version}
47 | ${jakarta-scope}
48 |
49 |
50 |
51 |
52 |
53 |
54 | org.codehaus.mojo
55 | exec-maven-plugin
56 | 3.1.0
57 |
58 |
59 | java-agent
60 |
61 | exec
62 |
63 |
64 | java
65 | ${project.build.directory}
66 |
67 | --enable-preview
68 | -classpath
69 |
70 | com.zrlog.web.GraalvmAgentApplication
71 |
72 |
73 |
74 |
75 | native
76 |
77 | exec
78 |
79 |
80 | ${project.build.directory}/${imageName}
81 | ${project.build.directory}
82 |
83 |
84 |
85 |
86 |
87 | org.apache.maven.plugins
88 | maven-compiler-plugin
89 |
90 | ${java.version}
91 | ${java.version}
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 | war
101 |
102 | ${finalName}-${project.version}
103 |
104 |
105 | org.apache.maven.plugins
106 | maven-war-plugin
107 | 3.4.0
108 |
109 | ${project.build.sourceEncoding}
110 | src/main/webapp
111 | false
112 |
113 | cache/**,
114 | static/**,
115 | WEB-INF/classes/**,
116 | WEB-INF/plugins/**,
117 | WEB-INF/update-temp/**,
118 | WEB-INF/db.properties,
119 | WEB-INF/install.lock,
120 |
121 | ${project.build.directory}/../../target
122 |
123 |
124 |
125 |
126 |
127 |
128 | package-native-zip
129 |
130 | ${finalName}-${project.version}-native
131 |
132 |
133 | maven-assembly-plugin
134 | org.apache.maven.plugins
135 |
136 | false
137 | ../target
138 |
139 | src/assembly/native-zip.xml
140 |
141 |
142 |
143 |
144 | make-zip
145 | package
146 |
147 | single
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 | package-faas-zip
157 |
158 | ${finalName}-${project.version}-faas
159 |
160 |
161 | maven-assembly-plugin
162 | org.apache.maven.plugins
163 |
164 | false
165 | ../target
166 |
167 | src/assembly/faas-zip.xml
168 |
169 |
170 |
171 |
172 | make-zip
173 | package
174 |
175 | single
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 | native
185 |
186 |
187 |
188 | org.apache.maven.plugins
189 | maven-jar-plugin
190 |
191 | true
192 |
193 |
194 |
195 | org.graalvm.buildtools
196 | native-maven-plugin
197 | ${native.maven.plugin.version}
198 | true
199 |
200 |
201 | build-native
202 |
203 | compile-no-fork
204 |
205 | package
206 |
207 |
208 | test-native
209 |
210 | test
211 |
212 | test
213 |
214 |
215 |
216 |
217 |
218 | -Ob
219 |
220 |
221 | -H:+UnlockExperimentalVMOptions
222 |
223 |
224 | --no-fallback
225 |
226 |
227 | --strict-image-heap
228 |
229 |
230 | --allow-incomplete-classpath
231 |
232 |
233 | -march=compatibility
234 |
235 |
236 | --enable-preview
237 |
238 |
239 | -H:DashboardDump=${imageName}
240 |
241 |
242 | -H:+DashboardAll
243 |
244 |
245 | -H:IncludeResources=
246 |
247 |
248 | --enable-url-protocols=http
249 |
250 |
251 | --enable-url-protocols=https
252 |
253 |
254 | com.zrlog.web.Application
255 |
256 | true
257 |
258 |
259 |
260 |
261 |
262 |
263 |
264 | jar
265 |
266 | ${finalName}-${project.version}
267 |
268 |
269 | org.apache.maven.plugins
270 | maven-compiler-plugin
271 | 3.11.0
272 |
273 | ${java.version}
274 | ${java.version}
275 | ${java.version}
276 |
277 | com/zrlog/web/*
278 |
279 |
280 |
281 |
282 | maven-clean-plugin
283 | 3.1.0
284 |
285 |
286 | clean
287 | clean
288 |
289 | clean
290 |
291 |
292 |
293 |
294 | ../${libOutputPath}
295 |
296 |
297 |
298 |
299 |
300 |
301 |
302 | org.apache.maven.plugins
303 | maven-dependency-plugin
304 | 3.8.1
305 |
306 |
307 | copy-dependencies
308 | prepare-package
309 |
310 | copy-dependencies
311 |
312 |
313 | ../${libOutputPath}
314 | false
315 | true
316 | false
317 | ${jakarta-scope}
318 |
319 | junit,hamcrest-core
320 |
321 |
322 |
323 |
324 |
325 |
326 | maven-assembly-plugin
327 | org.apache.maven.plugins
328 |
329 | false
330 | ../target
331 |
332 | src/assembly/java-zip.xml
333 |
334 |
335 |
336 |
337 | make-zip
338 | package
339 |
340 | single
341 |
342 |
343 |
344 |
345 |
346 | org.apache.maven.plugins
347 | maven-jar-plugin
348 | 3.4.2
349 |
350 | ${finalName}
351 | starter
352 |
353 | com/**
354 | lambda.json
355 |
356 |
357 |
358 | true
359 | ${libOutputPath}
360 | com.zrlog.web.Application
361 |
362 |
363 | .
364 |
365 |
366 | ../
367 |
368 |
369 |
370 |
371 |
372 |
373 | jdeb
374 |
375 |
376 |
377 | jdeb
378 | org.vafer
379 | 1.13
380 |
381 |
382 | package
383 |
384 | jdeb
385 |
386 |
387 | true
388 | USER
389 | false
390 |
391 | target/${packageName}-${project.version}-native.[[extension]]
392 |
393 |
394 | target/${packageName}-${project.version}-native.changes
395 |
396 | ${basedir}/src/deb/control
397 |
398 |
399 | ${native.target}/zrlog
400 | file
401 |
402 | perm
403 | /usr/bin
404 | zrlog
405 | zrlog
406 | 777
407 |
408 |
409 |
410 | ${basedir}/src/deb/init.d
411 | directory
412 |
413 | perm
414 | /etc/init.d
415 | zrlog
416 | zrlog
417 | 777
418 |
419 |
420 |
421 | ../README.md
422 | file
423 |
424 | perm
425 | /etc/zrlog
426 | zrlog
427 | zrlog
428 |
429 |
430 |
431 | ../README.en-us.md
432 | file
433 |
434 | perm
435 | /etc/zrlog
436 | zrlog
437 | zrlog
438 |
439 |
440 |
441 | ../bin/config/zrlog.properties
442 | file
443 |
444 | perm
445 | /etc/zrlog
446 | zrlog
447 | zrlog
448 |
449 |
450 |
451 |
452 |
453 |
454 |
455 |
456 | org.apache.maven.plugins
457 | maven-compiler-plugin
458 |
459 |
460 |
461 |
462 |
463 |
464 |
--------------------------------------------------------------------------------