Skip to content
Using Docker Compose

Blossom depends on JDK8 + MySQL8. If you are slow to pull the image, you can also download the image file through [Baidu Netdisk] (../about/download#baidu).

This method is suitable for scenarios where MYSQL has not been installed. It will be deployed together with MySQL. This is the simplest and fastest deployment method.

Confirm whether Docker Compose is installed

Execute the following command to check whether Docker Compose is installed. If a newer version of Docker is installed, Docker Compose will usually be installed automatically.

bash
docker-compose --version
docker-compose --version

Create blossom-mysql8.yaml file

Below is a docker compose sample file. You need to create a blossom-mysql8.yaml file, then copy the following content into the file, and modify the content marked with a red background.

yml
version: "3.8"

networks:
   blossomnet:
     driver:
       bridge

services:
   blossom:
     image: jasminexzzz/blossom:latest
     container_name: blossom-backend
     volumes:
       # [Requires modification] 
       # Change the part before the colon (:) to a path of the device where you run docker. Do not modify the content after the colon. 
       # If it is a windows environment, you can use /c/home/bl/img/ to specify the disk 
       - /d/blossom/bl/:/home/bl/ 
     environment:
       SPRING_DATASOURCE_URL: jdbc:mysql://blmysql:3306/blossom?useUnicode=true&characterEncoding=utf-8&allowPublicKeyRetrieval=true&allowMultiQueries=true&useSSL=false&&serverTimezone=GMT%2B8
       SPRING_DATASOURCE_USERNAME: root
       # [Optional modification] Configure the database password. If you change the yellow part below, you must also modify it 
       SPRING_DATASOURCE_PASSWORD: jasmine888 
     ports:
       - "9999:9999"
     networks:
       - blossomnet
     healthcheck:
       test: ["CMD", "curl", "-f", "http://localhost:9999/sys/alive"]
       interval: 30s
       timeout: 10s
       retries: 3
       start_period: 5s
     restart: always
     depends_on:
       blmysql:
         condition: service_healthy
   blmysql:
     image: mysql:8.0.31
     container_name: blossom-mysql
     restart:on-failure:3
     volumes:
       # [Modification required] Change the part before the colon (:) to a path of the device where you run docker. Do not modify the content after the colon. 
       - /d/blossom/Docker/mysql/data:/var/lib/mysql 
       - /d/blossom/Docker/mysql/log:/var/log/mysql 
       - /d/blossom/Docker/mysql/mysql-files/log:/var/lib/mysql-files 
     environment:
       MYSQL_DATABASE: blossom
       # [Optional modification] This change also needs to modify the yellow part above. Needs to be the same as services.blossom.environment.SPRING_DATASOURCE_PASSWORD 
       MYSQL_ROOT_PASSWORD: jasmine888 
       LANG: C.UTF-8
       TZ: Asia/Shanghai
     ports:
       - "3306:3306"
     networks:
       - blossomnet
     healthcheck:
       # [Optional modification] If the database password "MYSQL_ROOT_PASSWORD" above is modified, the password after -p below also needs to be modified 
       test: ["CMD", "mysqladmin", "-uroot", "-pjasmine888", "ping", "-h", "localhost"]
       interval: 10s
       timeout: 3s
       retries: 12
version: "3.8"

networks:
   blossomnet:
     driver:
       bridge

services:
   blossom:
     image: jasminexzzz/blossom:latest
     container_name: blossom-backend
     volumes:
       # [Requires modification] 
       # Change the part before the colon (:) to a path of the device where you run docker. Do not modify the content after the colon. 
       # If it is a windows environment, you can use /c/home/bl/img/ to specify the disk 
       - /d/blossom/bl/:/home/bl/ 
     environment:
       SPRING_DATASOURCE_URL: jdbc:mysql://blmysql:3306/blossom?useUnicode=true&characterEncoding=utf-8&allowPublicKeyRetrieval=true&allowMultiQueries=true&useSSL=false&&serverTimezone=GMT%2B8
       SPRING_DATASOURCE_USERNAME: root
       # [Optional modification] Configure the database password. If you change the yellow part below, you must also modify it 
       SPRING_DATASOURCE_PASSWORD: jasmine888 
     ports:
       - "9999:9999"
     networks:
       - blossomnet
     healthcheck:
       test: ["CMD", "curl", "-f", "http://localhost:9999/sys/alive"]
       interval: 30s
       timeout: 10s
       retries: 3
       start_period: 5s
     restart: always
     depends_on:
       blmysql:
         condition: service_healthy
   blmysql:
     image: mysql:8.0.31
     container_name: blossom-mysql
     restart:on-failure:3
     volumes:
       # [Modification required] Change the part before the colon (:) to a path of the device where you run docker. Do not modify the content after the colon. 
       - /d/blossom/Docker/mysql/data:/var/lib/mysql 
       - /d/blossom/Docker/mysql/log:/var/log/mysql 
       - /d/blossom/Docker/mysql/mysql-files/log:/var/lib/mysql-files 
     environment:
       MYSQL_DATABASE: blossom
       # [Optional modification] This change also needs to modify the yellow part above. Needs to be the same as services.blossom.environment.SPRING_DATASOURCE_PASSWORD 
       MYSQL_ROOT_PASSWORD: jasmine888 
       LANG: C.UTF-8
       TZ: Asia/Shanghai
     ports:
       - "3306:3306"
     networks:
       - blossomnet
     healthcheck:
       # [Optional modification] If the database password "MYSQL_ROOT_PASSWORD" above is modified, the password after -p below also needs to be modified 
       test: ["CMD", "mysqladmin", "-uroot", "-pjasmine888", "ping", "-h", "localhost"]
       interval: 10s
       timeout: 3s
       retries: 12

This Docker Compose contains MySQL, and the MySQL container automatically creates the database Blossom when it is initialized.

Docker Compose source files can be viewed at blossom-mysql8.yaml.

Start Docker Compose

Execute the following command in the path where the blossom-mysql8.yaml file is located, and then please wait patiently for the image to be pulled and started.

bash
docker compose -f blossom-mysql8.yaml up -d
# If the command does not work, you can try the following command
docker-compose -f blossom-mysql8.yaml up -d
docker compose -f blossom-mysql8.yaml up -d
# If the command does not work, you can try the following command
docker-compose -f blossom-mysql8.yaml up -d

Check Configuration Items

You can enter the following command to check whether the modified configuration items are taking effect in the container logs:

bash
docker logs blossom-backend
docker logs blossom-backend

The various parameters you configured will be displayed at the top of the startup log.

Check if the Application Has Started Successfully

Method One: View Logs

You can enter the following command to check if the container has started successfully in the container logs:

bash
docker logs blossom-backend
docker logs blossom-backend

If the bottom of the log displays the following content, it means the container has started successfully.

Method Two: Direct Access

For example, if you deploy locally, you can access 127.0.0.1:9999. If it returns the following content, it means the deployment was successful. The message indicates that you are not logged in, and you can now log in to use the client.

json
{
  "code": "AUTH-40101",
  "msg": "Invalid authorization information",
  "ex": "Invalid authorization information",
  "data": null
}
{
  "code": "AUTH-40101",
  "msg": "Invalid authorization information",
  "ex": "Invalid authorization information",
  "data": null
}

Install the Client and Log In

After successfully deploying, you can use the client to log in. Blossom provides two types of clients:

  1. Download the PC Desktop Client.
  2. Use the built-in web client.

The web client address is: IP:Port(domain)/editor/#/settingindex


For example, if the IP:Port is 127.0.0.1:9999, visit http://127.0.0.1:9999/editor/#/settingindex

For example, if the domain is http://www.abc.com, visit http://www.abc.com/editor/#/settingindex

If you have configured a reverse proxy path, like /bl/, visit http://www.abc.com/bl/editor/#/settingindex

Attention!

This address is for accessing the web, not the login address! Enter it in the browser's address bar!

When you open the client, you will enter the login page.

Enter the access address of the backend in the top, then log in using the default username and password.

  • Username: blos, Password: blos

Attention!

The access address does not include /editor/#/settingindex!!!

After logging in, it's recommended to change the default user's username and password to use it as your main account, because the built-in blog part of the backend only supports users with ID 1.

See How to Modify and Create Users?

Quick Setup

If you are a first-time user, you will see the following prompt in the upper right corner of the page.

Click on the flashing yellow icon to enter the following page.

Click on any red box above to start quick configuration.

Click on [Yes] to enter the blog configuration.

Usually, clicking on [Confirm using the built-in blog] will complete the configuration.

Blossom Document