添加 va_test 数据库
![[Pasted image 20250517105153.png]]

### 配置数据库权限

切换 root 账户权限
```bsh
sudo su
```

进入mysql 数据库容器中
```
docker exec -it fe8fde9961b2 /bin/bash
```

使用root账户登陆mysql
```bash
mysql -u root -p
# 输入密码
```

创建 va_test 数据库访问账户
```sql
CREATE USER 'bison'@'%' IDENTIFIED BY 'tNWFdPAk8iwNRTnc';
```

分配数据库操作权限
```sql
GRANT ALL PRIVILEGES ON bison.* TO 'bison'@'%';

FLUSH PRIVILEGES; 刷新数据库权限表
```

## 初始化数据库


导出指定的数据库：
```bash
sudo su
docker exec e78cd3bd7ffa mysqldump -uroot -p123456 bison | gzip > va_bison_2025-07-06.sql.gz
```

打开 /www/dk_project/dk_app/mysql/mysql_PfsC/data/ 路径；

上传初始化文件
![[va_bison_2025-07-06.sql.gz]]

切换 root 账户权限
```bsh
sudo su
```

执行初始化命令
```bash
gunzip -c /www/dk_project/dk_app/mysql/mysql_PfsC/data/va_bison_2025-07-06.sql.gz | docker exec -i fe8fde9961b2 mysql -ubison -ptNWFdPAk8iwNRTnc bison
```

## 部署

- 前端 /www/wwwroot/div_ottpay/ottpayhk
- 后端 /www/wwwroot/div_ottpay/ottpayhk_server

部署角色： root

创建node执行服务
![[Pasted image 20250706185644.png]]

编写nginx
```nginx
server
{
    listen 80;
    server_name ottpayhk.fusionpay.global;
    index index.html index.htm default.htm default.html;
    root /www/wwwroot/div_ottpay/ottpayhk/dist;
    
    #SSL-START SSL related configuration
    #error_page 404/404.html;
    
    #SSL-END
    
    #ERROR-PAGE-START  Error page related configuration
    #error_page 404 /404.html;
    #error_page 502 /502.html;
    #ERROR-PAGE-END
    
    
    #REWRITE-START Pseudo-static related configuration
    include /www/server/panel/vhost/rewrite/node_ottpayhk_server.conf;
    #REWRITE-END
    
    #Files or directories forbidden to access
    location ~ ^/(\.user.ini|\.htaccess|\.git|\.svn|\.project|LICENSE|README.md|package.json|package-lock.json|\.env|node_modules) {
        return 404;
    }
    
    #One-click application for SSL certificate verification directory related settings
    location /.well-known/ {
        root  /www/wwwroot/div_ottpay/ottpayhk_server;
    }

    # HTTP reverse proxy related settings begin >>>
    location ~ /purge(/.*) {
        proxy_cache_purge cache_one $host$request_uri$is_args$args;
    }

    location /api/ {
        proxy_pass http://127.0.0.1:38848/api/;
        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 REMOTE-HOST $remote_addr;
        add_header X-Cache $upstream_cache_status;

        proxy_connect_timeout 30s;
        proxy_read_timeout 86400s;
        proxy_send_timeout 30s;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }
    # End of HTTP reverse proxy related settings <<<
    
    access_log  /www/wwwlogs/ottpayhk_server.log;
    error_log  /www/wwwlogs/ottpayhk_server.error.log;
}
```