Giter Club home page Giter Club logo

easy-mock-docker's Introduction

docker-compose 文件内容

version: "3.3"
services:
  mongodb:
    image: mongo:3.4
    volumes:
      - type: bind
        source: ./data/db # 数据库文件存放地址,根据需要修改为本地地址
        target: /data/db
  redis:
    image: redis:4.0.6
    command: redis-server --appendonly yes
    volumes:
      - type: bind
        source: ./data/redis # redis 数据文件存放地址,根据需要修改为本地地址
        target: /data
  web:
    image: easymock/easymock:1.6.0
    command: /bin/bash -c "npm start"
    links:
      - mongodb:mongodb
      - redis:redis
    ports:
      - 7300:7300
    volumes:
      - type: bind 
        source: ./logs # 日志地址,根据需要修改为本地地址
        target: /home/easy-mock/easy-mock/logs
      - type: bind
        source: ./production.json # 配置地址,请使用本地配置地址替换
        target: /home/easy-mock/easy-mock/config/production.json

使用方式

  1. 安装 docker-compose
  2. 新建文件 docker-compose.yml 并将上面 docker-compose 文件内容复制进入 docker-compose.yml,然后将内容中注释位置替换为自己需要的本地地址即可。主要有三个需要替换的地方,数据库文件存储位置,日志文件存储位置,自定义配置文件本地地址。
  3. 启动:docker-compose up -d

自定义配置参考 easymock readme 中的配置小节。

注意

  • 使用容器方式运行不需要指定 dbredis 参数
  • production.json 配置中注意以下问题
{
  "port": 7300,
  "host": "0.0.0.0",
  "pageSize": 30,
  "proxy": false,
  "db": "mongodb://mongodb/easy-mock" # host 请务必替换为mongodb, 而非 localhost
  "unsplashClientId": "",
  "redis": {
    "keyPrefix": "[Easy Mock]",
    "port": 6379,
    "host": "redis", // 请勿使用 localhost,换 "redis"
    "password": "",
    "db": 0
  },
  ......
  ......
}

easy-mock-docker's People

Contributors

duanpengfei avatar yangchao0033 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.