The main functions of tars-web are as follows:
Tars-web installation usually follows the one click installation script or is automatically installed in the docker container. For the source code installation, please refer to tars source code installation
Tar web consists of two modules (services implemented by nodejs, implemented by koa framework):
After the system is installed, it is managed by PM2. You can view:
pm2 list
Common commands:
pm2 start tars-node-web
pm2 start tars-user-system
pm2 stop tars-node-web
pm2 stop tars-user-system
pm2 start tars-node-web
pm2 start tars-user-system
Tar web services implemented by nodejs, implemented by koa framework, bind by default : 0.0.0.0:3000
After the system is installed, it is managed by PM2. You can view:
pm2 list
Common commands:
pm2 start tars-node-web
pm2 stop tars-node-web
pm2 start tars-node-web
Note that if you find that there is no PM2 command, the node environment traversal does not take effect. You can execute:
source /etc/profile
The environment variable of node is automatically installed when tars is installed. Note that the user is root.
There are three types of user permissions:
The granularity of permissions can be applied to application or service level
For example, if you want to give the operation and maintenance user test, the app is test, and the service is helloserver permission:
If you want to users(test) own all service permissions of app(Test) , mark it as: Test
In the web management platform, you can click specific services -> Click permission management - > enter the user name in the input box of operation and maintenance, development, and multiple users are separated by ;
Tars-node-web & Tars-user-system is deployed on the same machine by default, and they are all bound with 0.0.0.0 (that is, 127.0.0.1)
Tars-node-web accesses tars-user-system through localhost (127.0.0.1). If 127.0.0.1 is not bound, it has no permission. At this time, you need to modify the configuration of tars-user-system module (demo/config/loginConf.js), modify ignoreips, and open the white list.
Normally, you can access it through the machine's Internet IP, for example: http://xxx.xxx.xxx.xxx:3000 web management platform.
If nginx proxy is hung in front of Web & demo, and the reverse proxy is accessed to different ports (a 3000, a 3001), different domain names need to be set to access. The login state of Web & demo is passed through cookies, so it needs to be deployed under the same root domain name.
For example, the domain name of the web's nginx entry is http://user.tars.com, and the domain name of demo's nginx is http://auth.tars.com (note that the root domain name is tars.com), so you need to set the environment variable on the web server:
export USER_CENTER_HOST=http://auth.tars.com
export COOKIE_DOMAIN=.tars.com
Pay attention: COOKIE_DOMAIN has .
Tars-node-web are all bound with 0.0.0.0 (that is, 127.0.0.1)
Normally, you can access it through the machine's Internet IP, for example: http://xxx.xxx.xxx.xxx:3000 web management platform.
If the tars web runs abnormally, for example, the page cannot be opened, you can check it in the following ways:
pm2 stop tars-node-web
cd /usr/local/app/web
npm run dev
NPM run dev will output the error on the screen. If it is modified according to the error judgment, Ctrl + C will exit NPM run dev.
After the bug is solved, restart the service with PM2:
pm2 start tars-node-web
pm2 start tars-user-system
Two important web logs:
If the tars web runs abnormally, for example, the page cannot be opened, you can check it in the following ways:
pm2 stop tars-node-web
cd /usr/local/app/web
npm run dev
NPM run dev will output the error on the screen. If it is modified according to the error judgment, Ctrl + C will exit NPM run dev.
After the bug is solved, restart the service with PM2:
pm2 start tars-node-web
The important web logs:
The user module of Web provides the function of token management, that is, you can create token, and call and obtain relevant data through web API, See
If the password of admin is forgotten, Now, it can only be solved by resetting the fields of related tables in the database at present:
When you log in to the web, you will be prompted to set the admin password.
If you are a nodejs developer, you can also participate in the development of the web in the following ways:
tars web developed by nodejs + koa.
The code architecture of the two modules is the same. We will explain it with tar node web:
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。