preface

I’ve been working on my graduation project lately. Because you’re using some open source stuff, some you’ve used, some you haven’t. So keep a record of things you can look up later, so you don’t waste time searching. As the saying goes, bad writing is better than a good memory.

The configuration steps

Before you can start, you need the following environment:

  1. Java environment jdk1.8
  2. nginx
  3. node.js
  4. maven
  5. Git [Optional]

The first step to pull source code:

git clone https://github.com/apache/dubbo-admin.git
Copy the code

Step 2 Modify the configuration file

2.1 Modifying the Back-end Configuration File

Need to dubbo – admin – server/SRC/main/resources/application configuration changes in the properties. Change the service registry inside to its own address. I use Nacos. Modified as follows:

admin.registry.address=nacos://ip:8848/ admin.config-center=nacos://ip:8848/ Admin.metadata-report. address=nacos:// IP :8848/ admin.root.user.name= your user name admin.root.user.password= your password #group admin.registry.group=DEFAULT_GROUP admin.config-center.group=dubbo admin.metadata-report.group=DEFAULT_GROUP #namespace used by nacos admin.registry.namespace=public admin.config-center.namespace=public admin.metadata-report.namespace=publicCopy the code

Step 3 Compile

3.1 Compiling back-end projects

Go to the dubbo-admin-server directory and run the following command

mvn clean package -Dmaven.test.skip=true -P release
Copy the code

Once packaged successfully, you can see the corresponding JAR package in the target directory

3.2 Compiling the front-end project

In the dubo-admin-ui directory, run the following commands respectively

npm install --registry=https://registry.npm.taobao.org
npm run build
Copy the code

Step 4 organize project documents

When compiling the back-end project, the configuration file application.properties is not included in the JAR to make it easier to modify the configuration later. Next, copy the jar package and the modified application.properties configuration file to the same directory and write the startup script start.sh:

nohup java -Xms128m -Xmx256m -jar dubbo-admin-server.jar >> ./start.log 2>&1 &
Copy the code

Upload the preceding files to the planned directory on the server. Package the files in the dubo-admin-ui /target/dist directory and upload them to the directory planned by the server.

Step 5: Modify the nginx configuration file

Add dubboadmin.conf to /etc/nginx/conf.d

Upstream {server 192.168.0.141:8080; Server 192.168.0.142:8080; Server 192.168.0.143:8080; Server 192.168.0.144:8080; Server 192.168.0.145:8080; } server { listen 80; Server_name 192.168.0.148; #charset koi8-r; #access_log /var/log/nginx/host.access.log main; location / { root /static/dubbo/; index index.html index.htm; } location /api/ { proxy_pass http://dubbo; proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504; proxy_max_temp_file_size 0; proxy_connect_timeout 90; proxy_send_timeout 90; proxy_read_timeout 90; proxy_buffer_size 4k; proxy_buffers 4 32k; proxy_busy_buffers_size 64k; proxy_temp_file_write_size 64k; } error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; }}Copy the code

It is mainly to configure the reverse proxy on the back end of Dubbo and static pages on the front end. Of course, more reasonable configuration, here will not be discussed.

Load the configuration file again

Sudo nginx -t sudo nginx -s reloadCopy the code

Then access the corresponding IP address or domain name to access the front-end pageAfter starting the back-end project, enter the user name and password to enter the main interface, it can be used normally.

The end

At this point, the separated deployment of dubbo Admin is complete.

# # # # # # # # # # # # # # # # # # # # # #

If you find this article helpful, please give it a thumbs up. If there is any mistake, please feel free to comment. Here, thank you folks! Wechat search “Java development practice”, get more content ~~~~