Deploying a BI Application Stack with Docker Compose, Spring Boot, Redis, and RabbitMQ

Server Preparation

Acquire a cloud server instance from a provider such as Tencent Cloud or AWS. Select a lightweight server configuration suitable for development or testing purposes. Install CentOS 7.6 or a similar Linux distribution as the operating system.

Docker Installation

Configure the package manager to use a mirror repository for faster downloads:

yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

Install the Docker engine:

yum install -y docker-ce

Start the Docker service and enable it to launch on system boot:

systemctl start docker
systemctl enable docker

Verify the installation by checking the Docker version:

docker --version

Configure a domestic mirror for image pulling by editing the daemon configuration:

vi /etc/docker/daemon.json

Add the following configuration:

{
    "registry-mirrors": ["https://mirror.ccs.tencentyun.com"],
    "live-restore": true
}

Reload the daemon and restart Docker:

systemctl daemon-reload
systemctl restart docker

Docker Compose Setup

Download Docker Compose from the official GitHub repository:

curl -L "https://github.com/docker/compose/releases/download/1.28.6/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

If the download is slow, manually transfer the binary to the server. Apply executable permissions:

chmod +x /usr/local/bin/docker-compose

Confirm the installation:

docker-compose --version

Docker Compose Configuration

Create a docker-compose.yml file to define the multi-container application. This example assumes an external MySQL database:

version: '3.8'

services:
  webserver:
    image: nginx:alpine
    ports:
      - "80:80"
    volumes:
      - ./nginx/html:/usr/share/nginx/html
      - ./nginx/conf.d:/etc/nginx/conf.d
    privileged: true
    depends_on:
      - api-service

  cache:
    image: redis:alpine
    container_name: redis-cache
    ports:
      - "6379:6379"

  message-queue:
    image: rabbitmq:3-management
    container_name: rabbitmq-broker
    restart: always
    ports:
      - "5672:5672"
      - "15672:15672"
    environment:
      TZ: Asia/Shanghai
      RABBITMQ_DEFAULT_USER: admin
      RABBITMQ_DEFAULT_PASS: admin123
    volumes:
      - ./rabbitmq_data:/var/lib/rabbitmq

  api-service:
    image: bi-backend:latest
    build: .
    ports:
      - "8080:8080"
    depends_on:
      - cache
      - message-queue

Dockerfile Configuration

Create a Dockerfile to build the Spring Boot application image:

FROM openjdk:8-jdk-alpine

WORKDIR /opt/app

COPY target/BusinessIntelligence-1.0.0.jar application.jar

EXPOSE 8080

ENTRYPOINT ["java", "-Xmx512m", "-jar", "application.jar"]

Backend Deployment

Package the Spring Boot project into a JAR file. Ensure the application configuration references the correct service hosts instead of localhost:

spring:
  redis:
    database: 1
    host: ${REDIS_HOST:your-server-ip}
    port: 6379
    timeout: 5000ms
    password: yourpassword

Configure Nginx reverse proxy settings in ./nginx/conf.d/default.conf:

server {
    listen 80;
    server_name your-domain-or-ip;

    location / {
        root /usr/share/nginx/html/dist;
        index index.html index.htm;
        try_files $uri $uri/ /index.html;
    }

    location /api/ {
        proxy_pass http://api-service:8080/;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
    }

    error_page 500 502 503 504 /50x.html;
    location = /50x.html {
        root /usr/share/nginx/html;
    }
}

Launch all services using Docker Compose:

docker-compose up -d --build

Verify that all containers are running:

docker ps

Ensure that the necessary firewall ports are open on the cloud provider's security group (80, 8080, 5672, 15672, 6379).

Frontend Deployment

Build the frontend application:

npm run build

Copy the generated dist directory to the Nginx html folder on the server:

scp -r dist/* root@your-server:/root/project/nginx/html/

Tags: docker Spring Boot Redis RabbitMQ deployment

Posted on Thu, 07 May 2026 13:36:08 +0000 by Brandito520