add db docker

This commit is contained in:
kingecg 2025-06-09 22:38:58 +08:00
parent 16a04dbb27
commit 5c7682c131
9 changed files with 2568 additions and 1296 deletions

1
.nvmrc Normal file
View File

@ -0,0 +1 @@
v22.14

3749
backend/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -14,17 +14,18 @@
"author": "",
"license": "ISC",
"dependencies": {
"@nestjs/common": "^9.4.3",
"@nestjs/core": "^9.4.3",
"@nestjs/common": "^11.1.3",
"@nestjs/core": "^11.1.3",
"@nestjs/passport": "^11.0.5",
"@nestjs/platform-express": "^9.4.3",
"@nestjs/platform-express": "^11.1.3",
"@nestjs/typeorm": "^11.0.0",
"bcrypt": "^6.0.0",
"class-validator": "^0.14.2",
"jsonwebtoken": "^9.0.2",
"passport": "^0.4.1",
"passport": "^0.7.0",
"passport-jwt": "^4.0.1",
"reflect-metadata": "^0.1.14",
"pg": "^8.16.0",
"reflect-metadata": "^0.2.2",
"rxjs": "^7.8.2",
"typeorm": "^0.3.24",
"uid": "^2.0.2"

View File

@ -8,7 +8,7 @@ import { PluginConfig } from './plugins/plugin-config.entity';
export const AppDataSource = new DataSource({
type: 'postgres',
host: process.env.POSTGRES_HOST || 'localhost',
port: parseInt(process.env.POSTGRES_PORT) || 5432,
port: 5432,
username: process.env.POSTGRES_USER || 'postgres',
password: process.env.POSTGRES_PASSWORD || 'postgres',
database: process.env.POSTGRES_DB || 'aiframe',

View File

@ -1,9 +1,9 @@
import { Entity, Column, OneToOne, JoinColumn } from 'typeorm';
import { Entity, Column, OneToOne, JoinColumn, PrimaryGeneratedColumn } from 'typeorm';
import { Workspace } from '../workspace/workspace.entity';
@Entity()
export class User {
@Column()
@PrimaryGeneratedColumn()
id!: number;
@Column({ unique: true })

BIN
db/1ms-helper Executable file

Binary file not shown.

40
db/README.md Normal file
View File

@ -0,0 +1,40 @@
# 1ms-helper
1ms-helper is a terminal-based application built with Go and the `tview` library. It provides a menu-driven interface for managing services and viewing logs.
## Features
- **Service Management**: Start and manage services.
- **Log Viewer**: View real-time logs.
## Requirements
- [颜色组件库github.com/gookit/color](github.com/gookit/color)
- [控制台库github.com/spf13/cobra](github.com/spf13/cobra)
## Installation
1. Clone the repository:
```sh
git clone https://cnb.cool/mliev/1ms.run/1ms-helper.git
```
2. Navigate to the project directory:
```sh
cd 1ms-helper
```
3. Install dependencies:
```sh
go mod tidy
```
## Usage
Run the application:
```sh
go run main.go
```
## 打包 提示:删除上次打包的dist目录
```shell
goreleaser release --snapshot --clean
```

15
db/docker-compose.yaml Normal file
View File

@ -0,0 +1,15 @@
version: '3.8'
services:
db:
image: postgres:latest
container_name: postgres_db
environment:
POSTGRES_DB: aiframe # 默认数据库名
POSTGRES_USER: postgres # 数据库用户名
POSTGRES_PASSWORD: postgres # 数据库密码
volumes:
- ./pgdata:/var/lib/postgresql/data # 挂载数据卷以持久化数据
ports:
- "5432:5432" # 映射端口,使得可以从主机访问
restart: always

42
db/set-reg.sh Executable file
View File

@ -0,0 +1,42 @@
#!/bin/bash
# 定义配置文件路径
CONFIG_FILE="/etc/containers/registries.conf"
# 检查是否具有足够的权限
if [ "$EUID" -ne 0 ]; then
echo "请使用 root 权限运行此脚本"
exit 1
fi
# 创建或备份现有的 registries.conf 文件
if [ -f "$CONFIG_FILE" ]; then
echo "备份现有的 $CONFIG_FILE${CONFIG_FILE}.bak"
cp "$CONFIG_FILE" "${CONFIG_FILE}.bak"
fi
cat <<EOF > "$CONFIG_FILE"
# registries.conf - v2 格式
# 支持国内镜像加速(如阿里云)
unqualified-search-registries = ["docker.mirrors.ustc.edu.cn"]
[[registry]]
prefix = "docker.io"
insecure = false
blocked = false
location = "docker.io"
[[registry.mirror]]
location = "docker.mirrors.ustc.edu.cn"
insecure = false
EOF
echo "已更新 $CONFIG_FILE,请重启 Podman 相关服务或重新运行 Podman 命令使更改生效。"
# 可选:验证配置是否正确加载
read -p "是否现在验证配置是否正确?(y/n) " answer
if [ "$answer" == "y" ]; then
podman info | grep registries
fi