blfm commited on
Commit
b066079
·
verified ·
1 Parent(s): 2a76f2d

Upload 2 files

Browse files
Files changed (3) hide show
  1. .gitattributes +1 -0
  2. git-batch +3 -0
  3. launch.sh +105 -0
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ git-batch filter=lfs diff=lfs merge=lfs -text
git-batch ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8ec18dafdbaaac6439d0b81aaec223ec2fcfc6dba4b71556b2dbd164b1f73c2d
3
+ size 10588160
launch.sh ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/sh
2
+
3
+ BASE=/home/node/app
4
+ USERNAME=$(printenv username)
5
+ PASSWORD=$(printenv password)
6
+
7
+ function env() {
8
+ if [[ ! -z "${fetch}" ]]; then
9
+ echo '远程获取参数...'
10
+ curl -s "$fetch" -o data.json
11
+ export github_secret=$(jq -r .github_secret data.json)
12
+ export github_project=$(jq -r .github_project data.json)
13
+ fi
14
+
15
+ if [[ -z "${USERNAME}" ]]; then
16
+ USERNAME="root"
17
+ fi
18
+
19
+ if [[ -z "${PASSWORD}" ]]; then
20
+ PASSWORD="123456"
21
+ fi
22
+
23
+ echo
24
+ echo "fetch = ${fetch}"
25
+ echo "github_secret = $github_secret"
26
+ echo "github_project = $github_project"
27
+ echo "USERNAME = ${USERNAME}"
28
+ echo "PASSWORD = ${PASSWORD}"
29
+ echo
30
+ echo
31
+
32
+ sed -i "s/\[github_secret\]/${github_secret}/g" launch.sh
33
+ sed -i "s#\[github_project\]#${github_project}#g" launch.sh
34
+ }
35
+
36
+ function init() {
37
+ mkdir ${BASE}/history
38
+ cd ${BASE}/history
39
+
40
+ git config --global user.email "[email protected]"
41
+ git config --global user.name "complete-Mmx"
42
+ git config --global init.defaultBranch main
43
+ git init
44
+ git remote add origin https://[github_secret]@github.com/[github_project].git
45
+ git add .
46
+ echo "'update history$(date "+%Y-%m-%d %H:%M:%S")'"
47
+ git commit -m "'update history$(date "+%Y-%m-%d %H:%M:%S")'"
48
+ git pull origin main
49
+
50
+ cd ${BASE}
51
+
52
+ DIR="${BASE}/history"
53
+ if [ "$(ls -A $DIR | grep -v .git)" ]; then
54
+ echo "Has history..."
55
+ else
56
+ echo "Empty history..."
57
+ cp -r data/* history/
58
+ cp -r secrets.json history/secrets.json
59
+ fi
60
+
61
+ rm -rf data
62
+ ln -s history data
63
+
64
+ rm -r config.yaml
65
+ cp config/config.yaml history/config.yaml
66
+ ln -s history/config.yaml config.yaml
67
+ sed -i "s/username: .*/username: \"${USERNAME}\"/" ${BASE}/config.yaml
68
+ sed -i "s/password: .*/password: \"${PASSWORD}\"/" ${BASE}/config.yaml
69
+ sed -i "s/whitelistMode: true/whitelistMode: false/" ${BASE}/config.yaml
70
+ sed -i "s/basicAuthMode: false/basicAuthMode: true/" ${BASE}/config.yaml
71
+ sed -i "s/enableServerPlugins: false/enableServerPlugins: true/" ${BASE}/config.yaml
72
+ cat config.yaml
73
+ echo "Init history."
74
+ chmod -R 777 history
75
+
76
+ nohup ./git-batch --commit 10s --name git-batch --email [email protected] --push 1m -p history > access.log 2>1 &
77
+ }
78
+
79
+ function release() {
80
+ rm -rf history
81
+ }
82
+
83
+ function update() {
84
+ cd ${BASE}/history
85
+ git pull origin main
86
+ git add .
87
+ echo "'update history$(date "+%Y-%m-%d %H:%M:%S")'"
88
+ git commit -m "'update history$(date "+%Y-%m-%d %H:%M:%S")'"
89
+ git push origin main
90
+ }
91
+
92
+ case $1 in
93
+ env)
94
+ env
95
+ ;;
96
+ init)
97
+ init
98
+ ;;
99
+ release)
100
+ release
101
+ ;;
102
+ update)
103
+ update
104
+ ;;
105
+ esac