WillemJiang closed pull request #9: SCB-114 document translation for servicecomb website URL: https://github.com/apache/incubator-servicecomb-website/pull/9
This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/_users/deployment.md b/_users/deployment.md index 28113d4..c953589 100644 --- a/_users/deployment.md +++ b/_users/deployment.md @@ -1,43 +1,49 @@ --- -title: "????" +title: "Running Mode" lang: en ref: run-mode permalink: /users/run-mode/ -excerpt: "????" +excerpt: "Running Mode" last_modified_at: 2017-06-06T10:01:43-04:00 redirect_from: - /theme-setup/ --- {% include toc %} -???????????????????standalone???web?????????**standalone??**??????? -## standalone?? -??Standalone????????Main??Spring????????????Tomcat/JBoss?Web??????????Web??????????????standalone??????????????????Main???????????Spring?????????? +Currently, ServiceComb microservice framework support two kind of deploy mode: standalone mode and web container mode. You are advised to to use standalone to to start your services. +## Standalone Mode +A standalone container is loaded with a simple Main to start Spring. Because the service usually does not need the Web container feature, such as Tomcat/JBoss. -### ???? +It is not necessary to unload services using the Web container. The microservice framework provides the standalone deployment mode. -* **??1** ??Main????????????????????? +The service container is only a simple Main method, and a simple Spring container is loaded to expose services. + +### Procedure + +* **Step 1** Compile the Main function to initialize logs and load service configurations. The contents are as follows: ```java import io.servicecomb.foundation.common.utils.BeanUtils; import io.servicecomb.foundation.common.utils.Log4jUtils; public class MainServer { public static void main(String[] args) throws Exception { - ?Log4jUtils.init(); #????? - ?BeanUtils.init(); # Spring bean??? + ?Log4jUtils.init(); #Log initialization + ?BeanUtils.init(); # Spring bean initialization // other codes omitted } } ``` -* **??2** ??MainServer?????????????????? +* **Step 2** Run MainServer to start process and expose services. + + NOTE: If the rest network is used, change transparent in the POM file to the cse-transport-rest-vertx package. - ?????????rest????????pom??transport????cse-transport-rest-vertx?? +## WEB Container Mode +If you need to load the microservice to the web container, create a sersvlet project package. You do not need to write or write a small number of boot codes as needed. -## WEB???? -????????????web???????????????servlet????????servlet???????????????????????? +### Development Example -### ???? +**Step 1** Create a servlet project and modify the web.xml file as follows: ```xml <web-app> @@ -65,7 +71,7 @@ redirect_from: </web-app> ``` -* **??2 ??pom??** +* **Step 2 Modify the POM file** ```xml <dependencies> @@ -79,7 +85,7 @@ redirect_from: </build> ``` -**????:** -1. RESTful?????web??????????????html?js??????????webroot?????????????????web.xml??????/test/rest???rest? -2. ?tomcat???????war??????webroot???webroot???basePath??????webroot?test???????????????/test??? -3. ???????web?????????web????http?https??????????web??????????????web?????? +**NOTICE:** +1. The Restful call must be separated from other static resources (such as HTML and js) in the web container. The next segment of webroot should have a keyword, such as rest in this example (/test/rest) in web.xml +2. The Tomcat is used as an example. Each WAR package has unique webroot, which must be a basePath prefix. For example , if webroot is test, all the API definitions of the microservice must start with /test. +3. When the microservice is loaded to the web container and the HTTP and HTTPS ports are opened using the web container, which must meet requirements for the web container rules. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services