当前位置: 首页 > 工具软件 > Dolores > 使用案例 >

rap2一键部署 (包括RAP2-DELOS与RAP2-DOLORES)

慎志国
2023-12-01

同事rap2部署折腾了好久。网上的部署方案都太复杂,简单的就是docker部署,但只有RAP2-DELOS部分,没有RAP2-DOLORES。虽然RAP2-DOLORES的部署比较简单,但研究部署还是有点麻烦。

所以我在大神原来rap2-delos的docker部署方案的基础上增加了RAP2-DOLORES。使用docker-compose统一部署。

不啰嗦,正文如下:

一、环境设定:

1、已安装docker

2、已安装docker-compose

3、安装服务器直接使用,没有ngnix等代理转换

4、服务器的38080,38081可访问

 

二、下载docker-compose.yml

1、点击下载 或创建docker-compose.yml文件复制以下内容

# mail@dongguochao.com
# sondx@qq.com

version: '2.2'

services:
  delos:
    container_name: rap2-delos
    # build from ./Dockerfile
#    build: .
    # build from images
    image: blackdog1987/rap2-delos:2.6.aa3be03
    environment:
      # if you have your own mysql, config it here, and disable the 'mysql' config blow
      - MYSQL_URL=rap2-mysql # links will maintain /etc/hosts, just use 'container_name'
      - MYSQL_PORT=3306
      - MYSQL_USERNAME=root
      - MYSQL_PASSWD=
      - MYSQL_SCHEMA=rap2

      # redis config
      - REDIS_URL=rap2-redis
      - REDIS_PORT=6379

      # production / development
      - NODE_ENV=production
    working_dir: /app
    privileged: true
    ###### 'sleep 30 && node scripts/init' will drop the tables
    ###### RUN ONLY ONCE THEN REMOVE 'sleep 30 && node scripts/init'
    command: /bin/sh -c 'sleep 30; node scripts/init; node dispatch.js'
    # init the databases
#    command: sleep 30 && node scripts/init && node dispatch.js
    # without init
#    command: node dispatch.js
    links:
      - redis
      - mysql
    depends_on:
      - redis
      - mysql
    ports:
      - "38080:8080"  # expose 38080

  redis:
    container_name: rap2-redis
    image: redis:4.0.9

  # disable this if you have your own mysql
  mysql:
    container_name: rap2-mysql
    image: mysql:5.7.22
    # expose 33306 to client (navicat)
    #ports:
    #   - 33306:3306
    volumes:
      # change './docker/mysql/volume' to your own path
      # WARNING: without this line, your data will be lost.
      - "/opt/docker_rap2/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=0
    environment:
      MYSQL_ALLOW_EMPTY_PASSWORD: "true"
      MYSQL_DATABASE: "rap2"
      MYSQL_USER: "root"
      MYSQL_PASSWORD: ""

  rap2-dolores:
    container_name: rap2-dolores
    image: sondx/rap2-dolores:V2.1.5.1
    ports:
      - 38081:80 #expose 38081
    environment:
      # change 'http://rap2-delos-address:38080' to your public RAP2API website address
      - RAP2API=http://rap2-delos-address:38080
    command: /bin/sh /app/run.sh

2、修改配置文件

1、必修改项:配置文件中的http://rap2-delos-address一定要修改成你自己安装的机器访问地址。可以是IP或则解析过的域名。

2、其他项请根据需求自行修改,可不修改

三、运行安装

在docker-compose.yml目录,运行以下命令:

docker-compose up -d

四、访问

访问地址:http://安装服务器地址:38081

 

 

 类似资料: