surl/README.MD
2024-08-06 10:28:41 +08:00

43 lines
1.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# surl
短链接生成系统, 基于`Spring Boot`后端
## 配置项
- 数据库类型: `POSTGRESQL`
- 缓存中间件: `REDIS`
### 环境变量
- `PROTOCOL`: 外链协议, 可选, 默认http
- `HOST`: 主机, 可选, 默认localhost
- `PORT`: 端口, 可选, 默认18888
- `DB_HOST`: 数据库主机, 必选
- `DB_PORT`: 数据库主机端口, 可选, 默认5432
- `DB_PASS`: 数据库密码, 必选
- `REDIS_HOST`: `REDIS`主机, 必选
- `SECRET_KEY`: `TOKEN`密钥, 可选, 默认随机生成
## 部署
### Docker
1. 准备环境:
- `docker`
- `openjdk 21`
2. 编译jar包
- `chmod +x gradlew`
- `./gradlew clean build`
3. 构建镜像: `docker build -t surl .`
4. 修改`docker-compose.yml`中的环境变量(务必修改数据库密码)
5. 运行容器: `docker compose up -d`
### 主机部署
1. 准备环境:
- `openjdk 21`
- `postgresql`
- `redis`
2. 配置环境变量
3. 编译:
- `chmod +x gradlew`
- `./gradlew clean build`
4. 运行:`java -jar build/libs/surl-0.0.1-SNAPSHOT.jar`