https://github.com/thx/rap2-delos
yum install -y yum-utils device-mapper-persistent-data lvm2
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum install -y docker-ce
systemctl enable docker
systemctl start docker
yum install -y bash-completion
source /usr/share/bash-completion/bash_completion
source /usr/share/bash-completion/completions/docker
curl -L "https://github.com/docker/compose/releases/download/v2.9.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
mkdir -p /opt/rap && cd /opt/rap
vim docker-compose.yml
写入下面的配置文件
version: "3"
services:
dolores:
image: rapteam/rap2-dolores:latest
ports:
- 3000:38081
networks:
- rap2-network
delos:
image: rapteam/rap2-delos:latest
ports:
- 38080:38080
environment:
- SERVE_PORT=38080
- MYSQL_URL=mysql
- MYSQL_PORT=3306
- MYSQL_ROOT_PASSWORD=hk1238888 # 设置 root 用户的密码
- MYSQL_SCHEMA=rap2
- REDIS_URL=redis
- REDIS_PORT=6379
- NODE_ENV=production
command: /bin/sh -c 'node dispatch.js'
depends_on:
- redis
- mysql
networks:
- rap2-network
redis:
image: redis:4
networks:
- rap2-network
mysql:
image: mysql:5.7
volumes:
- "./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=0
environment:
MYSQL_ALLOW_EMPTY_PASSWORD: "true"
MYSQL_DATABASE: "rap2"
networks:
- rap2-network
networks:
rap2-network:
docker network create rap2-network
cd /opt/rap
docker-compose up -d
docker ps
启动后,第一次运行需要手动初始化mysql数据库
注意: 只有第一次该这样做
docker-compose exec delos node scripts/init
执行之后的结果
http://localhost:3000 # 前端(可自定义端口号)
http://localhost:38080 # 后端