RAP2工具的应用
安裝
docker-compose安裝
官網(wǎng)鏡像:https://github.com/thx/rap2-delos/blob/master/docker-compose.yml
官網(wǎng)鏡像中包括redis,mysql。已有環(huán)境,則把這些配置拿掉。
創(chuàng)建mysql數(shù)據(jù)庫(kù)
create database rap2 default character set utf8mb4; version: "3" services:# frontenddolores:image: rapteam/rap2-dolores:latestports:- 6000:38081# backenddelos:image: rapteam/rap2-delos:latestports:- 38080:38080environment:- SERVE_PORT=38080- MYSQL_URL=192.168.1.XXX- MYSQL_PORT=3306- MYSQL_USERNAME=XXXX- MYSQL_PASSWD=XXXXX- MYSQL_SCHEMA=rap2- REDIS_URL=192.168.1.XXX- REDIS_PORT=6379# production / development- NODE_ENV=dev###### 'sleep 30 && node scripts/init' will drop the tables###### RUN ONLY ONCE THEN REMOVE 'sleep 30 && node scripts/init'command: /bin/sh -c 'node dispatch.js'# init the databases#command: sleep 30s && node scripts/init && node dispatch.js# without init# command: node dispatch.js官方docker-compose文件有些問(wèn)題:
1、NODE_ENV 不是設(shè)置為:production / development,而是prod/dev。
2、sleep 30s && ,會(huì)提示 invalid number。
3、如果采用已存在mysql,則可以使用 node dispatch.js 啟動(dòng)。通過(guò)docker exec -it {containerid} sh 進(jìn)入容器,然后執(zhí)行命令進(jìn)行mysql初始化:
node scripts/init
redis,mysql相關(guān)。
depends_on:- redis- mysqlredis:image: redis:4# disable this if you have your own mysqlmysql:image: mysql:5.7# expose 33306 to client (navicat)#ports:# - 33306:3306volumes:# change './docker/mysql/volume' to your own path# WARNING: without this line, your data will be lost.- "./docker/mysql/volume:/var/lib/mysql"command: mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --init-connect='SET NAMES utf8mb4;' --innodb-flush-log-at-trx-commit=0environment:MYSQL_ALLOW_EMPTY_PASSWORD: "true"MYSQL_DATABASE: "rap2"MYSQL_USER: "root"MYSQL_PASSWORD: ""初始化數(shù)據(jù)
默認(rèn)會(huì)初始化一些測(cè)試數(shù)據(jù),刪除執(zhí)行以下腳本
truncate table default_val ; truncate table history_log ;truncate table loggers ;delete from interfaces ;truncate table notifications ; truncate table properties ; truncate table organizations_members ;truncate table repositories_collaborators ; truncate table repositories_members ; delete from modules ; delete from repositories ;delete from organizations ;delete from users where id >=100000001 and id <= 100000011 ;使用說(shuō)明
RAP2分為2部分,后端和前端,前端主要用于維護(hù)信息,后端用于提供功能接口,以及mock接口調(diào)用。
數(shù)據(jù)生成規(guī)則
https://github.com/nuysoft/Mock/wiki/Syntax-Specification
參考
https://github.com/thx/rap2-delos
數(shù)據(jù)生成規(guī)則參考:
? https://github.com/nuysoft/Mock/wiki/Syntax-Specification
? https://github.com/nuysoft/Mock/wiki
總結(jié)
- 上一篇: Docker容器的root用户
- 下一篇: ncat详细介绍