Skip to content

Commit

Permalink
chore(makefile,dockerfile,docker-compose): add makefile, support fast…
Browse files Browse the repository at this point in the history
… up with no build, features todo list

add makefile, support fast up with no build, up , down,
etc...
readme
add features todo list, usage manual
  • Loading branch information
lihuacai168 committed Apr 29, 2023
1 parent 8eae72d commit 968c16d
Show file tree
Hide file tree
Showing 5 changed files with 134 additions and 9 deletions.
7 changes: 2 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,11 @@ RUN wget https://archive.apache.org/dist/jmeter/binaries/apache-jmeter-${JMETER_
rm apache-jmeter-${JMETER_VERSION}.tgz && \
chmod +x ${JMETER_HOME}/bin/jmeter

# 设置pip源为清华源
RUN mkdir -p /root/.pip && \
echo "[global]" > /root/.pip/pip.conf && \
echo "index-url = https://pypi.tuna.tsinghua.edu.cn/simple" >> /root/.pip/pip.conf
ARG PIP_INDEX_URL="https://pypi.org/simple"

# 安装项目依赖
COPY requirements.txt /app/requirements.txt
RUN pip install -r /app/requirements.txt
RUN pip install -r /app/requirements.txt -i ${PIP_INDEX_URL}

# 设置工作目录
WORKDIR /app
Expand Down
68 changes: 68 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@

compose-file := docker-compose.yml

ifdef COMPOSE_FILE
compose-file := $(COMPOSE_FILE)
endif

cmd = docker-compose -f $(compose-file)

image_tag ?= latest


tag := $(tag)

service := $(word 1,$(MAKECMDGOALS))

.PHONY: fastup
fastup:
export TAG=$(image_tag); docker-compose -f docker-compose-for-fastup.yml up -d --build --remove-orphans

.PHONY: up
up:
$(cmd) up -d --build --remove-orphans

.PHONY: up-no-build
up-no-build:
$(cmd) up -d --remove-orphans

.PHONY: up-tag
up-tag:
export TAG=$(tag); $(cmd) up -d --build --remove-orphans


.PHONY: down
down:
$(cmd) down

.PHONY: build
build:
# build latest
$(cmd) build

git-tag:
git checkout $(tag)

.PHONY: build-tag
build-tag:git-tag
export TAG=$(tag); $(cmd) build

.PHONY: config
config:
$(cmd) config

.PHONY: ps
ps:
$(cmd) ps

.PHONY: logs
logs:
$(cmd) logs -f fastapi_jmx

.PHONY: restart
restart:
$(cmd) restart $(service)

.PHONY: exec
exec:
$(cmd) exec $(service) /bin/bash
47 changes: 46 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,49 @@
Jmeter-Toolkit 是一个专门为 JMeter 测试管理而设计的强大工具集。
通过使用 FastAPI 和 Docker 构建,为用户提供了一个简洁、高效且可扩展的解决方案。
Jmeter-Toolkit 支持 JMX 文件的上传、执行、查看JMX、查看JTL以及HTML报告生成。
使您能够轻松地完成 JMeter 测试的整个流程。

- [x] **jmx文件上传**
- [x] **jmx文件执行**
- [x] **jmx文件查看**
- [x] **jtl文件查看**
- [x] **html报告生成**
- [ ] **合并jmx上传执行查看报告**
- [ ] **jtl文件上传**
- [ ] **jmx文件下载**
- [ ] **jtl文件下载**
- [ ] **jmx文件编辑**
- [ ] **jmx文件参数化**
- [ ] **前端界面化管理**
- [ ] **支持Jmeter插件**
- [ ] **分布式执行**
- [ ] **使用数据库管理文件**

# 快速启动
## 1. 安装 Docker
请参考 [Docker 官方文档](https://docs.docker.com/engine/install/) 安装 Docker。

## 2. 安装 Docker Compose
请参考 [Docker Compose 官方文档](https://docs.docker.com/compose/install/) 安装 Docker Compose。
注意:本项目 Docker Compose 仅支持 1.x 版本。
如果你的 Docker Compose 版本为 2.x,请参考 [Docker Compose 2.x 官方文档](https://docs.docker.com/compose/cli-command/)

## 3. 启动 Jmeter-Toolkit
### 3.1 不构建,直接拉取远程镜像快速启动
```shell
make
```

### 3.2 构建本地镜像并且启动
```shell
make up
```


## 4. 访问 Jmeter-Toolkit
http://localhost:18000/docs


# 使用步骤
## 1. 上传 JMX 文件
## 2. 执行 JMX 文件
## 3. 生成 HTML 报告
11 changes: 11 additions & 0 deletions docker-compose-for-fastup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: "3"

services:
fastapi_jmx:
image: rikasai/jmeter-toolkit:${TAG:-latest}
ports:
- "18000:8000"
volumes:
- ./jmx_files:/app/jmx_files
- ./jtl_files:/app/jtl_files

10 changes: 7 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
version: "3"
version: "3.8"

services:
fastapi_jmx:
build: .
image: fastapi_jmx:latest
image: jmeter-toolkit:latest
build:
context: .
dockerfile: Dockerfile
args:
PIP_INDEX_URL: ${PIP_INDEX_URL:-https://pypi.tuna.tsinghua.edu.cn/simple}
ports:
- "18000:8000"
volumes:
Expand Down

0 comments on commit 968c16d

Please sign in to comment.