1. 程式人生 > >docker安裝 hitchhiker --分散式壓力測試

docker安裝 hitchhiker --分散式壓力測試

hitchhiker介紹

Hitchhiker 是一款開源的 Restful Api 測試工具,支援Schedule, 資料對比,壓力測試,支援上傳指令碼定製請求,可以輕鬆部署到本地,和你的team成員一起管理Api。

下載

curl -O https://raw.githubusercontent.com/brookshi/Hitchhiker/release/deploy/docker/hitchhiker_and_mysql/docker-compose.yml -O https://raw.githubusercontent.com/brookshi/Hitchhiker/release/deploy/docker/hitchhiker_and_mysql/hitchhiker-mysql.cnf

在下載目錄下建立資料夾:

mkdir app
mkdir mysql

修改docker-compose.yml檔案

version: '2'
services:
  hitchhiker:
    image: brookshi/hitchhiker:v0.14
    container_name: hitchhiker
    restart: always
    environment:
      - HITCHHIKER_DB_HOST=hitchhiker-mysql
      - HITCHHIKER_APP_HOST=http://www.fenggese.com:8080/ # should change before deploying.
      - HITCHHIKER_DB_USERNAME=root
      - MYSQL_ROOT_PASSWORD=hitchhiker
      - MYSQL_DATABASE=hitchhiker-prod
      # add environment variable to config
    ports:
      - "8080:8080"
      - "11010:11010"
    links:
      - hitchhiker-mysql:hitchhiker-mysql
    volumes:
      - ./app/data:/usr/src/Hitchhiker/build/global_data/project
      - ./app/backup:/usr/src/Hitchhiker/build/backup
      - ./app/logs:/usr/src/Hitchhiker/build/logs

  hitchhiker-mysql:
    image: mysql:5.7
    container_name: hitchhiker-mysql
    restart: always
    environment:
      - MYSQL_ROOT_PASSWORD=hitchhiker
      - MYSQL_DATABASE=hitchhiker-prod
    volumes:
      - ./hitchhiker-mysql.cnf:/etc/mysql/conf.d/hitchhiker.cnf
      - ./mysql/data:/var/lib/mysql

pull

docker-compose pull

up

sudo docker-compose up -d

新增管理員

進入容器:docker exec -it mysql bash
進入mysql: mysql -u root -pxxx
新增使用者:

insert into user (id, name, password, email, isActive, isTemp) values(1, 'admin', 'password', '[email protected]', 1, 0);

訪問

在瀏覽器中訪問對應ip的8080埠即可。