Commit 2cfbb434 authored by BO ZHANG's avatar BO ZHANG 🏀
Browse files

fix(deploy): 改进ansible-update中HARBOR_PROJECT的获取逻辑

parent 7bc0b485
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -174,11 +174,16 @@ ansible-deploy:
	ansible-playbook -i deploy_configs/$(ENV)/inventory.ini ansible/deploy.yml $(ANSIBLE_EXTRA_VARS)

ansible-update:
	@echo "ENV=$(ENV)"
	@echo "BUILD_NUMBER=$(BUILD_NUMBER)"
	@echo "HARBOR_PROJECT=$(HARBOR_PROJECT)"
	@if [ -z "$(ENV)" ]; then echo "Error: ENV is not set. Usage: make ansible-update ENV=p368"; exit 1; fi
	@if [ ! -f "deploy_configs/$(ENV)/inventory.ini" ]; then echo "Error: deploy_configs/$(ENV)/inventory.ini not found"; exit 1; fi
	@effective_harbor_project="$(HARBOR_PROJECT)"; \
	if [ -z "$$effective_harbor_project" ]; then \
		effective_harbor_project=$$(awk -F= '/^[[:space:]]*harbor_project=/{print $$2; exit}' deploy_configs/$(ENV)/inventory.ini); \
	fi; \
	echo "ENV=$(ENV)"; \
	echo "BUILD_NUMBER=$(BUILD_NUMBER)"; \
	echo "HARBOR_PROJECT=$(HARBOR_PROJECT)"; \
	echo "EFFECTIVE_HARBOR_PROJECT=$$effective_harbor_project"
	ansible-playbook -i deploy_configs/$(ENV)/inventory.ini ansible/update.yml $(ANSIBLE_EXTRA_VARS)

ansible-down:
+4 −4
Original line number Diff line number Diff line
@@ -5,17 +5,17 @@ csu-master ansible_host=192.168.25.90 ansible_connection=local ansible_user=root
[worker]
# Add one worker node per line
# e.g., csu-worker1 ansible_host=192.168.25.19 ansible_user=root deploy_dir=/opt/csst-airflow-worker1 worker_concurrency=16
csu-worker1 ansible_host=192.168.25.14 ansible_connection=ssh ansible_user=root deploy_dir=/opt/csst-airflow-worker1 worker_concurrency=32
csu-worker1 ansible_host=192.168.25.18 ansible_connection=ssh ansible_user=root deploy_dir=/opt/csst-airflow-worker1 worker_concurrency=32
# csu-worker2 ansible_host=192.168.25.15 ansible_user=root deploy_dir=/opt/csst-airflow-worker2 worker_concurrency=32

[all:vars]
# The destination directory on remote nodes where the project will be deployed
deploy_dir=/opt/csst-airflow

registry_pull=false
# Whether to force-remove local business images and pull the target tag from registry during ansible-update
registry_pull=true

harbor_registry=csu-harbor.csst.nao:10443

harbor_project=csu-harbor.csst.nao:10443/csst/
extra_hosts=csu-harbor.csst.nao:192.168.25.153

# API Gateway 与 Airflow Webserver 通信所用的 JWT 密钥 (各环境可独立生成以保证安全)
+18 −0
Original line number Diff line number Diff line
@@ -141,6 +141,8 @@ x-airflow-common:
services:
  postgres:
    image: ${HARBOR_PROJECT}postgres:${BUILD_NUMBER:-latest}
    profiles:
      - master
    environment:
      POSTGRES_USER: airflow
      POSTGRES_PASSWORD: airflow
@@ -161,6 +163,8 @@ services:
    # Redis is limited to 7.2-bookworm due to licencing change
    # https://redis.io/blog/redis-adopts-dual-source-available-licensing/
    image: ${HARBOR_PROJECT}redis:${BUILD_NUMBER:-latest}
    profiles:
      - master
#    expose:
#      - 6379
    ports:
@@ -175,6 +179,8 @@ services:

  elasticsearch:
    image: ${HARBOR_PROJECT}elasticsearch:${BUILD_NUMBER:-latest}
    profiles:
      - master
    environment:
      - discovery.type=single-node
      - xpack.security.enabled=false
@@ -193,6 +199,8 @@ services:

  kibana:
    image: ${HARBOR_PROJECT}kibana:${BUILD_NUMBER:-latest}
    profiles:
      - master
    environment:
      - ELASTICSEARCH_HOSTS=http://${ELASTICSEARCH_HOST:-elasticsearch}:${ELASTICSEARCH_PORT:-9200}
    ports:
@@ -219,6 +227,8 @@ services:
  airflow-apiserver:
    <<: *airflow-common
    command: api-server
    profiles:
      - master
    ports:
      - "38080:8080"
    healthcheck:
@@ -236,6 +246,8 @@ services:
  airflow-scheduler:
    <<: *airflow-common
    command: scheduler
    profiles:
      - master
    healthcheck:
      test: ["CMD", "curl", "--fail", "http://localhost:8974/health"]
      interval: 30s
@@ -251,6 +263,8 @@ services:
  airflow-dag-processor:
    <<: *airflow-common
    command: dag-processor
    profiles:
      - master
    healthcheck:
      test: ["CMD-SHELL", 'airflow jobs check --job-type DagProcessorJob --hostname "$${HOSTNAME}"']
      interval: 30s
@@ -295,6 +309,8 @@ services:
  airflow-triggerer:
    <<: *airflow-common
    command: triggerer
    profiles:
      - master
    healthcheck:
      test: ["CMD-SHELL", 'airflow jobs check --job-type TriggererJob --hostname "$${HOSTNAME}"']
      interval: 30s
@@ -310,6 +326,8 @@ services:
  airflow-init:
    <<: *airflow-common
    entrypoint: /bin/bash
    profiles:
      - master
    # yamllint disable rule:line-length
    command:
      - -c