Chat2DB Source code deployment and Docker deployment
This project supports source code compilation deployment and Docker deployment. For simplicity, we recommend Docker deployment first!
Docker deployment
Command line operation:
- Pull chat2db image
- Check the image and you can see that the pull is successful.
- Start the chat2db image, change the name (chat2db) and port number (10824), and use
docker ps
to see the running container after the startup is successful.
Command: docker run -itd chat2db/chat2db:latest -p 10824:10824 --name chat2db
- Open the web page and enter
localhost:10824
successfully!
Client Docker deployment (visual operation on the client):
- Open the docker client, search for
chat2db
in the app store, select the first 10K+ downloads, the latest version andpull
the image
- Click
Images
on the left to enter the image interface and start the image
- After starting the image, a window will pop up. Set the image parameters according to the figure below
- After the startup is complete, click
Contains
on the left to enter the container interface and check the container running status
- Open the web page and enter
localhost:10824
Success!
Source code deployment
Running environment
Note: This project must be supported by Open JDK17 and above (not Oracle JDK), and the Node version must be 16 and above.
Front-end deployment (this deployment is implemented by IDEA by default)
- Enter the directory: First enter the
chat2db-client
directory of the project:
- Compile the project: Then run the
yarn
command to compile the front-end project and wait patiently
- Start the project: Use
yarn run start:web
to open the project.
When the port shown in the figure below appears, it means that the startup is successful!
Backend deployment
- Enter the directory: First enter the chat2db-server directory of the project
- Clean and compile: Clean and compile the code, skip the test run
Command: mvn clean install -DskipTests
- Enter the target directory:
Command: cd chat2db-server-start/target
- Start the program: Start the Java backend program (this deployment is implemented by IDEA by default), start it directly in the startup class of IDEA
After completing the above steps, you can see that the web page has been successfully opened! The web page startup port is 8000.
Problems you may encounter:
Windows:
Problem 1: Error when preparing to start the project with yarn:
yarn: Unable to load file C:\Users\AppData\Roaming\npm\yarn.ps1 because running scripts is prohibited on this system. For more information, see about_Execution_Policies in https:/go.microsoft. com/fwlink/?LinkID=135170. Location Line: 1 Character: 1
Solution: Open the Windows PowerShell command window and use the command to find that Windows automatically prohibits running scripts (first line), and allows this system to run scripts (second line)
Get-ExecutionPolicy
Set-ExecutionPolicy RemoteSigned
Problem 2: Yarn reports the following error during installation:
Yarn: The term "yarn" cannot be recognized as the name of a cmdlet, function, script file, or executable program. Please check the spelling of the name, and if the path is included, make sure the path is correct and try again. Location Line: 1 Character: 1
Solution: First check the version of node, then download yarn.
PS E:\Chat2DB\chat2db-client> node --version (check if node meets the project running requirements)
PS E:\Chat2DB\chat2db-client> npm i -g yarn (download and install yarn)
Mac:
Problem 3: Error during execution of mvn clean install -DskipTests:
Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.11.0:compile (default-compile) on project chat2db-server-tools-base: Fatal error compiling: java.lang.NoSuchFieldError: Class co
Solution:
- Check if there is a problem with the project's Maven configuration and make sure the JDK version you use is compatible with Maven Project compatibility:
- Check and set JAVA_HOME, make sure your system is configured with the correct JAVA_HOME environment variable, and that the variable points to a compatible JDK version, and configure the following content to ~/.zshrc