From bdd0ef7752d4eaae697ed00ce66346a31739843e Mon Sep 17 00:00:00 2001 From: hahwu <31872165+hahwu@users.noreply.github.com> Date: Fri, 13 Mar 2026 17:56:05 +0800 Subject: [PATCH] =?UTF-8?q?=E8=84=9A=E6=9C=AC=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pack_backend.sh | 4 ++ playbook/merge_pet_backend.yml | 70 ++++++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 pack_backend.sh create mode 100644 playbook/merge_pet_backend.yml diff --git a/pack_backend.sh b/pack_backend.sh new file mode 100644 index 0000000..859fca4 --- /dev/null +++ b/pack_backend.sh @@ -0,0 +1,4 @@ +# cd /data/docs +# python3 tool/cfg/tool_cfg_json.py +cd /codes/game_backend +GOOS=linux GOARCH=amd64 /usr/local/go/bin/go build -o /data/devops/source/main main.go diff --git a/playbook/merge_pet_backend.yml b/playbook/merge_pet_backend.yml new file mode 100644 index 0000000..8dac513 --- /dev/null +++ b/playbook/merge_pet_backend.yml @@ -0,0 +1,70 @@ +--- +- name: Deploy GoLeaf release + hosts: new-test + gather_facts: no + remote_user: root + vars: + goleaf_src: /data/devops/source/main + goleaf_dest: /data/Goleaf + config_src: /data/docs/tool/out/ + config_dest: /data/Goleaf/gamedata/config/ + pack_script: /data/devops/pack.sh + tar_file: /data/Goleaf.tar + tar_dest: /data/Goleaf + + tasks: + + # - name: change git branch + # shell: cd /codes/pet_home_server && git checkout develop && git pull + # delegate_to: localhost + # register: git_result + # - name: change docs git branch + # shell: cd /data/docs && git checkout main && git pull + # delegate_to: localhost + + - name: protoc protobuff + shell: cd /data/docs && protoc --go_out=/codes/game_backend/msg ./proto/Gameapi.proto + delegate_to: localhost + + - name: sh pack.sh + shell: sh /data/devops/pack_backend.sh + delegate_to: localhost + - name: backup goleaf + shell: mv /data/Goleaf/main /data/Goleaf/main.bak + ignore_errors: yes + + - name: copy goleaf + copy: + src: "{{ goleaf_src }}" + dest: "{{goleaf_dest}}" + mode: 0755 + + - name: parse config + shell: cd /data/docs && git pull && python3 /data/docs/tool/cfg/tool_cfg_json.py + delegate_to: localhost + + + - name: archive config + archive: + path: /data/docs/tool/config/ + dest: /data/docs/tool/conf.tar + format: tar + delegate_to: localhost + - name: archive backup config + archive: + path: /data/Goleaf/config/ + dest: /data/Goleaf/confbak.tar + format: tar + ignore_errors: yes + - name: copy tar + copy: + src: /data/docs/tool/conf.tar + dest: /data/Goleaf/conf.tar + - name: unarchive config + unarchive: + src: /data/Goleaf/conf.tar + dest: /data/Goleaf/config/ + remote_src: yes + # extra_opts: [--overwrite] + - name: remove tar + shell: rm -f /data/Goleaf/conf.tar