致访客
感谢各位一年多的陪伴,因内容调整,本站将于近日迁移到新域名并不再更新主要内容。

MENU

Believe it or not, RUOYI projects can be deployed with a single YML file

• February 10, 2022 • π

致访客
感谢各位一年多的陪伴,因内容调整,本站将于近日迁移到新域名并不再更新主要内容。
特此通知。

Article directory

  1. Install Docker
  2. Configure Ali mirror
  3. Start deployment
    Fourth, the effect

Related Links

This deployment, based on docker deployment, requires docker and docker-compose to be installed in advance, and docker must be configured with Alibaba Cloud image acceleration. Demonstration video: Docker one-click deployment of Ruoyi

  1. Install Docker
    Official website address: Centos install Docker

Uninstall old versions
sudo yum remove docker \

              docker-client \
              docker-client-latest \
              docker-common \
              docker-latest \
              docker-latest-logrotate \
              docker-logrotate \
              docker-engine

dep
sudo yum install -y yum-utils

sudo yum-config-manager \

--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo

install
sudo yum install -y yum-utils

$ sudo yum-config-manager \

--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo

install docker-compose
curl -L https://get.daocloud.io/docker/compose/releases/download/1.25.5/docker-compose-uname -s-uname -m > /usr/local/bin/docker-compose

Configure Ali mirror

Log in to Alibaba Cloud and search 镜像服务
Find on the far left 镜像中心–>镜像加速器
Just follow the prompts

9e58443a24c7abdc7e445869c13f.png

  1. Start deployment
    Create a file

mkdir /home/ruoyi
vim docker-compose.yml

yml file content:

version: "3.8"
services:
    # mysql服务
  mysql:
    # 自己构建的mysql,里面有若依后端需要的sql脚本
    image: registry.cn-shanghai.aliyuncs.com/xiuyi/ruoyi:mysql
    volumes:
      - ./mysql:/var/lib/mysql
    restart: always
    container_name: ruoyi-mysql
    ports:
      - 3306:3306
    environment:
      - MYSQL_ROOT_PASSWORD=songweiwei
      - MYSQL_DATABASE=ry-vue
      - MYSQL_USER=ruoyi
      - MYSQL_PASSWORD=ruoyi
    command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
  # redis服务
  redis:
    image: library/redis:alpine
    container_name: ruoyi-redis
    ports:
      - 6379:6379
    # 给redis设置密码
    command: redis-server --requirepass songweiwei --appendonly yes
    volumes:
      - ./redis/data:/data
  # 构建若依后端
  ruoyiapp:
    # 镜像来源 自己构建的
    image: registry.cn-shanghai.aliyuncs.com/xiuyi/ruoyi:service
       restart: always
    container_name: ruoyi-app
    # 对外暴露端口 8080 (可修改,该端口修改的话ruoyiweb服务必须挂载nginx修改 转发端口)
       ports:
      - 8080:8080
    # 后端项目需要的配置,可修改
    environment:
      - REDIS_HOST=redis
      - REDIS_PORT=6379
      - REDIS_DATABASE=0
      - REDIS_PASSWORD=songweiwei
      - MYSQL_HOST=mysql
      - MYSQL_PORT=3306
      - MYSQL_DATABASE=ry-vue
      - MYSQL_USERNAME=ruoyi
      - MYSQL_PASSWORD=ruoyi
    depends_on:
      - redis
      - mysql
    links:
      - redis
      - mysql
  # 若依前端服务
  ruoyiweb:
    # 基于nginx构建的,将dist打包进去了
    image: registry.cn-shanghai.aliyuncs.com/xiuyi/ruoyi:web
    links:
      - ruoyiapp
    # 端口可修改 (88为访问端口)
    ports:
      - 88:80
    restart: always
    container_name: ruoyi-web

Copy the above yml content directly, paste it into the server, the format is garbled, you can create a docker-compose.ymlfile , then format the code, and copy the file to the server. Or download it here: docker-compose.yml

start up

docker-compose up -d
Fourth, the effect
ruoyiweb is based on nginx mirroring, so you can access ip+88 port.
1a9b0e0dd8665ed569.png

Related
Teach you how to deploy Ruoyi project in Docker (front-end service)
Teach you how to deploy Ruoyi project in Docker (backend service)
Teach you how to deploy Ruoyi project in Docker (integration)
If you separate Git addresses before and after
Crazy God speaks docker address
————————————————