-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update docker-compose.md #276
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -117,14 +117,13 @@ import DockerArgs from "./slots/docker-args.md" | |
|
||
services: | ||
halo: | ||
image: halohub/halo:2.10 | ||
image: halohub/halo:2.10.2 | ||
container_name: halo | ||
restart: on-failure:3 | ||
depends_on: | ||
halodb: | ||
condition: service_healthy | ||
- halodb | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 这里建议添加上 参考: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 在 Docker Compose 文件的版本 3 中,condition 形式的 depends_on 是不支持的。所以应该使用数组形式来声明依赖关系,而不是使用映射(map)和条件。 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 所以我改写成如下版本:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 我这边实际测试了一下,这样修改之后反而是有问题的: 这样会让 Halo 和 MySQL 同时启动,就会造成 MySQL 容器还没有 ready,Halo 也无法启动。 根据文档 docs.docker.com/compose/compose-file/05-services/#long-syntax-1,当前的配置方式才是正确的,我想知道你是遇到什么问题才进行这个修改的吗? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. version: "3"
services:
halo:
image: halohub/halo:2.10.2
container_name: halo
restart: on-failure:3
depends_on:
- halodb
networks:
- halo_network
volumes:
- ./halo2:/root/.halo2
ports:
- "8090:8090"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8090/actuator/health/readiness"]
interval: 30s
timeout: 5s
retries: 5
command:
- --spring.r2dbc.url=r2dbc:pool:mysql://halodb:3306/halo
- --spring.r2dbc.username=root
- --spring.r2dbc.password=zdasdasdad
- --spring.sql.init.platform=mysql
- --halo.external-url=http://123.12.123.123:8090/
halodb:
image: mysql:8.1.0
container_name: halodb
restart: on-failure:3
networks:
- halo_network
command:
- --default-authentication-plugin=caching_sha2_password
- --character-set-server=utf8mb4
- --collation-server=utf8mb4_general_ci
- --explicit_defaults_for_timestamp=true
volumes:
- ./mysql:/var/lib/mysql
- ./mysqlBackup:/data/mysqlBackup
ports:
- "3306:3306"
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "--silent"]
interval: 3s
retries: 5
environment:
- MYSQL_ROOT_PASSWORD=zdasdasdad
- MYSQL_DATABASE=halo
networks:
halo_network:
以上的yaml配置文件就是我本人的配置,我本人已经运行成功,博客也在使用中。还是我上述的观点(如下):
PS:上述的数据库的密码和地址请自行配置(本人已修改) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ~# docker-compose version
docker-compose version 1.25.0, build unknown
docker-py version: 4.1.0
CPython version: 3.8.2
OpenSSL version: OpenSSL 1.1.1f 31 Mar 2020 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Docker Compose 版本过旧,不支持我们文档提供的 depends_on 写法,1.25.0 已经是 2019 年的版本了。 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
好的,谢谢,了解了 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 那我就关闭这个 PR 了。 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok |
||
networks: | ||
halo_network: | ||
- halo_network | ||
volumes: | ||
- ./halo2:/root/.halo2 | ||
ports: | ||
|
@@ -134,7 +133,6 @@ import DockerArgs from "./slots/docker-args.md" | |
interval: 30s | ||
timeout: 5s | ||
retries: 5 | ||
start_period: 30s | ||
command: | ||
- --spring.r2dbc.url=r2dbc:pool:mysql://halodb:3306/halo | ||
- --spring.r2dbc.username=root | ||
|
@@ -149,7 +147,7 @@ import DockerArgs from "./slots/docker-args.md" | |
container_name: halodb | ||
restart: on-failure:3 | ||
networks: | ||
halo_network: | ||
- halo_network | ||
command: | ||
- --default-authentication-plugin=caching_sha2_password | ||
- --character-set-server=utf8mb4 | ||
|
@@ -161,17 +159,17 @@ import DockerArgs from "./slots/docker-args.md" | |
ports: | ||
- "3306:3306" | ||
healthcheck: | ||
test: ["CMD", "mysqladmin", "ping", "-h", "127.0.0.1", "--silent"] | ||
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "--silent"] | ||
interval: 3s | ||
retries: 5 | ||
start_period: 30s | ||
environment: | ||
# 请修改此密码,并对应修改上方 Halo 服务的 SPRING_R2DBC_PASSWORD 变量值 | ||
- MYSQL_ROOT_PASSWORD=o#DwN&JSa56 | ||
- MYSQL_DATABASE=halo | ||
|
||
networks: | ||
halo_network: | ||
|
||
``` | ||
|
||
3. 仅创建 Halo 实例(使用默认的 H2 数据库,**不推荐用于生产环境,建议体验和测试的时候使用**): | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
建议不加上 patch 版本。主要是为了每次发布 patch 版本的时候不用频繁修改文档。