(16) Nepxion-Thunder Distributed RPC Integration Framework - Spring Boot + Docker Deployment

Nepxion-Thunder (QQ group 471164539) released at https://github.com/Nepxion/

 

The example code is under the project nepxion-thunder-spring-boot-docker

Spring Boot

1. Spring Boot example code

    There are three entrances, which are more convenient to use, and the code logic will not be introduced.
  • NettyServerBootTest.java
    pure server entry
  • NettyClientBootRunnerTest.java
    server and client integration entry
  • NettyClientBootEmbeddedRunnerTest.java
    server and client integration entry, customizable port

2. How to use Spring Boot

  • Select an entry program, right click Run As -> Spring Boot App
  • NettyServerBootTest and NettyClientBootRunnerTest cannot run at the same time because their ports both default to 8080

Docker

1. Docker environment preparation (using Windows Dock to install a virtual machine as an example)

  • Download the Docker Windows version
    by visiting the link https://get.daocloud.io/toolbox/, select the latest DockerToolbox-x.xx.xx.exe to download
  • Install Docker Windows
    Select the default installation method. After the installation is complete, three icons will appear on the desktop, Oracle VM VirtualBox, Kitematic, and Docker Quickstart Terminal.
  • Running Docker Quickstart Terminal
    takes a period of time to initialize the Docker container, including assigning IP, etc. The following interface appears, indicating that the operation is successful

     
     
  • To run Kitematic
    for the first time, you need to log in with a Docker Hub account (register an account at https://hub.docker.com/ first). When logging in, the account name must be all lowercase
    . Click the USE VIRTUALBOX button to enter, and you can see the following interface. The mirror has been installed in this interface. The following will introduce how to install the mirror.

     
  • Install the base image
    There are two ways to install the base image:
    1) Through the command line of the Docker Quickstart Terminal,
    I choose Redhat centos as the base image of the Linux virtual machine, or you can choose Ubuntu and
    enter docker run -it centos bash or docker run in the Docker Quickstart Terminal -it ubuntu bash command line, the basic image will be installed automatically, wait patiently for a while


    2) Through the Kitematic search method, similar to Apple's App Store

     
  • Install the business image
    to ensure that the Docker Quickstart Terminal is always started, which will be used as the local private server of Docker. To install the business image,
    change the zookeeperAddress of thunder-ext.properties to the real physical IP (ipconfig under Windows Dos), because the Docker container implements a network segment Isolation, it does not recognize localhost
    to execute repo.bat, load thunder.jar to the local maven library (spring-boot-maven-plugin does not seem to support the packaging of local maven applications), if thunder.jar is uploaded to the company's maven library, it will not You need to perform this step
    to execute install.bat, which will execute Spring Boot Maven packaging, Docker Maven packaging and upload the Thunder image. The running result displays the word success, indicating that the image creation and installation are successful.

  • Run the business image
    and go back to the Kitematic window, click My Images, you can see three images, centos, java, nepxion-thunder-spring-boot-docker, then all your images are installed successfully


     
    Next, we have to start nepxion -thunder-spring-boot-docker image, in the above interface, click CREATE on nepxion-thunder-spring-boot-docker, nepxion-thunder-spring-boot-docker will appear in the list on the left, click it, after a few seconds The following interface appears (with the LOGO of Spring Boot and Thunder on it), then congratulations, it runs successfully!
    You can STOP, RESTART

     

     

     

     

1. Spring Boot example code

    There are three entrances, which are more convenient to use, and the code logic will not be introduced.
  • NettyServerBootTest.java
    单纯服务端入口
  • NettyClientBootRunnerTest.java
    服务端和客户端一体化入口
  • NettyClientBootEmbeddedRunnerTest.java
    服务端和客户端一体化入口,可自定义端口

2. Spring Boot使用方式

  • 选择一个入口程序,右键Run As -> Spring Boot App
  • NettyServerBootTest和NettyClientBootRunnerTest不能同时运行,因为它们的端口都默认为8080

Docker

1. Docker环境准备(以Windows Dock安装虚拟机为示例)

  • 下载Docker Windows版本
    通过访问链接https://get.daocloud.io/toolbox/,选择最新的DockerToolbox-x.xx.xx.exe下载
  • 安装Docker Windows
    选择默认安装方式,安装结束,在桌面会出现三个图标Oracle VM VirtualBox,Kitematic,Docker Quickstart Terminal
  • 运行Docker Quickstart Terminal
    需要等待一段时间,初始化Docker容器,包括分配IP等,出现如下界面,表示运行成功

     
     
  • 运行Kitematic
    第一次运行需要Docker Hub账号登录(在https://hub.docker.com/先注册账户),账户名在登录的时候必须是全部小写
    点USE VIRTUALBOX按钮进入,可以看到如下界面。该界面下镜像已经安装,下面会具体介绍如何安装镜像

     
  • 安装基础镜像
    基础镜像的安装方式有两种
    1)通过Docker Quickstart Terminal的命令行
    我选择Redhat centos作为Linux虚拟机的基础镜像,也可以选择Ubuntu
    在Docker Quickstart Terminal输入docker run -it centos bash或者docker run -it ubuntu bash命令行,将会自动安装基础镜像,耐心等待一段时间


    2)通过Kitematic的搜索方式,类似苹果手机的App Store这样的

     
  • Install the business image
    to ensure that the Docker Quickstart Terminal is always started, which will be used as the local private server of Docker. To install the business image,
    change the zookeeperAddress of thunder-ext.properties to the real physical IP (ipconfig under Windows Dos), because the Docker container implements a network segment Isolation, it does not recognize localhost
    to execute repo.bat, load thunder.jar to the local maven library (spring-boot-maven-plugin does not seem to support the packaging of local maven applications), if thunder.jar is uploaded to the company's maven library, it will not You need to perform this step
    to execute install.bat, which will execute Spring Boot Maven packaging, Docker Maven packaging and upload the Thunder image. The running result displays the word success, indicating that the image creation and installation are successful.

  • Run the business image
    and go back to the Kitematic window, click My Images, you can see three images, centos, java, nepxion-thunder-spring-boot-docker, then all your images are installed successfully


     
    Next, we have to start nepxion -thunder-spring-boot-docker image, in the above interface, click CREATE on nepxion-thunder-spring-boot-docker, nepxion-thunder-spring-boot-docker will appear in the list on the left, click it, after a few seconds The following interface appears (with the LOGO of Spring Boot and Thunder on it), then congratulations, it runs successfully!
    You can STOP, RESTART

     

     

     

     

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327099174&siteId=291194637