commit e780ed1f5be250fc0792e95700667ba3c5874609 Author: hahwu <31872165+hahwu@users.noreply.github.com> Date: Thu Nov 21 19:46:49 2024 +0800 版本更新 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4f1ab8e --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +/log +/config +/Goleaf +Goleaf.tar +source/main diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..1e78538 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "ansible.python.interpreterPath": "c:\\Users\\U\\AppData\\Local\\Microsoft\\WindowsApps\\python3.12.exe" +} \ No newline at end of file diff --git a/pack.sh b/pack.sh new file mode 100644 index 0000000..a8dfb91 --- /dev/null +++ b/pack.sh @@ -0,0 +1,2 @@ +cd /data/pet_home/src/server +GOOS=linux GOARCH=amd64 go build -o /data/devops/source/main main.go diff --git a/playbook/goleaf-com.yml b/playbook/goleaf-com.yml new file mode 100644 index 0000000..dbdeabd --- /dev/null +++ b/playbook/goleaf-com.yml @@ -0,0 +1,36 @@ +--- +- name: Deploy GoLeaf release + hosts: compose + remote_user: root + + tasks: + + # - name: copy + # copy: + # src: /data/devops/Goleaf.tar + # dest: /usr/local + # - name: tar + # command: tar -xvf /usr/local/Goleaf.tar -C /usr/local/ + - name: sh pack.sh + shell: sh /data/devops/pack.sh + delegate_to: localhost + + - name: copy goleaf + copy: + src: /data/devops/source/main + dest: /usr/local/Goleaf + + - name: copy config + copy: + src: /data/docs/tool/out/ + dest: /usr/local/Goleaf/gamedata/config/ + mode: '0777' + + + # - name: restart goleaf + # command: sh /usr/local/Goleaf/Restart.sh restart + # register: restart_result + + # - name: show restart result + # debug: + # var: restart_result.stdout_lines diff --git a/playbook/goleaf.yml b/playbook/goleaf.yml new file mode 100644 index 0000000..60eb8a4 --- /dev/null +++ b/playbook/goleaf.yml @@ -0,0 +1,29 @@ +--- +- name: Deploy GoLeaf release + hosts: test + remote_user: root + + tasks: + - name: sh pack.sh + shell: sh /data/devops/pack.sh + delegate_to: localhost + + - name: copy goleaf + copy: + src: /data/devops/source/main + dest: /usr/local/Goleaf + + - name: copy config + copy: + src: /data/docs/tool/out/ + dest: /usr/local/Goleaf/gamedata/config/ + mode: '0777' + + + - name: restart goleaf + command: sh /usr/local/Goleaf/Restart.sh restart + register: restart_result + + - name: show restart result + debug: + var: restart_result.stdout_lines diff --git a/playbook/hosts b/playbook/hosts new file mode 100644 index 0000000..9481a75 --- /dev/null +++ b/playbook/hosts @@ -0,0 +1,8 @@ +[test] +test ansible_ssh_host=1.15.182.107 ansible_ssh_user="root" ansible_ssh_port=22 + +[compose] +center ansible_ssh_host=172.20.0.2 ansible_ssh_user="root" ansible_ssh_port=22 +zone1 ansible_ssh_host=172.20.0.3 ansible_ssh_user="root" ansible_ssh_port=22 +zone2 ansible_ssh_host=172.20.0.4 ansible_ssh_user="root" ansible_ssh_port=22 + diff --git a/script/mysql.py b/script/mysql.py new file mode 100644 index 0000000..4e97a43 --- /dev/null +++ b/script/mysql.py @@ -0,0 +1,55 @@ +import pymysql +from sshtunnel import SSHTunnelForwarder +from pymysql.converters import escape_string +from ruamel.yaml import YAML +import math + + +UUID = 600000500823 + + + +# ===================config=================== + + +server = SSHTunnelForwarder( + ssh_address_or_host=("1.15.182.107", 22), + ssh_username="root", + ssh_password="`NS?VGg@7]~F3}p", + remote_bind_address=("127.0.0.1",3306), + local_bind_address=('127.0.0.1',5143) +) +server.start() +db_host = server.local_bind_host +db_port = server.local_bind_port +RID = 100016 +MYRID = 100002 + +conn = pymysql.connect( + host=db_host, + port=db_port, + user="root", + password="Z4rf7eZZe500dxa", + database="Merge_Pet" +) +cursor = conn.cursor() +cursor.execute(("select * from t_player_mod where dwUin = {rid}").format(rid = RID)) +result1 = cursor.fetchone() + +conn1 = pymysql.connect( + host="127.0.0.1", + port=3306, + user="root", + password="root", + database='Merge_Pet' +) +cursor1 = conn1.cursor() +sql = "UPDATE t_player_mod SET mData = %s WHERE dwUin = %s" +cursor1.execute(sql, (result1[1], MYRID)) +conn1.commit() + +cursor.close() +conn.close() +cursor1.close() +conn1.close() +exit() \ No newline at end of file diff --git a/script/thrift.exe b/script/thrift.exe new file mode 100644 index 0000000..f17b926 Binary files /dev/null and b/script/thrift.exe differ diff --git a/script/tools.ipynb b/script/tools.ipynb new file mode 100644 index 0000000..e69de29 diff --git a/source/ansible.sh b/source/ansible.sh new file mode 100644 index 0000000..ad4734e --- /dev/null +++ b/source/ansible.sh @@ -0,0 +1,10 @@ +yum -y install python3 git +echo "export LANG=en_US.UTF-8" >> /etc/profile +echo "export PATH=$PATH:/usr/local/ansible-2.2.1.0/build/scripts-3.6:/usr/local/go/bin" >> /etc/profile +echo "export GOPATH=$HOME/go" >> /etc/profile +source /etc/profile +pip3 install --upgrade pip -i https://pypi.tuna.tsinghua.edu.cn/simple --user +pip3 install ansible -i https://pypi.tuna.tsinghua.edu.cn/simple --user +curl -fsSL https://rpm.nodesource.com/setup_16.x | bash - +yum install nodejs -y +yum clean all && rm -rf /var/cache/yum \ No newline at end of file diff --git a/source/go1.23.1.linux-amd64.tar.gz b/source/go1.23.1.linux-amd64.tar.gz new file mode 100644 index 0000000..c5befc2 Binary files /dev/null and b/source/go1.23.1.linux-amd64.tar.gz differ