Skip to content

Commit

Permalink
增加部署文档
Browse files Browse the repository at this point in the history
  • Loading branch information
wangyiwy committed Jul 9, 2022
1 parent c9537d9 commit c7fa8b8
Show file tree
Hide file tree
Showing 8 changed files with 110 additions and 57 deletions.
37 changes: 37 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# 一个工具网站
![](shapshot.png)

# 编译
1. 安装 Golang
2. 安装 Git
3. 构建
```shell
git clone https://github.com/wangyiwy/oktools.git
cd oktools
go build
```
4. 修改配置文件
```shell
mv conf.yaml.default conf.yaml
vi conf.yaml
```
配置说明
```shell
app:
mode: release # debug / release
log-file: oktools.log # 日志文件路径

http:
port: 443 # 程序端口
ssl: # ssl 证书配置 , release 模式必须
crt: # example: /etc/oktools/oktools.net_nginx/oktools.net_bundle.crt
key: # example: /etc/oktools/oktools.net_nginx/oktools.net.key
```
6. 运行
```shell
sh start.sh
```
7. 停止
```shell
sh stop.sh
```
13 changes: 6 additions & 7 deletions conf.yaml.default
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
app:
mode: debug
log-file: oktools.log
mode: release # debug / release
log-file: oktools.log # 日志文件路径

http:
port: 80
ssl:
enable: false
crt:
key:
port: 443 # 程序端口
ssl: # ssl 证书配置 , release 模式必须
crt: # example: /etc/oktools/oktools.net_nginx/oktools.net_bundle.crt
key: # example: /etc/oktools/oktools.net_nginx/oktools.net.key
7 changes: 3 additions & 4 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ type App struct {
type Http struct {
Port string `yaml:"port"`
SSL struct {
Enable bool `yaml:"enable"`
Crt string `yaml:"crt"`
Key string `yaml:"key"`
Crt string `yaml:"crt"`
Key string `yaml:"key"`
} `yaml:"ssl"`
}

Expand Down Expand Up @@ -45,7 +44,7 @@ func init() {
LogFile: "oktools.log",
},
Http: Http{
Port: "8888",
Port: "80",
},
}
}
Expand Down
Binary file added shapshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
chmod +x oktools
nohup ./oktools >/dev/null 2>&1 &
8 changes: 8 additions & 0 deletions stop.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
pid=`ps -ef | grep oktools | grep -v grep | awk '{print $2}'`
if [ -z "pid" ];
then
echo "not found pid of oktools"
else
echo "found pid of oktools: $pid"
kill -9 $pid
fi
95 changes: 50 additions & 45 deletions templates/aside.html
Original file line number Diff line number Diff line change
@@ -1,47 +1,52 @@
{{define "aside"}}
<aside>
<h1 class="logo"><a href="/">OKTools</a></h1>
<nav class="side-nav">
<p>JSON</p>
<ul>
<li><a href="/json">JSON格式化</a></li>
<li><a href="/json2xml">JSON/XML转换</a></li>
<li><a href="/json2yaml">JSON/YAML转换</a></li>
<li><a href="/json2go">JSON转Go Struct</a></li>
</ul>
<p>Base64</p>
<ul>
<li><a href="/base64">Base64编码解码</a></li>
<li><a href="/image2base64">图片Base64编码</a></li>
</ul>
<p>转换</p>
<ul>
<li><a href="/timestamp">Unix时间戳</a></li>
<li><a href="/color">颜色值转换</a></li>
<li><a href="/number">进制转换</a></li>
<li><a href="/url">URL编码解码</a>
<li><a href="/unicode">Unicode编码转换</a></li>
<li><a href="/pdf2img">PDF转图片</a></li>
<li><a href="/morse">摩斯电码</a></li>
</ul>
<p>Hash</p>
<ul>
<li><a href="/hash">Hash计算</a></li>
<li><a href="/file-hash">文件Hash计算</a></li>
</ul>
<p>加密</p>
<ul>
<li><a href="/aes">AES加密解密</a></li>
<li><a href="/des">DES加密解密</a></li>
<li><a href="/rsa">RSA加密解密</a></li>
</ul>
<p>其他</p>
<ul>
<li><a href="/tinyimg">图片压缩</a></li>
<li><a href="/qrcode">二维码制作</a></li>
<li><a href="http://oktools.net/websocket">WebSocket测试</a></li>
<li><a href="/regex">正则表达式测试</a></li>
</ul>
</nav>
</aside>
<aside>
<h1 class="logo"><a href="/">OKTools</a></h1>
<nav class="side-nav">
<p>JSON</p>
<ul>
<li><a href="/json">JSON格式化</a></li>
<li><a href="/json2xml">JSON/XML转换</a></li>
<li><a href="/json2yaml">JSON/YAML转换</a></li>
<li><a href="/json2go">JSON转Go Struct</a></li>
</ul>
<p>Base64</p>
<ul>
<li><a href="/base64">Base64编码解码</a></li>
<li><a href="/image2base64">图片Base64编码</a></li>
</ul>
<p>转换</p>
<ul>
<li><a href="/timestamp">Unix时间戳</a></li>
<li><a href="/color">颜色值转换</a></li>
<li><a href="/number">进制转换</a></li>
<li><a href="/url">URL编码解码</a>
<li><a href="/unicode">Unicode编码转换</a></li>
<li><a href="/pdf2img">PDF转图片</a></li>
<li><a href="/morse">摩斯电码</a></li>
</ul>
<p>Hash</p>
<ul>
<li><a href="/hash">Hash计算</a></li>
<li><a href="/file-hash">文件Hash计算</a></li>
</ul>
<p>加密</p>
<ul>
<li><a href="/aes">AES加密解密</a></li>
<li><a href="/des">DES加密解密</a></li>
<li><a href="/rsa">RSA加密解密</a></li>
</ul>
<p>其他</p>
<ul>
<li><a href="/tinyimg">图片压缩</a></li>
<li><a href="/qrcode">二维码制作</a></li>
<li><a href="#" onclick="hrefForNoTLS('/websocket')">WebSocket测试</a></li>
<li><a href="/regex">正则表达式测试</a></li>
</ul>
</nav>
</aside>
<script>
function hrefForNoTLS(path) {
window.location.href = 'http://' + window.location.host + path;
}
</script>
{{end}}
5 changes: 4 additions & 1 deletion templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
<a class="tool" href="/qrcode"><p>二维码制作</p>
<p>https://oktools.net/qrcode</p>
</a>
<a class="tool" href="http://oktools.net/websocket"><p>WebSocket测试</p>
<a class="tool" href="#" onclick="hrefForNoTLS('/websocket')"><p>WebSocket测试</p>
<p>https://oktools.net/websocket</p>
</a>
<a class="tool" href="/regex"><p>正则表达式测试</p>
Expand All @@ -99,6 +99,9 @@
}
}
}
function hrefForNoTLS(path) {
window.location.href = 'http://' + window.location.host + path;
}
</script>
</body>
</html>

0 comments on commit c7fa8b8

Please sign in to comment.