Skip to content

Commit

Permalink
update the action
Browse files Browse the repository at this point in the history
  • Loading branch information
penndev committed Dec 7, 2023
1 parent b494242 commit b603948
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 20 deletions.
8 changes: 4 additions & 4 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
MODE=prod
KEY=123456
LISTEN=:8888
NGINX_PATH=/usr/bin/nginx
CACHE_DIR=/data
KEY=$apikey
LISTEN=$apiport
BIN_PATH=openresty
CACHE_DIR=$cachedir
CACHE_TASK_CYCLE=60
CACHE_DISK_LIMIT=90
DOCACHE_LIMIT_STSRT=80
Expand Down
17 changes: 16 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ jobs:
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/openresty.gpg] http://openresty.org/package/ubuntu $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/openresty.list > /dev/null
sudo apt-get update
sudo apt-get -y install openresty
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16
- name: Checkout Code
uses: actions/checkout@v4
- name: Build Golnag
Expand All @@ -37,9 +41,20 @@ jobs:
do
/usr/local/openresty/luajit/bin/luajit -b $file $file
done
- uses: actions/checkout@v4
with:
repository: 'penndev/veadmin'
path: './veadmin'
- name: Build dist
run: |
cd ./veadmin
npm install
npm run build-wafcdn
mv ./dist ../dist
cd ../
- name: Archive Files
run: |
tar -czvf wafcdn.tar.gz wafcdn .env.sample conf script dist
tar -czvf wafcdn.tar.gz conf script wafcdn dist .env.sample wafcdn.service
- name: Release
uses: softprops/action-gh-release@v1
with:
Expand Down
12 changes: 1 addition & 11 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,4 @@

## 环境安装

- https://openresty.org/cn/installation.html

- https://golang.google.cn/doc/install

- https://goproxy.cn/

- `ln -s /usr/local/openresty/nginx/sbin/nginx /usr/bin/nginx`

- `cp wafcdn.service /usr/lib/systemd/system/wafcdn.service`

- `systemctl stop firewalld`
自助安装脚本 https://gist.github.com/penndev/9f01b3864abe2368424d3a79f5efff7e
1 change: 1 addition & 0 deletions serve/listen.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ func Listen() {
if addr == "" {
panic("Cant get env LISTEN")
}
addr = ":" + addr
if os.Getenv("MODE") != "dev" {
gin.SetMode(gin.ReleaseMode)
}
Expand Down
4 changes: 2 additions & 2 deletions serve/util/nginx.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ func genNginxConfFile() {

func StartNginx() {
// 获取nginx的安装路径。
nginxPath := os.Getenv("NGINX_PATH")
nginxPath := os.Getenv("BIN_PATH")
if nginxPath == "" {
panic("cant find the NGINX_PATH")
panic("cant find the BIN_PATH")
}
// 生成nginx配置文件。
genNginxConfFile()
Expand Down
4 changes: 2 additions & 2 deletions wafcdn.service
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ After=network.target

[Service]
Type=simple
ExecStart=/home/wafcdn/wafcdn
WorkingDirectory=/home/wafcdn
ExecStart=$installpath/wafcdn
WorkingDirectory=$installpath

[Install]
WantedBy=multi-user.target

0 comments on commit b603948

Please sign in to comment.