Skip to content

Commit

Permalink
Merge pull request #6 from qianmoQ/feature-dev
Browse files Browse the repository at this point in the history
发布 1.5.0
  • Loading branch information
qianmoQ committed Jan 28, 2024
2 parents 1afbd5b + 7af621b commit e999870
Show file tree
Hide file tree
Showing 15 changed files with 181 additions and 16 deletions.
126 changes: 126 additions & 0 deletions .github/workflows/publish-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
name: Publish images via Docker

on:
release:
types: [ published ]

env:
APP_NAME: infosphere
GITHUB_REGISTRY: ghcr.io
APP_GITHUB_GROUP: devlive-community
APP_DOCKER_GROUP: devliveorg

jobs:
before-compile:
runs-on: ubuntu-latest

outputs:
APP_VERSION: ${{ steps.apply_version.outputs.APP_VERSION }}

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup java
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'

- name: Generate app version
run: echo APP_VERSION=`./mvnw -Dexec.executable='echo' -Dexec.args='${project.version}' --non-recursive exec:exec -Dorg.slf4j.simpleLogger.defaultLogLevel=WARN -Dorg.slf4j.simpleLogger.log.org.apache.maven.plugins.help=INFO | tail -1` >> "$GITHUB_OUTPUT"
id: apply_version

- name: Compile from source
run: |
chmod 755 ./mvnw
./mvnw clean install package -Dfindbugs.skip -Dgpg.skip -Dcheckstyle.skip -DskipTests=true -q
- name: Cache binary
id: cache-binary
uses: actions/cache@v3
env:
cache-name: cache-binary
with:
path: |
./Dockerfile
./dist/infosphere-release.tar.gz
key: ${{ runner.os }}-build-${{ env.cache-name }}
restore-keys: ${{ runner.os }}-build-${{ env.cache-name }}

publish-github-ghcr:
runs-on: ubuntu-latest
needs:
- before-compile
steps:
- name: Get cache binary
id: cache-binary
uses: actions/cache@v3
env:
cache-name: cache-binary
with:
path: |
./Dockerfile
./dist/infosphere-release.tar.gz
key: ${{ runner.os }}-build-${{ env.cache-name }}
restore-keys: ${{ runner.os }}-build-${{ env.cache-name }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Docker Build
uses: docker/setup-buildx-action@v1

- name: Login
uses: docker/login-action@v1
with:
registry: ${{ env.GITHUB_REGISTRY }}
username: qianmoq
password: ${{ secrets.PACKAGES_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: |
${{ env.GITHUB_REGISTRY }}/${{ env.APP_GITHUB_GROUP }}/${{ env.APP_NAME }}:${{ needs.before-compile.outputs.APP_VERSION }}
${{ env.GITHUB_REGISTRY }}/${{ env.APP_GITHUB_GROUP }}/${{ env.APP_NAME }}:latest
publish-docker-hub:
runs-on: ubuntu-latest
needs:
- before-compile
steps:
- name: Get cache binary
id: cache-binary
uses: actions/cache@v3
env:
cache-name: cache-binary
with:
path: |
./Dockerfile
./dist/infosphere-release.tar.gz
key: ${{ runner.os }}-build-${{ env.cache-name }}
restore-keys: ${{ runner.os }}-build-${{ env.cache-name }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Docker Build
uses: docker/setup-buildx-action@v1

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.ORG_DOCKERHUB_USERNAME }}
password: ${{ secrets.ORG_DOCKERHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: |
${{ env.APP_DOCKER_GROUP }}/${{ env.APP_NAME }}:${{ needs.before-compile.outputs.APP_VERSION }}
${{ env.APP_DOCKER_GROUP }}/${{ env.APP_NAME }}:latest
11 changes: 8 additions & 3 deletions configure/initializer/infosphere.sql
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ CREATE TABLE `infosphere_role`
`update_time` TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间'
) COMMENT '用户路由表';

INSERT INTO `infosphere_role`(`code`, `name`, `description`)
VALUES ('8b80291d-6f7f-e239-005b-faeef22088d8', 'USER', 'User Role - 拥有普通用户权限'),
('151b9c43-6385-85e2-fe33-6a720b4c570b', 'ADMIN', 'Admin Role - 拥有平台所有权限');
INSERT INTO `infosphere_role`(`id`, `code`, `name`, `description`)
VALUES (1, '8b80291d-6f7f-e239-005b-faeef22088d8', 'USER', 'User Role - 拥有普通用户权限'),
(2, '151b9c43-6385-85e2-fe33-6a720b4c570b', 'ADMIN', 'Admin Role - 拥有平台所有权限');

CREATE TABLE `infosphere_user`
(
Expand All @@ -31,13 +31,18 @@ CREATE TABLE `infosphere_user`

INSERT INTO `infosphere_user` (`id`, `username`, `password`, `avatar`, `alias_name`, `signature`, `email`, `active`, `locked`)
VALUES (1, 'Anonymous User', null, '/static/images/anonymous.png', 'Anonymous User', '我是系统匿名用户用于底层默认用户', 'anonymous@devlive.org', 0, 1);
INSERT INTO `infosphere_user` (`id`, `username`, `password`, `avatar`, `alias_name`, `signature`, `email`, `active`, `locked`)
VALUES (2, 'infosphere', '$2a$10$FsBJlTOyjqKmK9iFuRuSTub0pvO2h8amcIock.r8Pl9KMuCsScB8S', null, 'infosphere', null, 'infosphere@devlive.org', 0, 0);

CREATE TABLE `infosphere_user_role_relation`
(
`user_id` BIGINT(20),
`role_id` BIGINT(20)
) COMMENT '用户与路由关系表';

INSERT INTO `infosphere_user_role_relation` (`user_id`, `role_id`)
VALUES (2, 1);

CREATE TABLE `infosphere_article`
(
`id` BIGINT(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,
Expand Down
2 changes: 1 addition & 1 deletion core/infosphere-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.devlive.infosphere</groupId>
<artifactId>infosphere</artifactId>
<version>1.5.0-SNAPSHOT</version>
<version>1.5.0</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion core/infosphere-security/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.devlive.infosphere</groupId>
<artifactId>infosphere</artifactId>
<version>1.5.0-SNAPSHOT</version>
<version>1.5.0</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion core/infosphere-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.devlive.infosphere</groupId>
<artifactId>infosphere</artifactId>
<version>1.5.0-SNAPSHOT</version>
<version>1.5.0</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<!-- 操作功能 -->
<div class="col-md-4 text-right">
<a class="btn btn-link btn-xs" th:target="_blank" th:href="@{'/viewer/article/' + ${details.code} + '/edit'}">修改</a>
<a th:if="${session.SPRING_SECURITY_CONTEXT}" class="btn btn-link btn-xs" th:target="_blank" th:href="@{'/viewer/article/' + ${details.code} + '/edit'}">修改</a>
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion core/infosphere-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.devlive.infosphere</groupId>
<artifactId>infosphere</artifactId>
<version>1.5.0-SNAPSHOT</version>
<version>1.5.0</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ public interface ArticleRepository
"ORDER BY e.createTime DESC")
Page<ArticleEntity> findAllOrderByCreateTimeDesc(Pageable pageable);

@Query(value = "SELECT e " +
"FROM ArticleEntity e " +
"WHERE e.published = true " +
"ORDER BY e.viewCount DESC")
Page<ArticleEntity> findAllOrderByViewCountDesc(Pageable pageable);

@Query(value = "SELECT e " +
"FROM ArticleEntity e " +
"WHERE e.user = :user " +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ public CommonResponse<PageAdapter<ArticleEntity>> findAll(String action, Pageabl
if (action.equals("forme")) {
return CommonResponse.success(PageAdapter.of(repository.findAllByUserOrderByCreateTimeDesc(UserDetailsService.getUser(), pageable)));
}
else if (action.equals("hottest")) {
return CommonResponse.success(PageAdapter.of(repository.findAllOrderByViewCountDesc(pageable)));
}
else {
return CommonResponse.success(PageAdapter.of(repository.findAllOrderByCreateTimeDesc(pageable)));
}
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ services:
- ./configure/initializer/infosphere.sql:/docker-entrypoint-initdb.d/schema.sql

infosphere-app:
image: devlive-community/infosphere:latest
image: devliveorg/infosphere:latest
environment:
SPRING_DATASOURCE_URL: jdbc:mysql://mysql:3306/infosphere
SPRING_DATASOURCE_USERNAME: root
Expand Down
10 changes: 5 additions & 5 deletions docs/docs/reference/getStarted/installFromDocker.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@
title: 在 Docker 中部署
---

InfoSphere 项目提供 [devlive-community/infosphere](https://hub.docker.com/r/devlive-community/infosphere) 包含 InfoSphere 服务器和默认配置的 Docker 映像。Docker 映像发布到 Docker Hub,可以与 Docker 运行时等一起使用。
InfoSphere 项目提供 [devliveorg/infosphere](https://hub.docker.com/r/devliveorg/infosphere) 包含 InfoSphere 服务器和默认配置的 Docker 映像。Docker 映像发布到 Docker Hub,可以与 Docker 运行时等一起使用。

### 运行容器

要在 Docker 中运行 InfoSphere,您必须在计算机上安装 Docker 引擎。您可以从 [Docker website](https://docker.com/), 或使用操作系统的打包系统。

使用 docker 命令从 [devlive-community/infosphere](https://hub.docker.com/r/devlive-community/infosphere) 图像。为其分配 `infosphere` 名称,以便以后更容易引用它。在后台运行它,并将默认 InfoSphere 端口(即 `9099`)从容器内部映射到工作站上的端口 `9099`
使用 docker 命令从 [devliveorg/infosphere](https://hub.docker.com/r/devliveorg/infosphere) 图像。为其分配 `infosphere` 名称,以便以后更容易引用它。在后台运行它,并将默认 InfoSphere 端口(即 `9099`)从容器内部映射到工作站上的端口 `9099`

```bash
docker run -d -p 9099:9099 --name infosphere devlive-community/infosphere
docker run -d -p 9099:9099 --name infosphere devliveorg/infosphere
```

如果不指定容器映像标记,则默认为 `latest` ,但可以使用许多已发布的 InfoSphere 版本,例如 `devlive-community/infosphere:1.5.0`
如果不指定容器映像标记,则默认为 `latest` ,但可以使用许多已发布的 InfoSphere 版本,例如 `devliveorg/infosphere:1.5.0`

!!! danger

```bash
docker run -d -p 9099:9099 -v /root/application.properties:/opt/app/infosphere/configure/application.properties --name infosphere devlive-community/infosphere
docker run -d -p 9099:9099 -v /root/application.properties:/opt/app/infosphere/configure/application.properties --name infosphere devliveorg/infosphere
```

假设您的配置文件在 `/root/application.properties`,如需要其他路径请指定绝对路径即可。
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/reference/getStarted/installFromDockerCompose.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ services:
- ./configure/initializer/infosphere.sql:/docker-entrypoint-initdb.d/schema.sql

infosphere-app:
image: devlive-community/infosphere:latest
image: devliveorg/infosphere:latest
environment:
SPRING_DATASOURCE_URL: jdbc:mysql://mysql:3306/infosphere
SPRING_DATASOURCE_USERNAME: root
Expand Down
23 changes: 23 additions & 0 deletions docs/docs/release/latest.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
**InfoSphere 发布!**

| 发布版本 | 发布时间 |
|:-------:|:------------:|
| `1.5.0` | `2024-01-28` |

## 基本功能

---

- 支持用户登录
- 支持用户注册

## 文章功能

---

- 支持创建文章
- 支持修改文章
- 支持最新文章 [首页]
- 支持最热文章 [首页]
- 支持我的文章 [首页]
- 支持推荐文章 [首页]
2 changes: 2 additions & 0 deletions docs/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,5 @@ nav:
- reference/getStarted/install.md
- reference/getStarted/installFromDocker.md
- reference/getStarted/installFromDockerCompose.md
- 更新日志:
- 1.5.0 (latest): release/latest.md
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<groupId>org.devlive.infosphere</groupId>
<artifactId>infosphere</artifactId>
<packaging>pom</packaging>
<version>1.5.0-SNAPSHOT</version>
<version>1.5.0</version>

<modules>
<module>core/infosphere-common</module>
Expand Down

0 comments on commit e999870

Please sign in to comment.