Skip to content

Commit 3b023dd

Browse files
authored
docs: add docker-compose for development env (#4)
1 parent 1fd3743 commit 3b023dd

File tree

4 files changed

+144
-0
lines changed

4 files changed

+144
-0
lines changed

compose/README.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Halo 前后端服务的 Docker Compose
2+
3+
通过 Docker Compose 的方式启动 Halo 前后端服务快速查看插件效果。
4+
5+
## 开发指引
6+
7+
### 环境要求
8+
9+
- OpenJDK 17
10+
- NodeJS 16+
11+
- pnpm 7+
12+
- Docker
13+
- Docker Compose
14+
15+
### 编译插件
16+
17+
下载前端依赖:
18+
19+
```bash
20+
cd ./plugin-template
21+
22+
./gradlew.bat pnpmInstall
23+
24+
# or macOS/Linux
25+
26+
./gradlew pnpmInstall
27+
```
28+
29+
构建:
30+
31+
```bash
32+
./gradlew.bat build
33+
34+
# or macOS/Linux
35+
36+
./gradlew build
37+
```
38+
39+
### 启动 Halo
40+
41+
```bash
42+
cd plugin-template/compose
43+
docker-compose up -d
44+
docker-compose ps
45+
```
46+
47+
### 访问后台
48+
49+
在浏览器中访问 https://localhost/admin 即可,登录用户名和密码为当前目录中 `application-dev.yaml` 配置中的 `super-admin-username`
50+
`super-admin-password`
51+
52+
然后在左侧菜单中选择 `插件`,即可查看所有插件的状态。
53+
54+
### 开发
55+
56+
修改前端代码或者后端代码,然后运行 `./gradlew.bat build` 或者 `./gradlew build`(macOS/Linux)即可构建插件,无需重启
57+
Halo。但修改配置文件后需要 build 插件以及重启 Halo。

compose/application.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
server:
2+
port: 8090
3+
spring:
4+
profiles:
5+
active: dev
6+
halo:
7+
# external-url: https://next.ryanc.cc/
8+
security:
9+
initializer:
10+
super-admin-username: admin
11+
super-admin-password: P@88w0rd
12+
oauth2:
13+
jwt:
14+
jwsAlgorithm: rs512
15+
public-key-location: classpath:app.pub
16+
private-key-location: classpath:app.key
17+
plugin:
18+
runtime-mode: development # development, deployment
19+
classes-directories:
20+
- "build/classes"
21+
- "build/resources"
22+
lib-directories:
23+
- "libs"
24+
fixedPluginPath:
25+
- "/plugin"
26+
springdoc:
27+
api-docs:
28+
enabled: true
29+
swagger-ui:
30+
enabled: true
31+
show-login-endpoint: false
32+
show-actuator: false
33+
use-management-port: false
34+
management:
35+
endpoints:
36+
web:
37+
exposure:
38+
include: health,info,metrics,startup,shutdown
39+
server:
40+
port: 8090

compose/docker-compose.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
services:
2+
halo:
3+
image: halohub/halo-dev:next
4+
ports:
5+
- 8090:8090
6+
environment:
7+
- SPRING_CONFIG_ADDITIONAL_LOCATION=optional:file:/etc/config/
8+
volumes:
9+
- ./application.yaml:/etc/config/application.yaml
10+
- ../:/plugin
11+
networks:
12+
- halo
13+
halo-admin:
14+
image: halohub/admin-dev:next
15+
ports:
16+
- 80:80
17+
volumes:
18+
- ./halo.conf:/etc/nginx/conf.d/default.conf
19+
networks:
20+
- halo
21+
networks:
22+
halo: {}

compose/halo.conf

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
server {
2+
listen 80;
3+
listen [::]:80;
4+
server_name localhost;
5+
6+
#access_log /var/log/nginx/host.access.log main;
7+
8+
location / {
9+
proxy_pass http://halo:8090;
10+
}
11+
12+
location /admin {
13+
alias /usr/share/nginx/html;
14+
index index.html index.htm;
15+
}
16+
17+
#error_page 404 /404.html;
18+
19+
# redirect server error pages to the static page /50x.html
20+
#
21+
error_page 500 502 503 504 /50x.html;
22+
location = /50x.html {
23+
root /usr/share/nginx/html;
24+
}
25+
}

0 commit comments

Comments
 (0)