From 5f9a8a15996cb9b166eb2d3cafffe43e449abbac Mon Sep 17 00:00:00 2001 From: shylinux Date: Tue, 21 Feb 2023 14:24:31 +0800 Subject: [PATCH] opt some --- Makefile | 25 ++++++------------------- etc/conf/nginx.conf | 19 +++++++++---------- etc/init.shy | 1 + go.mod | 10 +++++----- go.sum | 2 -- hi.sh | 7 ------- src/debug/go.mod | 10 +++++----- src/debug/go.sum | 2 -- src/main.shy | 2 +- src/release/go.mod | 7 +++++-- 10 files changed, 32 insertions(+), 53 deletions(-) delete mode 100644 hi.sh diff --git a/Makefile b/Makefile index e2a52392..e0052359 100644 --- a/Makefile +++ b/Makefile @@ -4,34 +4,21 @@ binarys = bin/ice.bin publish = usr/publish/ice.$(shell go env GOOS).$(shell go env GOARCH) all: def - @date + @echo && date go build -v -o ${binarys} src/main.go src/version.go src/binpack.go && ./${binarys} forever restart &>/dev/null mkdir -p $(dir ${publish}) &>/dev/null; rm ${publish} &>/dev/null; cp ${binarys} ${publish} -def: - @ [ -f src/version.go ] || echo "package main" > src/version.go - @ [ -f src/binpack.go ] || echo "package main" > src/binpack.go - -fmt: - gofmt -w usr/icebergs - goimports -w usr/icebergs - app: def CGO_ENABLED=1 go build -v -o usr/publish/contexts.app/Contents/MacOS/contexts src/webview.go src/version.go src/binpack.go && ./${binarys} forever restart &>/dev/null # hdiutil create usr/publish/tmp.dmg -ov -volname "ContextsInstall" -fs HFS+ -srcfolder "usr/publish/contexts.app" # rm -f usr/publish/ContextsInstall.dmg # hdiutil convert usr/publish/tmp.dmg -format UDZO -o usr/publish/ContextsInstall.dmg -arm: - GOOS=linux GOARCH=arm go build -o usr/publish/ice.linux.arm src/main.go src/version.go src/binpack.go - -mipsle: - GOOS=linux GOARCH=mipsle go build -o usr/publish/ice.linux.mipsle src/main.go src/version.go src/binpack.go - -docker: - docker image build -t $${PWD##*/} bin/ - %: src/%.go @echo && date - go build -v -o usr/publish/$@ src/$@.go && chmod u+x usr/publish/$@ + go build -v -o usr/publish/$@ src/$@.go src/version.go && chmod u+x usr/publish/$@ + +def: + @ [ -f src/version.go ] || echo "package main" > src/version.go + @ [ -f src/binpack.go ] || echo "package main" > src/binpack.go diff --git a/etc/conf/nginx.conf b/etc/conf/nginx.conf index 3b058635..e619cfc7 100644 --- a/etc/conf/nginx.conf +++ b/etc/conf/nginx.conf @@ -1,24 +1,23 @@ -worker_processes 1; -events { worker_connections 1024; } +worker_processes 1; +events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; - sendfile on; - proxy_buffering off; + sendfile on; + proxy_buffering off; keepalive_timeout 1800; - log_format access '[$time_local] $remote_addr' - ' "$request" "$http_referer" "$http_user_agent"' - ' $server_name $status $body_bytes_sent'; + log_format access '[$time_local] $remote_addr "$request" "$http_referer" "$http_user_agent" $server_name $status $body_bytes_sent'; access_log logs/access.log access; - upstream contexts { - server 127.0.0.1:9020; - } upstream contexts_repos { server 127.0.0.1:9030; + server 127.0.0.1:9020 backup; + } + upstream contexts { + server 127.0.0.1:9020; } server { diff --git a/etc/init.shy b/etc/init.shy index b9ca11f4..a4fb7c70 100644 --- a/etc/init.shy +++ b/etc/init.shy @@ -67,3 +67,4 @@ ~ssh target web.code source local.shy + diff --git a/go.mod b/go.mod index 632af932..67a841cd 100644 --- a/go.mod +++ b/go.mod @@ -24,13 +24,13 @@ require ( shylinux.com/x/redis-story v0.5.8 ) -require ( - shylinux.com/x/gogit v0.0.7 - shylinux.com/x/webview v0.0.2 -) - require ( shylinux.com/x/ice v1.3.0 shylinux.com/x/icebergs v1.5.4 shylinux.com/x/toolkits v0.7.4 ) + +require ( + shylinux.com/x/gogit v0.0.7 + shylinux.com/x/webview v0.0.2 +) diff --git a/go.sum b/go.sum index 99fd1a3a..fd41bc5c 100644 --- a/go.sum +++ b/go.sum @@ -4,8 +4,6 @@ shylinux.com/x/go-qrcode v0.0.2 h1:/c0PLj+1RT+kUPfnZVXwgbgH5m1SxBUjM2MIKXbDk+E= shylinux.com/x/go-qrcode v0.0.2/go.mod h1:TlzGBENHXy19xC3AsC6h4Vs5fx2ZuDA4TZ0U3C2OeK4= shylinux.com/x/go-sql-mysql v0.0.1 h1:VX5SrwLBKzfkRouj39LgJ9reIXOWmMsScRpr+e0qdp0= shylinux.com/x/go-sql-mysql v0.0.1/go.mod h1:47OfAZK24HRJMy7dAu/jrksGCf9yzJaAUFwWYjhDFDA= -shylinux.com/x/go-sql-mysql v0.0.2 h1:XcsMEF3KnFmRu6EmxIwIF6M1o2tD1NQvel3U9m+1Ap4= -shylinux.com/x/go-sql-mysql v0.0.2/go.mod h1:lHjRMZz5Lii6U+49fhkbCWgsnL+yux54SYJYWqASN8Y= shylinux.com/x/gogit v0.0.7 h1:2ep5QpXWLs0UBCywJuUHda/aagskYvFmn0nj3vpEdY4= shylinux.com/x/gogit v0.0.7/go.mod h1:wYfHxpQT1C8yNV+yC1jStIy0I12bfUCyJARhn0sNn1M= shylinux.com/x/golang-story v0.5.8 h1:HmP0VhtcVn/7RqMKNqstq9sLIJLGZpOGf2AphfoHJS8= diff --git a/hi.sh b/hi.sh deleted file mode 100644 index d3f9e146..00000000 --- a/hi.sh +++ /dev/null @@ -1,7 +0,0 @@ -#! /bin/sh -export ctx_dev=http://192.168.10.8:9020 ctx_pod= ctx_mod=web.code.hi.hi -temp=$(mktemp); if curl -h &>/dev/null; then - curl -o $temp -fsSL $ctx_dev -else - wget -O $temp -q $ctx_dev -fi && source $temp $ctx_mod diff --git a/src/debug/go.mod b/src/debug/go.mod index 632af932..67a841cd 100644 --- a/src/debug/go.mod +++ b/src/debug/go.mod @@ -24,13 +24,13 @@ require ( shylinux.com/x/redis-story v0.5.8 ) -require ( - shylinux.com/x/gogit v0.0.7 - shylinux.com/x/webview v0.0.2 -) - require ( shylinux.com/x/ice v1.3.0 shylinux.com/x/icebergs v1.5.4 shylinux.com/x/toolkits v0.7.4 ) + +require ( + shylinux.com/x/gogit v0.0.7 + shylinux.com/x/webview v0.0.2 +) diff --git a/src/debug/go.sum b/src/debug/go.sum index 99fd1a3a..fd41bc5c 100644 --- a/src/debug/go.sum +++ b/src/debug/go.sum @@ -4,8 +4,6 @@ shylinux.com/x/go-qrcode v0.0.2 h1:/c0PLj+1RT+kUPfnZVXwgbgH5m1SxBUjM2MIKXbDk+E= shylinux.com/x/go-qrcode v0.0.2/go.mod h1:TlzGBENHXy19xC3AsC6h4Vs5fx2ZuDA4TZ0U3C2OeK4= shylinux.com/x/go-sql-mysql v0.0.1 h1:VX5SrwLBKzfkRouj39LgJ9reIXOWmMsScRpr+e0qdp0= shylinux.com/x/go-sql-mysql v0.0.1/go.mod h1:47OfAZK24HRJMy7dAu/jrksGCf9yzJaAUFwWYjhDFDA= -shylinux.com/x/go-sql-mysql v0.0.2 h1:XcsMEF3KnFmRu6EmxIwIF6M1o2tD1NQvel3U9m+1Ap4= -shylinux.com/x/go-sql-mysql v0.0.2/go.mod h1:lHjRMZz5Lii6U+49fhkbCWgsnL+yux54SYJYWqASN8Y= shylinux.com/x/gogit v0.0.7 h1:2ep5QpXWLs0UBCywJuUHda/aagskYvFmn0nj3vpEdY4= shylinux.com/x/gogit v0.0.7/go.mod h1:wYfHxpQT1C8yNV+yC1jStIy0I12bfUCyJARhn0sNn1M= shylinux.com/x/golang-story v0.5.8 h1:HmP0VhtcVn/7RqMKNqstq9sLIJLGZpOGf2AphfoHJS8= diff --git a/src/main.shy b/src/main.shy index 67d14a51..4c431cac 100644 --- a/src/main.shy +++ b/src/main.shy @@ -26,7 +26,7 @@ https://www.w3schools.com/charsets/ref_html_utf8.asp chapter "实践" label ` code wiki chat team mall -linux nginx "context bg red" redis mysql +linux nginx docker redis mysql bash git golang vim tmux ` fg blue bg yellow diff --git a/src/release/go.mod b/src/release/go.mod index 9d2e5241..da39865c 100644 --- a/src/release/go.mod +++ b/src/release/go.mod @@ -11,9 +11,12 @@ require ( ) require ( - shylinux.com/x/gogit v0.0.7 - shylinux.com/x/ice v1.2.9 shylinux.com/x/icebergs v1.5.3 shylinux.com/x/toolkits v0.7.4 shylinux.com/x/webview v0.0.2 ) + +require ( + shylinux.com/x/gogit v0.0.7 + shylinux.com/x/ice v1.2.9 +)