Deploying JianghuJS Project
12006This article will introduce how to deploy a JianghuJS project on the Jianghu panel, using the jianghujs-1table-crud project as an example.
The project code for jianghujs-1table-crud is hosted on GitHub. For information on using Git and GitHub, please refer to the supplementary materials for this lesson.
1. Install JianghuJS Manager
The JianghuJS Manager is a plugin for the Jianghu panel, used for deploying, installing, updating, starting and stopping JianghuJS projects, as well as status monitoring. The JianghuJS Manager is an essential plugin for the Jianghu panel and is usually installed during the first login to the panel. If you skipped the installation of essential software at the beginning, you can install it through the "Software Management" interface:
- In the Jianghu panel, click on "Software Management" on the left side to enter the software management interface.
- In the search box at the top right of the interface, enter "JianghuJS Manager" to find and install it.
2. Use JianghuJS Manager to Deploy the Project
Next, we will start using the JianghuJS Manager to deploy the project:
- Open the JianghuJS Manager.
- In the project list, click on "Deploy Project" to open the deployment window.
- Fill in the project Git address:
https://github.com/jianghujs/jianghujs-1table-crud.git, click "Pull & Next", and wait for the code to be pulled. - Click deploy and wait for the project deployment script to finish executing.
- When prompted "Deployment complete, do you want to open the project configuration directory?", click to open the configuration directory. Next, we need to create the database required for the project and fill in the database connection information in the project configuration file.
Note: jianghujs-1table-crud is a public project, so downloading the project code does not require authentication. If you are deploying a private project from a Git repository, you need to configure the public key of the current server in the corresponding Git repository's "SSH/GPS Keys" settings. You can refer to the supplementary materials for this lesson for this step.
3. Create Database and Modify Project Configuration File
- After entering the Jianghu panel, click on "MySQL" on the left sidebar, and in the pop-up MySQL plugin interface, click "Manage List".
- Click "Add Database".
- Fill in the database name (jianghujs_1table_crud), username, and password. It is generally recommended that the username be the same as the database name, and use the default random password for the password.
- Click "Submit", and the database will be created. You can see the newly created database, username, and password in the management list.
- Enter the configuration directory of the project
config, and modify the config.prod.js file. Set the MySQL port to 33067, and the username and password to the database username and password created earlier. If the port is not 33067, you can find it in the MySQL plugin under ports. - Enter the
sqldirectory of the project, open the terminal, and execute the following command, entering the MySQL root password to complete the database initialization. The MySQL root password can be found in the MySQL plugin under the management list - root password.
mysql -u root -p jianghujs_1table_crud < init.sql4. Start the Project
Return to the JianghuJS Manager and click the "Start" button for the project to start it. In the pop-up log window, if you see the following information, it means the project has started successfully.
[egg-scripts] @jianghujs/jianghu started on http://127.0.0.1:7201From the above information, you can see that this project is running on port 7201.
5. Access the Project
After the project has started, open port 7201 in the operator's firewall and the "Security" interface of the Jianghu panel on the server, and you can access this project directly via the server IP + port 7201.
Assignment
- Deploy and run the jianghujs_1table_crud project on the server.
Reference Materials
- Introduction to Git and GitHub
- Introduction to Git:
- Official Documentation: https://git-scm.com/book/en/v2/Getting-Started-What-is-Git%3F
- Liao Xuefeng's Official Website: https://www.liaoxuefeng.com/wiki/896043488029600/896067008724000
- Introduction to GitHub: https://docs.github.com/en/get-started/quickstart/hello-world
- Creating a GitHub Account: https://docs.github.com/en/get-started/quickstart/creating-an-account-on-github
- Connecting to GitHub via SSH: https://docs.github.com/en/authentication/connecting-to-github-with-ssh
- Adding an SSH Key to Your GitHub Account: https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account
- Configuring SSH Keys on Debian and Git: https://blog.csdn.net/kitty_hi/article/details/131231741
- The SSH key configuration for Gitea is similar to that of GitHub.