Ubuntu 添加 i386 架构支持
sudo dpkg --add-architecture i386
sudo apt update
sudo apt install libstdc++6:i386 libgcc-s1:i386 libc6:i386
sudo dpkg --add-architecture i386
sudo apt update
sudo apt install libstdc++6:i386 libgcc-s1:i386 libc6:i386
rm -f /www/server/panel/data/ssl.pl && /etc/init.d/bt restart
Flyway 作用是基于 SQL 脚本的版本控制。将数据库的每次更改都编写为 SQL 脚本,并按版本号命名。Flyway 在应用启动时检查数据库中已应用的迁移版本,并按顺序执行所有新的迁移脚本。
引入下面的 maven 坐标
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-core</artifactId>
</dependency>
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-mysql</artifactId>
</dependency>
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>3.0.2</version>
</dependency>
在 application.yml
中配置下面的内容
spring:
datasource:
url: jdbc:mysql://localhost:3306/test_flyway
username: root
password: 数据库密码
flyway:
# 指定数据库迁移脚本的位置,classpath表示在资源目录下
locations: classpath:db/migration
# 启用Flyway功能
enabled: true
# 指定迁移脚本的编码格式为UTF-8
encoding: UTF-8
# 在迁移时验证已应用的迁移脚本是否被修改过
validate-on-migrate: true
# 当数据库是全新空库时,自动创建基线版本
baseline-on-migrate: true
准备脚本,在 src/main/resources
下创建 db/migration
目录
在 db/migration
目录下创建 V20250509__01_create_test-user.sql
sql 文件 ,注意 V20250509__01
这个中间是两个下划线
CREATE TABLE `test_user`
(
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '用户ID',
`username` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '用户账号',
`password` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '密码',
`nickname` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '用户昵称',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB
AUTO_INCREMENT = 146
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_unicode_ci COMMENT ='用户信息表';
执行后的结果
2025-05-09T11:46:07.609+08:00 INFO 37464 --- [ main] o.f.core.internal.command.DbValidate : Successfully validated 1 migration (execution time 00:00.020s)
2025-05-09T11:46:07.649+08:00 INFO 37464 --- [ main] o.f.c.i.s.JdbcTableSchemaHistory : Creating Schema History table `test_flyway`.`flyway_schema_history` ...
2025-05-09T11:46:07.814+08:00 INFO 37464 --- [ main] o.f.core.internal.command.DbMigrate : Current version of schema `test_flyway`: << Empty Schema >>
2025-05-09T11:46:07.855+08:00 INFO 37464 --- [ main] o.f.core.internal.command.DbMigrate : Migrating schema `test_flyway` to version "20250509 - 01 create test-user"
2025-05-09T11:46:07.974+08:00 INFO 37464 --- [ main] o.f.core.internal.command.DbMigrate : Successfully applied 1 migration to schema `test_flyway`, now at version v20250509 (execution time 00:00.193s)
...
services:
whisper-asr:
image: onerahmet/openai-whisper-asr-webservice:latest
environment:
ASR_MODEL: turbo # (tiny, base, small, medium, large-v3, etc.
ASR_ENGINE: faster_whisper # openai_whisper, faster_whisper, whisperx
ASR_DEVICE: cpu # or cuda 我是cpu服务器所以只能选 cpu
ASR_MODEL_PATH: /data/whisper
HF_ENDPOINT: https://hf-mirror.com # 使用 HF_ENDPOINT 作为国内镜像
volumes:
- ./data/whisper:/data/whisper
ports:
- 29000:9000 # 前面的 29000 可以修改,访问的时候记得调整端口即可
# docker-compose up -d
访问 ip:29000 即可看到 swagger 接口文档
注
[1] docker hub地址 https://hub.docker.com/r/onerahmet/openai-whisper-asr-webservice
[2] hf-mirror.com 致力于帮助国内AI开发者快速、稳定的下载模型、数据集
ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream()).password("123123").withTemplate(inputStream).build();
中的 .password("123123") 就是加密方法