Loading .gitignore +6 −1 Original line number Diff line number Diff line Loading @@ -58,9 +58,14 @@ tmp/ # External files # external/ external/ccds/ external/csst-dfs-client/ external/csst-dag/ external/csst_fs/ data/ # Generated during Ansible variable import docker-celery-3.0.5/api_gateway/ccds/ docker-celery-3.0.5/api_gateway/csst-dfs-client/ external/csst-dag/ docker-celery-3.0.5/api_gateway/csst-dag/ docker-celery-3.0.5/api_gateway/csst_fs/ Makefile +3 −1 Original line number Diff line number Diff line Loading @@ -3,7 +3,7 @@ SUBDIR ?= docker-celery-3.0.5 .PHONY: help list-envs pull build push clean all \ ansible-deploy ansible-update ansible-update-master ansible-update-worker \ ansible-bootstrap ansible-deploy ansible-update ansible-update-master ansible-update-worker \ ansible-start ansible-stop ansible-kill ansible-down ansible-check ansible-sync-dags \ viewer-test viewer-test-down update-code Loading @@ -12,12 +12,14 @@ help: @echo "" @echo "Common usage:" @echo " make build BUILD_NUMBER=100000 HARBOR_API_URL=https://harbor.csst.nao:10443 HARBOR_API_PROJECT=csst" @echo " make ansible-bootstrap ENV=csu" @echo " make ansible-update ENV=p368" @echo " make ansible-stop ENV=csu" @echo "" @$(MAKE) -C $(SUBDIR) help list-envs pull build push clean all \ ansible-bootstrap \ ansible-deploy ansible-update ansible-update-master ansible-update-worker \ ansible-start ansible-stop ansible-kill ansible-down ansible-check ansible-sync-dags \ viewer-test viewer-test-down update-code: Loading README.md +14 −1 Original line number Diff line number Diff line Loading @@ -55,6 +55,18 @@ make ansible-update 提示:仓库根目录的 `Makefile` 是 wrapper,默认转发到 `docker-celery-3.0.5/` 目录执行。如果未来目录变更,可通过 `SUBDIR=...` 指定。 ### Bootstrap 区分 - `tools/bootstrap.sh`:给执行部署命令的本地控制机安装基础依赖,如 `python3`、`make`、`docker`、`docker compose`、`ansible-playbook`。 - `make ansible-bootstrap ENV=csu`:通过 Ansible 给 inventory 中的远端 `master/worker` 节点安装基础依赖,如 `python3`、`rsync`、`curl`、`docker`、`docker compose plugin`。 - 推荐顺序: ```bash sudo bash tools/bootstrap.sh make ansible-bootstrap ENV=csu bash tools/deploy.sh ``` ## 前置条件 - Docker、Docker Compose Loading Loading @@ -82,7 +94,8 @@ make ansible-update ```bash export BUILD_NUMBER=100000 export HARBOR_PROJECT=harbor.csst.nao:10443/csst/ export HARBOR_API_URL=https://harbor.csst.nao:10443 export HARBOR_API_PROJECT=csst make help make pull Loading docker-celery-3.0.5/Makefile +13 −1 Original line number Diff line number Diff line Loading @@ -74,6 +74,7 @@ help: @echo " make viewer-test - Build and run js9-service locally with ../data mounted (optional)" @echo " make all - Execute clean, pull, build, and push sequentially" @echo " make ansible-deploy - Deploy to environment (e.g. make ansible-deploy ENV=p368)" @echo " make ansible-bootstrap - Bootstrap remote nodes (e.g. make ansible-bootstrap ENV=csu)" @echo " make ansible-update - Update environment (e.g. make ansible-update ENV=p368)" @echo " make ansible-update-master - Update master-only services (e.g. make ansible-update-master ENV=csu)" @echo " make ansible-update-worker - Update workers safely (e.g. make ansible-update-worker ENV=csu)" Loading @@ -97,12 +98,13 @@ build: @echo "Checking external sources (../external):"; if [ -d "../external/csst-dfs-client" ]; then echo " [OK] csst-dfs-client (api-gateway)"; else echo " [MISS] csst-dfs-client (api-gateway)"; fi; if [ -d "../external/ccds" ]; then echo " [OK] ccds (api-gateway)"; else echo " [MISS] ccds (api-gateway)"; fi; if [ -d "../external/csst_fs" ]; then echo " [OK] csst_fs (api-gateway)"; else echo " [MISS] csst_fs (api-gateway)"; fi; if [ "$(SKIP_JS9)" = "1" ]; then echo " [SKIP] js9 (js9 image)"; else if [ -d "../external/js9" ]; then echo " [OK] js9 (js9 image)"; else echo " [MISS] js9 (js9 image)"; fi; fi; if [ -d "../external/csst-dag" ]; then echo " [OK] csst-dag"; else echo " [MISS] csst-dag"; fi; if [ -d "../external/csst-dags" ]; then echo " [OK] csst-dags"; else echo " [MISS] csst-dags"; fi; @if [ ! -f $(REQ_FILE) ]; then echo "Error: $(REQ_FILE) not found"; exit 1; fi @set -e; \ cleanup() { rm -rf ./api_gateway/csst-dfs-client ./api_gateway/ccds ./api_gateway/csst-dag ./external/js9 >/dev/null 2>&1 || true; }; \ cleanup() { rm -rf ./api_gateway/csst-dfs-client ./api_gateway/ccds ./api_gateway/csst_fs ./api_gateway/csst-dag ./external/js9 >/dev/null 2>&1 || true; }; \ trap cleanup EXIT; \ total=$$(grep -v '^#' $(REQ_FILE) | grep -v '^$$' | wc -l); \ total_imgs=$$(($$total+$(CUSTOM_IMAGE_COUNT))); \ Loading Loading @@ -134,6 +136,10 @@ build: mkdir -p ./api_gateway/ccds; \ rsync -a --delete --exclude ".git" --exclude "__pycache__" --exclude "*.pyc" ../external/ccds/ ./api_gateway/ccds/; \ fi; \ if [ -d "../external/csst_fs" ]; then \ mkdir -p ./api_gateway/csst_fs; \ rsync -a --delete --exclude ".git" --exclude "__pycache__" --exclude "*.pyc" ../external/csst_fs/ ./api_gateway/csst_fs/; \ fi; \ if [ -d "../external/csst-dag" ]; then \ mkdir -p ./api_gateway/csst-dag; \ rsync -a --delete --exclude ".git" --exclude "__pycache__" --exclude "*.pyc" ../external/csst-dag/ ./api_gateway/csst-dag/; \ Loading Loading @@ -181,6 +187,7 @@ all: clean pull build push clean: @echo "Cleaning up custom-built images..." @rm -rf ./api_gateway/csst-dfs-client ./api_gateway/ccds ./api_gateway/csst_fs ./api_gateway/csst-dag ./external/js9 >/dev/null 2>&1 || true @set -e; \ ids=$$(docker images --format '{{.Repository}}:{{.Tag}} {{.ID}}' | awk '$$1 ~ /(csst-airflow|api-gateway|task-portal|worker-stats-agent|js9)/ {print $$2}' | sort -u); \ for id in $$ids; do \ Loading Loading @@ -211,6 +218,11 @@ ansible-deploy: @if [ ! -f "deploy_configs/$(ENV)/inventory.ini" ]; then echo "Error: deploy_configs/$(ENV)/inventory.ini not found"; exit 1; fi ansible-playbook -i deploy_configs/$(ENV)/inventory.ini ansible/deploy.yml $(ANSIBLE_EXTRA_VARS) ansible-bootstrap: @if [ -z "$(ENV)" ]; then echo "Error: ENV is not set. Usage: make ansible-bootstrap 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 ansible-playbook -i deploy_configs/$(ENV)/inventory.ini ansible/bootstrap.yml $(ANSIBLE_EXTRA_VARS) ansible-update: @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 Loading docker-celery-3.0.5/ansible/bootstrap.yml 0 → 100644 +84 −0 Original line number Diff line number Diff line --- - name: Bootstrap Remote Ubuntu Nodes hosts: all become: yes gather_facts: false tasks: - name: Ensure python3 is available for Ansible modules raw: | set -e if command -v python3 >/dev/null 2>&1; then exit 0 fi export DEBIAN_FRONTEND=noninteractive apt-get update apt-get install -y python3 changed_when: false - name: Gather facts after python bootstrap setup: - name: Validate supported distribution assert: that: - ansible_distribution == "Ubuntu" - ansible_distribution_version in ["22.04", "24.04"] fail_msg: "bootstrap.yml currently supports only Ubuntu 22.04 / 24.04" - name: Install base packages apt: update_cache: yes cache_valid_time: 3600 name: - ca-certificates - curl - gnupg - lsb-release - python3 - python3-pip - rsync state: present - name: Ensure docker apt keyrings directory exists file: path: /etc/apt/keyrings state: directory mode: "0755" - name: Install Docker apt key get_url: url: https://download.docker.com/linux/ubuntu/gpg dest: /etc/apt/keyrings/docker.asc mode: "0644" - name: Configure Docker apt repository copy: dest: /etc/apt/sources.list.d/docker.list mode: "0644" content: | deb [arch={{ ansible_architecture | replace('x86_64', 'amd64') | replace('aarch64', 'arm64') }} signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu {{ ansible_lsb.codename }} stable - name: Install Docker engine and compose plugin apt: update_cache: yes name: - containerd.io - docker-buildx-plugin - docker-ce - docker-ce-cli - docker-compose-plugin state: present - name: Ensure docker service is enabled and running service: name: docker state: started enabled: yes - name: Print bootstrap summary debug: msg: - "Bootstrap complete on {{ inventory_hostname }}" - "Python: {{ ansible_python.executable }}" - "Docker installed and service started" Loading
.gitignore +6 −1 Original line number Diff line number Diff line Loading @@ -58,9 +58,14 @@ tmp/ # External files # external/ external/ccds/ external/csst-dfs-client/ external/csst-dag/ external/csst_fs/ data/ # Generated during Ansible variable import docker-celery-3.0.5/api_gateway/ccds/ docker-celery-3.0.5/api_gateway/csst-dfs-client/ external/csst-dag/ docker-celery-3.0.5/api_gateway/csst-dag/ docker-celery-3.0.5/api_gateway/csst_fs/
Makefile +3 −1 Original line number Diff line number Diff line Loading @@ -3,7 +3,7 @@ SUBDIR ?= docker-celery-3.0.5 .PHONY: help list-envs pull build push clean all \ ansible-deploy ansible-update ansible-update-master ansible-update-worker \ ansible-bootstrap ansible-deploy ansible-update ansible-update-master ansible-update-worker \ ansible-start ansible-stop ansible-kill ansible-down ansible-check ansible-sync-dags \ viewer-test viewer-test-down update-code Loading @@ -12,12 +12,14 @@ help: @echo "" @echo "Common usage:" @echo " make build BUILD_NUMBER=100000 HARBOR_API_URL=https://harbor.csst.nao:10443 HARBOR_API_PROJECT=csst" @echo " make ansible-bootstrap ENV=csu" @echo " make ansible-update ENV=p368" @echo " make ansible-stop ENV=csu" @echo "" @$(MAKE) -C $(SUBDIR) help list-envs pull build push clean all \ ansible-bootstrap \ ansible-deploy ansible-update ansible-update-master ansible-update-worker \ ansible-start ansible-stop ansible-kill ansible-down ansible-check ansible-sync-dags \ viewer-test viewer-test-down update-code: Loading
README.md +14 −1 Original line number Diff line number Diff line Loading @@ -55,6 +55,18 @@ make ansible-update 提示:仓库根目录的 `Makefile` 是 wrapper,默认转发到 `docker-celery-3.0.5/` 目录执行。如果未来目录变更,可通过 `SUBDIR=...` 指定。 ### Bootstrap 区分 - `tools/bootstrap.sh`:给执行部署命令的本地控制机安装基础依赖,如 `python3`、`make`、`docker`、`docker compose`、`ansible-playbook`。 - `make ansible-bootstrap ENV=csu`:通过 Ansible 给 inventory 中的远端 `master/worker` 节点安装基础依赖,如 `python3`、`rsync`、`curl`、`docker`、`docker compose plugin`。 - 推荐顺序: ```bash sudo bash tools/bootstrap.sh make ansible-bootstrap ENV=csu bash tools/deploy.sh ``` ## 前置条件 - Docker、Docker Compose Loading Loading @@ -82,7 +94,8 @@ make ansible-update ```bash export BUILD_NUMBER=100000 export HARBOR_PROJECT=harbor.csst.nao:10443/csst/ export HARBOR_API_URL=https://harbor.csst.nao:10443 export HARBOR_API_PROJECT=csst make help make pull Loading
docker-celery-3.0.5/Makefile +13 −1 Original line number Diff line number Diff line Loading @@ -74,6 +74,7 @@ help: @echo " make viewer-test - Build and run js9-service locally with ../data mounted (optional)" @echo " make all - Execute clean, pull, build, and push sequentially" @echo " make ansible-deploy - Deploy to environment (e.g. make ansible-deploy ENV=p368)" @echo " make ansible-bootstrap - Bootstrap remote nodes (e.g. make ansible-bootstrap ENV=csu)" @echo " make ansible-update - Update environment (e.g. make ansible-update ENV=p368)" @echo " make ansible-update-master - Update master-only services (e.g. make ansible-update-master ENV=csu)" @echo " make ansible-update-worker - Update workers safely (e.g. make ansible-update-worker ENV=csu)" Loading @@ -97,12 +98,13 @@ build: @echo "Checking external sources (../external):"; if [ -d "../external/csst-dfs-client" ]; then echo " [OK] csst-dfs-client (api-gateway)"; else echo " [MISS] csst-dfs-client (api-gateway)"; fi; if [ -d "../external/ccds" ]; then echo " [OK] ccds (api-gateway)"; else echo " [MISS] ccds (api-gateway)"; fi; if [ -d "../external/csst_fs" ]; then echo " [OK] csst_fs (api-gateway)"; else echo " [MISS] csst_fs (api-gateway)"; fi; if [ "$(SKIP_JS9)" = "1" ]; then echo " [SKIP] js9 (js9 image)"; else if [ -d "../external/js9" ]; then echo " [OK] js9 (js9 image)"; else echo " [MISS] js9 (js9 image)"; fi; fi; if [ -d "../external/csst-dag" ]; then echo " [OK] csst-dag"; else echo " [MISS] csst-dag"; fi; if [ -d "../external/csst-dags" ]; then echo " [OK] csst-dags"; else echo " [MISS] csst-dags"; fi; @if [ ! -f $(REQ_FILE) ]; then echo "Error: $(REQ_FILE) not found"; exit 1; fi @set -e; \ cleanup() { rm -rf ./api_gateway/csst-dfs-client ./api_gateway/ccds ./api_gateway/csst-dag ./external/js9 >/dev/null 2>&1 || true; }; \ cleanup() { rm -rf ./api_gateway/csst-dfs-client ./api_gateway/ccds ./api_gateway/csst_fs ./api_gateway/csst-dag ./external/js9 >/dev/null 2>&1 || true; }; \ trap cleanup EXIT; \ total=$$(grep -v '^#' $(REQ_FILE) | grep -v '^$$' | wc -l); \ total_imgs=$$(($$total+$(CUSTOM_IMAGE_COUNT))); \ Loading Loading @@ -134,6 +136,10 @@ build: mkdir -p ./api_gateway/ccds; \ rsync -a --delete --exclude ".git" --exclude "__pycache__" --exclude "*.pyc" ../external/ccds/ ./api_gateway/ccds/; \ fi; \ if [ -d "../external/csst_fs" ]; then \ mkdir -p ./api_gateway/csst_fs; \ rsync -a --delete --exclude ".git" --exclude "__pycache__" --exclude "*.pyc" ../external/csst_fs/ ./api_gateway/csst_fs/; \ fi; \ if [ -d "../external/csst-dag" ]; then \ mkdir -p ./api_gateway/csst-dag; \ rsync -a --delete --exclude ".git" --exclude "__pycache__" --exclude "*.pyc" ../external/csst-dag/ ./api_gateway/csst-dag/; \ Loading Loading @@ -181,6 +187,7 @@ all: clean pull build push clean: @echo "Cleaning up custom-built images..." @rm -rf ./api_gateway/csst-dfs-client ./api_gateway/ccds ./api_gateway/csst_fs ./api_gateway/csst-dag ./external/js9 >/dev/null 2>&1 || true @set -e; \ ids=$$(docker images --format '{{.Repository}}:{{.Tag}} {{.ID}}' | awk '$$1 ~ /(csst-airflow|api-gateway|task-portal|worker-stats-agent|js9)/ {print $$2}' | sort -u); \ for id in $$ids; do \ Loading Loading @@ -211,6 +218,11 @@ ansible-deploy: @if [ ! -f "deploy_configs/$(ENV)/inventory.ini" ]; then echo "Error: deploy_configs/$(ENV)/inventory.ini not found"; exit 1; fi ansible-playbook -i deploy_configs/$(ENV)/inventory.ini ansible/deploy.yml $(ANSIBLE_EXTRA_VARS) ansible-bootstrap: @if [ -z "$(ENV)" ]; then echo "Error: ENV is not set. Usage: make ansible-bootstrap 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 ansible-playbook -i deploy_configs/$(ENV)/inventory.ini ansible/bootstrap.yml $(ANSIBLE_EXTRA_VARS) ansible-update: @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 Loading
docker-celery-3.0.5/ansible/bootstrap.yml 0 → 100644 +84 −0 Original line number Diff line number Diff line --- - name: Bootstrap Remote Ubuntu Nodes hosts: all become: yes gather_facts: false tasks: - name: Ensure python3 is available for Ansible modules raw: | set -e if command -v python3 >/dev/null 2>&1; then exit 0 fi export DEBIAN_FRONTEND=noninteractive apt-get update apt-get install -y python3 changed_when: false - name: Gather facts after python bootstrap setup: - name: Validate supported distribution assert: that: - ansible_distribution == "Ubuntu" - ansible_distribution_version in ["22.04", "24.04"] fail_msg: "bootstrap.yml currently supports only Ubuntu 22.04 / 24.04" - name: Install base packages apt: update_cache: yes cache_valid_time: 3600 name: - ca-certificates - curl - gnupg - lsb-release - python3 - python3-pip - rsync state: present - name: Ensure docker apt keyrings directory exists file: path: /etc/apt/keyrings state: directory mode: "0755" - name: Install Docker apt key get_url: url: https://download.docker.com/linux/ubuntu/gpg dest: /etc/apt/keyrings/docker.asc mode: "0644" - name: Configure Docker apt repository copy: dest: /etc/apt/sources.list.d/docker.list mode: "0644" content: | deb [arch={{ ansible_architecture | replace('x86_64', 'amd64') | replace('aarch64', 'arm64') }} signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu {{ ansible_lsb.codename }} stable - name: Install Docker engine and compose plugin apt: update_cache: yes name: - containerd.io - docker-buildx-plugin - docker-ce - docker-ce-cli - docker-compose-plugin state: present - name: Ensure docker service is enabled and running service: name: docker state: started enabled: yes - name: Print bootstrap summary debug: msg: - "Bootstrap complete on {{ inventory_hostname }}" - "Python: {{ ansible_python.executable }}" - "Docker installed and service started"