mirror of
https://github.com/Sagit-chu/flvx.git
synced 2026-09-30 08:16:37 +08:00
init
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
# 使用nginx作为基础镜像
|
||||
FROM nginx:alpine
|
||||
|
||||
# 安装envsubst工具
|
||||
RUN apk add --no-cache gettext
|
||||
|
||||
# 复制nginx配置模板
|
||||
COPY nginx.conf.template /etc/nginx/nginx.conf.template
|
||||
|
||||
# 复制预打包的dist文件夹
|
||||
COPY dist /usr/share/nginx/html
|
||||
|
||||
# 创建运行时配置脚本
|
||||
COPY docker-entrypoint.sh /docker-entrypoint.sh
|
||||
RUN chmod +x /docker-entrypoint.sh
|
||||
|
||||
# 暴露端口
|
||||
EXPOSE 80
|
||||
|
||||
# 使用自定义启动脚本
|
||||
ENTRYPOINT ["/docker-entrypoint.sh"]
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
Binary file not shown.
@@ -0,0 +1,4 @@
|
||||
window.APP_CONFIG = {
|
||||
VUE_APP_API_URL: "${VUE_APP_API_URL}",
|
||||
VUE_APP_WS_URL: "${VUE_APP_WS_URL}"
|
||||
}
|
||||
Executable
+222
@@ -0,0 +1,222 @@
|
||||
#!/bin/bash
|
||||
|
||||
# 颜色定义
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
# 获取脚本所在目录
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
|
||||
# 显示帮助信息
|
||||
show_help() {
|
||||
echo "Gost转发面板 Docker Compose 部署脚本"
|
||||
echo ""
|
||||
echo "用法: $0 [命令] [选项]"
|
||||
echo ""
|
||||
echo "命令:"
|
||||
echo " start 启动所有服务"
|
||||
echo " stop 停止所有服务"
|
||||
echo " restart 重启所有服务"
|
||||
echo " build 重新构建前端镜像"
|
||||
echo " logs 查看服务日志"
|
||||
echo " status 查看服务状态"
|
||||
echo " clean 清理未使用的容器和镜像"
|
||||
echo ""
|
||||
echo "选项:"
|
||||
echo " -h, --help 显示此帮助信息"
|
||||
echo ""
|
||||
echo "环境变量配置:"
|
||||
echo " VUE_APP_API_URL 前端API地址 (默认: http://localhost:6365/api/v1)"
|
||||
echo " VUE_APP_WS_URL WebSocket地址 (默认: ws://localhost:6365)"
|
||||
echo ""
|
||||
echo "示例:"
|
||||
echo " # 启动服务"
|
||||
echo " $0 start"
|
||||
echo ""
|
||||
echo " # 自定义服务器地址启动"
|
||||
echo " VUE_APP_API_URL=http://192.168.1.100:6365/api/v1 VUE_APP_WS_URL=ws://192.168.1.100:6365 $0 start"
|
||||
}
|
||||
|
||||
# 检查docker和docker-compose是否安装
|
||||
check_dependencies() {
|
||||
if ! command -v docker &> /dev/null; then
|
||||
echo -e "${RED}错误: Docker 未安装${NC}"
|
||||
echo "请先安装Docker: https://docs.docker.com/get-docker/"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! command -v docker-compose &> /dev/null; then
|
||||
echo -e "${RED}错误: Docker Compose 未安装${NC}"
|
||||
echo "请先安装Docker Compose: https://docs.docker.com/compose/install/"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# 从docker-compose.yml读取端口配置
|
||||
get_service_port() {
|
||||
local service=$1
|
||||
local port_line=$(grep -A 10 "^ $service:" docker-compose.yml | grep -E "^\s+ports:" -A 1 | tail -1)
|
||||
if [[ $port_line =~ \"([0-9]+):[0-9]+\" ]]; then
|
||||
echo "${BASH_REMATCH[1]}"
|
||||
elif [[ $port_line =~ ([0-9]+):[0-9]+ ]]; then
|
||||
echo $(echo $port_line | cut -d':' -f1 | tr -d ' "')
|
||||
fi
|
||||
}
|
||||
|
||||
# 从docker-compose.yml读取数据库配置
|
||||
get_db_config() {
|
||||
local config_key=$1
|
||||
local config_value=$(grep -A 20 "environment:" docker-compose.yml | grep "$config_key:" | head -1 | cut -d':' -f2 | cut -d'#' -f1 | xargs)
|
||||
echo "$config_value"
|
||||
}
|
||||
|
||||
# 启动服务
|
||||
start_services() {
|
||||
echo -e "${GREEN}启动Gost转发面板服务...${NC}"
|
||||
|
||||
# 设置默认环境变量
|
||||
export VUE_APP_API_URL=${VUE_APP_API_URL:-"http://localhost:6365/api/v1"}
|
||||
export VUE_APP_WS_URL=${VUE_APP_WS_URL:-"ws://localhost:6365"}
|
||||
|
||||
echo -e "${YELLOW}环境变量配置:${NC}"
|
||||
echo "VUE_APP_API_URL: $VUE_APP_API_URL"
|
||||
echo "VUE_APP_WS_URL: $VUE_APP_WS_URL"
|
||||
echo ""
|
||||
|
||||
# 切换到脚本目录
|
||||
cd "$SCRIPT_DIR"
|
||||
|
||||
docker-compose up -d
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
echo -e "${GREEN}服务启动成功!${NC}"
|
||||
echo ""
|
||||
|
||||
# 从配置文件读取端口信息
|
||||
FRONTEND_PORT=$(get_service_port "frontend")
|
||||
BACKEND_PORT=$(get_service_port "backend")
|
||||
MYSQL_PORT=$(get_service_port "mysql")
|
||||
REDIS_PORT=$(get_service_port "redis")
|
||||
|
||||
# 从配置文件读取数据库配置
|
||||
DB_USER=$(get_db_config "MYSQL_USER")
|
||||
DB_PASSWORD=$(get_db_config "MYSQL_PASSWORD")
|
||||
|
||||
echo -e "${YELLOW}访问地址:${NC}"
|
||||
echo " 前端界面: http://localhost:${FRONTEND_PORT:-80}"
|
||||
echo " 后端API: http://localhost:${BACKEND_PORT:-6365}"
|
||||
echo " 数据库: localhost:${MYSQL_PORT:-3306} (用户名: ${DB_USER:-gost}, 密码: ${DB_PASSWORD:-pwd})"
|
||||
echo " Redis: localhost:${REDIS_PORT:-6379}"
|
||||
echo ""
|
||||
echo -e "${YELLOW}默认管理员账号:${NC}"
|
||||
echo " 用户名: admin_user"
|
||||
echo " 密码: admin_user"
|
||||
echo ""
|
||||
echo -e "${GREEN}部署完成!${NC}"
|
||||
else
|
||||
echo -e "${RED}服务启动失败!${NC}"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# 停止服务
|
||||
stop_services() {
|
||||
echo -e "${YELLOW}停止所有服务...${NC}"
|
||||
cd "$SCRIPT_DIR"
|
||||
docker-compose down
|
||||
echo -e "${GREEN}服务已停止${NC}"
|
||||
}
|
||||
|
||||
# 重启服务
|
||||
restart_services() {
|
||||
echo -e "${YELLOW}重启所有服务...${NC}"
|
||||
cd "$SCRIPT_DIR"
|
||||
docker-compose restart
|
||||
echo -e "${GREEN}服务重启完成${NC}"
|
||||
}
|
||||
|
||||
# 重新构建前端
|
||||
build_frontend() {
|
||||
echo -e "${YELLOW}重新构建前端镜像...${NC}"
|
||||
cd "$SCRIPT_DIR"
|
||||
docker-compose build frontend --no-cache
|
||||
echo -e "${GREEN}前端镜像构建完成${NC}"
|
||||
}
|
||||
|
||||
# 查看日志
|
||||
show_logs() {
|
||||
cd "$SCRIPT_DIR"
|
||||
docker-compose logs -f
|
||||
}
|
||||
|
||||
# 查看状态
|
||||
show_status() {
|
||||
cd "$SCRIPT_DIR"
|
||||
docker-compose ps
|
||||
}
|
||||
|
||||
# 清理未使用的容器和镜像
|
||||
clean_docker() {
|
||||
echo -e "${YELLOW}清理未使用的Docker资源...${NC}"
|
||||
docker system prune -f
|
||||
echo -e "${GREEN}清理完成${NC}"
|
||||
}
|
||||
|
||||
# 完全清理(包括数据卷)
|
||||
clean_all() {
|
||||
echo -e "${RED}警告: 这将删除所有数据,包括数据库!${NC}"
|
||||
read -p "确定要继续吗?(y/N): " -n 1 -r
|
||||
echo
|
||||
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||
cd "$SCRIPT_DIR"
|
||||
docker-compose down -v
|
||||
docker system prune -f
|
||||
echo -e "${GREEN}完全清理完成${NC}"
|
||||
else
|
||||
echo "操作已取消"
|
||||
fi
|
||||
}
|
||||
|
||||
# 主程序
|
||||
main() {
|
||||
check_dependencies
|
||||
|
||||
case "${1:-start}" in
|
||||
start)
|
||||
start_services
|
||||
;;
|
||||
stop)
|
||||
stop_services
|
||||
;;
|
||||
restart)
|
||||
restart_services
|
||||
;;
|
||||
build)
|
||||
build_frontend
|
||||
;;
|
||||
logs)
|
||||
show_logs
|
||||
;;
|
||||
status)
|
||||
show_status
|
||||
;;
|
||||
clean)
|
||||
clean_docker
|
||||
;;
|
||||
clean-all)
|
||||
clean_all
|
||||
;;
|
||||
-h|--help)
|
||||
show_help
|
||||
;;
|
||||
*)
|
||||
echo -e "${RED}未知命令: $1${NC}"
|
||||
show_help
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
main "$@"
|
||||
Vendored
+1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Vendored
BIN
Binary file not shown.
|
After Width: | Height: | Size: 4.2 KiB |
Binary file not shown.
Binary file not shown.
Vendored
+1
@@ -0,0 +1 @@
|
||||
<!doctype html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no"><link rel="icon" href="favicon.ico"><title>gost</title><script src="/config.js"></script><script defer="defer" src="js/chunk-vendors.d034d5e6.js"></script><script defer="defer" src="js/app.9855802f.js"></script><link href="css/chunk-vendors.77489a8d.css" rel="stylesheet"><link href="css/app.f163900c.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but gost doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div></body></html>
|
||||
Vendored
+2
File diff suppressed because one or more lines are too long
+1
File diff suppressed because one or more lines are too long
+61
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,99 @@
|
||||
services:
|
||||
mysql:
|
||||
image: mysql:8.0
|
||||
container_name: gost-mysql
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: rootpwd # 数据库密码
|
||||
MYSQL_DATABASE: gost # 数据库名
|
||||
MYSQL_USER: gost # 数据库用户
|
||||
MYSQL_PASSWORD: pwd # 数据库密码
|
||||
TZ: Asia/Shanghai
|
||||
ports:
|
||||
- "3306:3306"
|
||||
volumes:
|
||||
- mysql_data:/var/lib/mysql
|
||||
- ./gost.sql:/docker-entrypoint-initdb.d/init.sql:ro
|
||||
command: --default-authentication-plugin=mysql_native_password --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
|
||||
networks:
|
||||
- gost-network
|
||||
healthcheck:
|
||||
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
|
||||
timeout: 10s
|
||||
retries: 10
|
||||
|
||||
|
||||
redis:
|
||||
image: redis:alpine
|
||||
container_name: gost-redis
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "6379:6379"
|
||||
networks:
|
||||
- gost-network
|
||||
healthcheck:
|
||||
test: ["CMD", "redis-cli", "ping"]
|
||||
interval: 10s
|
||||
timeout: 3s
|
||||
retries: 5
|
||||
|
||||
|
||||
backend:
|
||||
image: openjdk:8-jre-alpine
|
||||
container_name: gost-backend
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
DB_HOST: mysql # 数据库地址
|
||||
DB_NAME: gost # 数据库名
|
||||
DB_USER: gost # 数据库用户
|
||||
DB_PASSWORD: pwd # 数据库密码
|
||||
JWT_SECRET: test123 # JWT密钥
|
||||
LOG_DIR: /app/logs # 日志目录
|
||||
SERVER_ADDR: 127.0.0.1:6365 # 服务器地址 ip:port 不能套cdn 用于节点连接
|
||||
JAVA_OPTS: "-Xms256m -Xmx512m -Dfile.encoding=UTF-8 -Duser.timezone=Asia/Shanghai"
|
||||
ports:
|
||||
- "6365:6365"
|
||||
volumes:
|
||||
- ./admin-0.0.1-SNAPSHOT.jar:/app/admin.jar:ro
|
||||
- ./applog:/app/logs
|
||||
command: sh -c "java $$JAVA_OPTS -jar /app/admin.jar"
|
||||
depends_on:
|
||||
mysql:
|
||||
condition: service_healthy
|
||||
redis:
|
||||
condition: service_healthy
|
||||
networks:
|
||||
- gost-network
|
||||
healthcheck:
|
||||
test: ["CMD", "sh", "-c", "wget --no-verbose --tries=1 --spider http://localhost:6365/flow/test || exit 1"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 5
|
||||
start_period: 60s
|
||||
|
||||
frontend:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile.vue
|
||||
container_name: gost-frontend
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "80:80"
|
||||
environment:
|
||||
BACKEND_HOST: backend # 后端地址
|
||||
BACKEND_PORT: 6365 # 后端端口
|
||||
VUE_APP_API_URL: http://localhost:6365/api/v1 # 前端API地址
|
||||
VUE_APP_WS_URL: ws://localhost:6365 # 前端WebSocket地址
|
||||
depends_on:
|
||||
backend:
|
||||
condition: service_healthy
|
||||
networks:
|
||||
- gost-network
|
||||
|
||||
volumes:
|
||||
mysql_data:
|
||||
driver: local
|
||||
|
||||
networks:
|
||||
gost-network:
|
||||
driver: bridge
|
||||
@@ -0,0 +1,25 @@
|
||||
#!/bin/sh
|
||||
|
||||
# 设置默认环境变量
|
||||
export BACKEND_HOST=${BACKEND_HOST:-backend}
|
||||
export BACKEND_PORT=${BACKEND_PORT:-6365}
|
||||
export VUE_APP_API_URL=${VUE_APP_API_URL:-"http://localhost:6365/api/v1"}
|
||||
export VUE_APP_WS_URL=${VUE_APP_WS_URL:-"ws://localhost:6365"}
|
||||
|
||||
echo "=== 容器启动配置 ==="
|
||||
echo "BACKEND_HOST: $BACKEND_HOST"
|
||||
echo "BACKEND_PORT: $BACKEND_PORT"
|
||||
echo "VUE_APP_API_URL: $VUE_APP_API_URL"
|
||||
echo "VUE_APP_WS_URL: $VUE_APP_WS_URL"
|
||||
echo "===================="
|
||||
|
||||
# 使用envsubst替换nginx配置中的环境变量
|
||||
envsubst '${BACKEND_HOST} ${BACKEND_PORT}' < /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf
|
||||
|
||||
# 使用envsubst替换前端配置文件中的环境变量
|
||||
envsubst '${VUE_APP_API_URL} ${VUE_APP_WS_URL}' < /usr/share/nginx/html/config.template.js > /usr/share/nginx/html/config.js
|
||||
|
||||
echo "配置文件已生成"
|
||||
|
||||
# 启动nginx
|
||||
exec "$@"
|
||||
@@ -0,0 +1,237 @@
|
||||
-- phpMyAdmin SQL Dump
|
||||
-- version 5.2.0
|
||||
-- https://www.phpmyadmin.net/
|
||||
--
|
||||
-- 主机: localhost
|
||||
-- 生成日期: 2025-06-12 15:03:23
|
||||
-- 服务器版本: 5.7.40-log
|
||||
-- PHP 版本: 7.4.33
|
||||
|
||||
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
|
||||
START TRANSACTION;
|
||||
SET time_zone = "+00:00";
|
||||
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||
/*!40101 SET NAMES utf8mb4 */;
|
||||
|
||||
--
|
||||
-- 数据库: `gost`
|
||||
--
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- 表的结构 `forward`
|
||||
--
|
||||
|
||||
CREATE TABLE `forward` (
|
||||
`id` int(10) NOT NULL,
|
||||
`user_id` int(10) NOT NULL,
|
||||
`user_name` varchar(100) NOT NULL,
|
||||
`name` varchar(100) NOT NULL,
|
||||
`tunnel_id` int(10) NOT NULL,
|
||||
`in_port` int(10) NOT NULL,
|
||||
`out_port` int(10) DEFAULT NULL,
|
||||
`remote_addr` varchar(100) NOT NULL,
|
||||
`in_flow` bigint(20) NOT NULL DEFAULT '0',
|
||||
`out_flow` bigint(20) NOT NULL DEFAULT '0',
|
||||
`created_time` bigint(20) NOT NULL,
|
||||
`updated_time` bigint(20) NOT NULL,
|
||||
`status` int(10) NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- 表的结构 `node`
|
||||
--
|
||||
|
||||
CREATE TABLE `node` (
|
||||
`id` int(10) NOT NULL,
|
||||
`name` varchar(100) NOT NULL,
|
||||
`secret` varchar(100) NOT NULL,
|
||||
`ip` varchar(100) NOT NULL DEFAULT '-',
|
||||
`port` int(10) NOT NULL,
|
||||
`created_time` bigint(20) NOT NULL,
|
||||
`updated_time` bigint(20) DEFAULT NULL,
|
||||
`status` int(10) NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- 表的结构 `speed_limit`
|
||||
--
|
||||
|
||||
CREATE TABLE `speed_limit` (
|
||||
`id` int(10) NOT NULL,
|
||||
`name` varchar(100) NOT NULL,
|
||||
`speed` int(10) NOT NULL,
|
||||
`tunnel_id` int(10) NOT NULL,
|
||||
`tunnel_name` varchar(100) NOT NULL,
|
||||
`created_time` bigint(20) NOT NULL,
|
||||
`updated_time` bigint(20) DEFAULT NULL,
|
||||
`status` int(10) NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- 表的结构 `tunnel`
|
||||
--
|
||||
|
||||
CREATE TABLE `tunnel` (
|
||||
`id` int(10) NOT NULL,
|
||||
`name` varchar(100) NOT NULL,
|
||||
`in_node_id` int(10) NOT NULL,
|
||||
`in_ip` varchar(100) NOT NULL,
|
||||
`in_port_sta` int(10) NOT NULL,
|
||||
`in_port_end` int(10) NOT NULL,
|
||||
`out_node_id` int(10) NOT NULL,
|
||||
`out_ip` varchar(100) NOT NULL,
|
||||
`out_ip_sta` int(10) NOT NULL,
|
||||
`out_ip_end` int(10) NOT NULL,
|
||||
`type` int(10) NOT NULL,
|
||||
`flow` int(10) NOT NULL,
|
||||
`created_time` bigint(20) NOT NULL,
|
||||
`updated_time` bigint(20) NOT NULL,
|
||||
`status` int(10) NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- 表的结构 `user`
|
||||
--
|
||||
|
||||
CREATE TABLE `user` (
|
||||
`id` int(10) NOT NULL,
|
||||
`name` varchar(100) NOT NULL,
|
||||
`user` varchar(100) NOT NULL,
|
||||
`pwd` varchar(100) NOT NULL,
|
||||
`role_id` int(10) NOT NULL,
|
||||
`exp_time` bigint(20) NOT NULL,
|
||||
`flow` bigint(20) NOT NULL,
|
||||
`in_flow` bigint(20) NOT NULL DEFAULT '0',
|
||||
`out_flow` bigint(20) NOT NULL DEFAULT '0',
|
||||
`flow_reset_time` bigint(20) NOT NULL,
|
||||
`num` int(10) NOT NULL,
|
||||
`created_time` bigint(20) NOT NULL,
|
||||
`updated_time` bigint(20) DEFAULT NULL,
|
||||
`status` int(10) NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
--
|
||||
-- 转存表中的数据 `user`
|
||||
--
|
||||
|
||||
INSERT INTO `user` (`id`, `name`, `user`, `pwd`, `role_id`, `exp_time`, `flow`, `in_flow`, `out_flow`, `flow_reset_time`, `num`, `created_time`, `updated_time`, `status`) VALUES
|
||||
(1, 'admin_user', 'admin_user', '3c85cdebade1c51cf64ca9f3c09d182d', 0, 1780480500000, 99999, 0, 0, 1, 99999, 1748914865000, 1749707064856, 1);
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- 表的结构 `user_tunnel`
|
||||
--
|
||||
|
||||
CREATE TABLE `user_tunnel` (
|
||||
`id` int(10) NOT NULL,
|
||||
`user_id` int(10) NOT NULL,
|
||||
`tunnel_id` int(10) NOT NULL,
|
||||
`speed_id` int(10) DEFAULT NULL,
|
||||
`num` int(10) NOT NULL,
|
||||
`flow` bigint(20) NOT NULL,
|
||||
`in_flow` bigint(20) NOT NULL DEFAULT '0',
|
||||
`out_flow` bigint(20) NOT NULL DEFAULT '0',
|
||||
`flow_reset_time` bigint(20) NOT NULL,
|
||||
`exp_time` bigint(20) NOT NULL,
|
||||
`status` int(10) NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
--
|
||||
-- 转储表的索引
|
||||
--
|
||||
|
||||
--
|
||||
-- 表的索引 `forward`
|
||||
--
|
||||
ALTER TABLE `forward`
|
||||
ADD PRIMARY KEY (`id`);
|
||||
|
||||
--
|
||||
-- 表的索引 `node`
|
||||
--
|
||||
ALTER TABLE `node`
|
||||
ADD PRIMARY KEY (`id`);
|
||||
|
||||
--
|
||||
-- 表的索引 `speed_limit`
|
||||
--
|
||||
ALTER TABLE `speed_limit`
|
||||
ADD PRIMARY KEY (`id`);
|
||||
|
||||
--
|
||||
-- 表的索引 `tunnel`
|
||||
--
|
||||
ALTER TABLE `tunnel`
|
||||
ADD PRIMARY KEY (`id`);
|
||||
|
||||
--
|
||||
-- 表的索引 `user`
|
||||
--
|
||||
ALTER TABLE `user`
|
||||
ADD PRIMARY KEY (`id`);
|
||||
|
||||
--
|
||||
-- 表的索引 `user_tunnel`
|
||||
--
|
||||
ALTER TABLE `user_tunnel`
|
||||
ADD PRIMARY KEY (`id`);
|
||||
|
||||
--
|
||||
-- 在导出的表使用AUTO_INCREMENT
|
||||
--
|
||||
|
||||
--
|
||||
-- 使用表AUTO_INCREMENT `forward`
|
||||
--
|
||||
ALTER TABLE `forward`
|
||||
MODIFY `id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=60;
|
||||
|
||||
--
|
||||
-- 使用表AUTO_INCREMENT `node`
|
||||
--
|
||||
ALTER TABLE `node`
|
||||
MODIFY `id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
|
||||
|
||||
--
|
||||
-- 使用表AUTO_INCREMENT `speed_limit`
|
||||
--
|
||||
ALTER TABLE `speed_limit`
|
||||
MODIFY `id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=28;
|
||||
|
||||
--
|
||||
-- 使用表AUTO_INCREMENT `tunnel`
|
||||
--
|
||||
ALTER TABLE `tunnel`
|
||||
MODIFY `id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;
|
||||
|
||||
--
|
||||
-- 使用表AUTO_INCREMENT `user`
|
||||
--
|
||||
ALTER TABLE `user`
|
||||
MODIFY `id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=20;
|
||||
|
||||
--
|
||||
-- 使用表AUTO_INCREMENT `user_tunnel`
|
||||
--
|
||||
ALTER TABLE `user_tunnel`
|
||||
MODIFY `id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=39;
|
||||
COMMIT;
|
||||
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
@@ -0,0 +1,87 @@
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
# 日志格式
|
||||
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||
'$status $body_bytes_sent "$http_referer" '
|
||||
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||
|
||||
access_log /var/log/nginx/access.log main;
|
||||
error_log /var/log/nginx/error.log warn;
|
||||
|
||||
sendfile on;
|
||||
tcp_nopush on;
|
||||
tcp_nodelay on;
|
||||
keepalive_timeout 65;
|
||||
types_hash_max_size 2048;
|
||||
|
||||
# gzip压缩
|
||||
gzip on;
|
||||
gzip_vary on;
|
||||
gzip_min_length 1024;
|
||||
gzip_proxied any;
|
||||
gzip_comp_level 6;
|
||||
gzip_types
|
||||
text/plain
|
||||
text/css
|
||||
text/xml
|
||||
text/javascript
|
||||
application/json
|
||||
application/javascript
|
||||
application/xml+rss
|
||||
application/atom+xml
|
||||
image/svg+xml;
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name _;
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
|
||||
# 静态文件缓存
|
||||
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
|
||||
expires 1y;
|
||||
add_header Cache-Control "public, immutable";
|
||||
}
|
||||
|
||||
# Vue Router的history模式支持
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
# API代理到后端
|
||||
location ^~ /api/v1/ {
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_pass http://${BACKEND_HOST}:${BACKEND_PORT}/api/v1/;
|
||||
}
|
||||
|
||||
# WebSocket代理 - system-info
|
||||
location /system-info {
|
||||
proxy_pass http://${BACKEND_HOST}:${BACKEND_PORT}/system-info;
|
||||
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
|
||||
# config.js 文件已经在容器启动时生成,这里只需要设置缓存策略
|
||||
location /config.js {
|
||||
add_header Cache-Control "no-cache, no-store, must-revalidate";
|
||||
add_header Pragma "no-cache";
|
||||
add_header Expires "0";
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user