版本更新

This commit is contained in:
hahwu 2024-11-21 19:46:49 +08:00
commit e780ed1f5b
11 changed files with 148 additions and 0 deletions

5
.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
/log
/config
/Goleaf
Goleaf.tar
source/main

3
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,3 @@
{
"ansible.python.interpreterPath": "c:\\Users\\U\\AppData\\Local\\Microsoft\\WindowsApps\\python3.12.exe"
}

2
pack.sh Normal file
View File

@ -0,0 +1,2 @@
cd /data/pet_home/src/server
GOOS=linux GOARCH=amd64 go build -o /data/devops/source/main main.go

36
playbook/goleaf-com.yml Normal file
View File

@ -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

29
playbook/goleaf.yml Normal file
View File

@ -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

8
playbook/hosts Normal file
View File

@ -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

55
script/mysql.py Normal file
View File

@ -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()

BIN
script/thrift.exe Normal file

Binary file not shown.

0
script/tools.ipynb Normal file
View File

10
source/ansible.sh Normal file
View File

@ -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

Binary file not shown.