Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions compose/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Halo 前后端服务的 Docker Compose

通过 Docker Compose 的方式启动 Halo 前后端服务快速查看插件效果。

## 开发指引

### 环境要求

- OpenJDK 17
- NodeJS 16+
- pnpm 7+
- docker
- docker-compose

### 编译插件

下载前端依赖:

```bash
cd ./plugin-template

./gradlew.bat pnpmInstall

# or macOS/Linux

./gradlew pnpmInstall
```

构建:

```bash
./gradlew.bat build

# or macOS/Linux

./gradlew build
```

### 启动 Halo

```bash
cd plugin-template/compose
docker-compose up -d
docker-compose ps
```

### 访问后台

在浏览器中访问 https://localhost/admin 即可,登录用户名和密码为当前目录中 `application-dev.yaml` 配置中的 `super-admin-username`
和 `super-admin-password`。

然后在左侧菜单中选择 `插件`,即可查看所有插件的状态。

### 开发

修改前端代码或者后端代码,然后运行 `./gradlew.bat build` 或者 `./gradlew build`(macOS/Linux)即可构建插件,无需重启
Halo。但修改配置文件后需要 build 插件以及重启 Halo。
40 changes: 40 additions & 0 deletions compose/application.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
server:
port: 8090
spring:
profiles:
active: dev
halo:
# external-url: https://next.ryanc.cc/
security:
initializer:
super-admin-username: admin
super-admin-password: P@88w0rd
oauth2:
jwt:
jwsAlgorithm: rs512
public-key-location: classpath:app.pub
private-key-location: classpath:app.key
plugin:
runtime-mode: development # development, deployment
classes-directories:
- "build/classes"
- "build/resources"
lib-directories:
- "libs"
fixedPluginPath:
- "/plugin"
springdoc:
api-docs:
enabled: true
swagger-ui:
enabled: true
show-login-endpoint: false
show-actuator: false
use-management-port: false
management:
endpoints:
web:
exposure:
include: health,info,metrics,startup,shutdown
server:
port: 8090
22 changes: 22 additions & 0 deletions compose/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
services:
halo:
image: halohub/halo-dev:next
ports:
- 8090:8090
environment:
- SPRING_CONFIG_ADDITIONAL_LOCATION=optional:file:/etc/config/
volumes:
- ./application.yaml:/etc/config/application.yaml
- ../:/plugin
networks:
- halo
halo-admin:
image: halohub/admin-dev:next
ports:
- 80:80
volumes:
- ./halo.conf:/etc/nginx/conf.d/default.conf
networks:
- halo
networks:
halo: {}
25 changes: 25 additions & 0 deletions compose/halo.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
server {
listen 80;
listen [::]:80;
server_name localhost;

#access_log /var/log/nginx/host.access.log main;

location / {
proxy_pass http://halo:8090;
}

location /admin {
alias /usr/share/nginx/html;
index index.html index.htm;
}

#error_page 404 /404.html;

# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}