AlexSJC
发布于 2024-08-07 / 34 阅读
1
0

Docker 部署 Halo

Halo + PostgreSQL

services:
  halo:
    image: halohub/halo:2.18
    container_name: halo
    restart: on-failure:3
    depends_on:
      halo_db:
        condition: service_healthy
    networks:
      halo_network:
    volumes:
      - ./halo:/root/.halo2
    ports:
      - "8090:8090"
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:8090/actuator/health/readiness"]
      interval: 30s
      timeout: 5s
      retries: 5
      start_period: 30s          
    command:
      - --spring.r2dbc.url=r2dbc:pool:postgresql://halo_db/halo
      - --spring.r2dbc.username=halo
      # PostgreSQL 的密码,请保证与下方 POSTGRES_PASSWORD 的变量值一致。
      - --spring.r2dbc.password=12345678
      - --spring.sql.init.platform=postgresql
      # 外部访问地址,请根据实际需要修改
      - --halo.external-url=http://localhost:8090/
  halo_db:
    image: postgres:15.4
    container_name: halo_db
    restart: on-failure:3
    networks:
      halo_network:
    volumes:
      - ./halo_db:/var/lib/postgresql/data
    healthcheck:
      test: [ "CMD", "pg_isready" ]
      interval: 10s
      timeout: 5s
      retries: 5
    environment:
      - POSTGRES_PASSWORD=12345678
      - POSTGRES_USER=halo
      - POSTGRES_DB=halo
      - PGUSER=halo

networks:
  halo_network:
docker compose up -d


评论