{"id":10746,"date":"2019-11-26T15:20:46","date_gmt":"2019-11-26T07:20:46","guid":{"rendered":"http:\/\/4563.org\/?p=10746"},"modified":"2019-11-26T15:28:57","modified_gmt":"2019-11-26T07:28:57","slug":"%e7%94%a8golang%e7%bc%96%e5%86%99%e4%b8%80%e4%b8%aa%e7%9f%ad%e9%93%be%e6%8e%a5%e6%9c%8d%e5%8a%a1","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=10746","title":{"rendered":"shorter\uff1a\u4e00\u4e2a\u77ed\u94fe\u63a5\u5728\u7ebf\u751f\u6210\u5c0f\u5de5\u5177 , \u7528golang\u7f16\u5199\u4e00\u4e2a\u77ed\u94fe\u63a5\u670d\u52a1"},"content":{"rendered":"<div class=\"am-article-hd\">\n<p>shorter\uff1a\u4e00\u4e2a\u77ed\u94fe\u63a5\u5728\u7ebf\u751f\u6210\u5c0f\u5de5\u5177<\/p>\n<p>Github (<a href=\"https:\/\/github.com\/icowan\/shorter\">https:\/\/github.com\/icowan\/shorter<\/a>) |<\/p>\n<p>Demo (<a href=\"https:\/\/r.nsini.com\/\">https:\/\/r.nsini.com\/<\/a>) |<\/p>\n<p>\u524d\u7aef (<a href=\"https:\/\/github.com\/icowan\/shorter-view\">https:\/\/github.com\/icowan\/shorter-view<\/a>)<\/p>\n<p>\u652f\u6301\u591a\u79cd\u65b9\u5f0f\u542f\u52a8\uff0c\u4f5c\u8005\u5728 Github \u4e2d\u8fd8\u63d0\u5230\u5982\u4f55\u4f7f\u7528\u5f00\u666e\u52d2\u4e91\u5e73\u53f0\u8fdb\u884c\u90e8\u7f72\uff0c\u53ef\u60dc\u6211\u7684\u57df\u540d\u5f88\u957f<\/p>\n<p>======================================================<\/p>\n<h1><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-10759\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2019\/11\/20191126_072215.jpeg\" alt=\"\" width=\"1384\" height=\"356\" \/><\/h1>\n<h1 class=\"am-article-title blog-text-center\">\u7528golang\u7f16\u5199\u4e00\u4e2a\u77ed\u94fe\u63a5\u670d\u52a1<\/h1>\n<\/div>\n<p>&nbsp;<\/p>\n<hr \/>\n<p>\u7528golang\u7f16\u5199\u4e00\u4e2a\u77ed\u94fe\u63a5\u670d\u52a1<\/p>\n<div class=\"am-article-bd\">\n<div class=\"markdown-body\">\n<p>\u6211\u4eec\u5e73\u65f6\u5de5\u4f5c\u3001\u751f\u6d3b\u4e2d\u603b\u4f1a\u6709\u5404\u79cd\u5404\u6837\u7684\u57df\u540d\u94fe\u63a5\u9700\u8981\u5206\u4eab\u7ed9\u540c\u4e8b\u6216\u670b\u53cb\u6216\u5bb6\u4eba\u3002\u4f46\u5e38\u5e38\u6709\u57df\u540d\u7684\u957f\u5ea6\u8fc7\u957f\u4f1a\u6709\u5404\u79cd\u9650\u5236\uff0c\u6216\u65e0\u6cd5\u590d\u5236\u5168\u800c\u4ea7\u751f\u4e00\u4e9b\u95ee\u9898\u4e86\uff0c\u4e3a\u4e86\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\u6211\u4eec\u9700\u8981\u4e00\u4e2a\u77ed\u94fe\u63a5\u751f\u6210\u5668\u3002<\/p>\n<p>\u57fa\u4e8e\u4e0a\u9762\u7684\u60f3\u6cd5\u6211\u5199\u4e86\u4e00\u4e2a\u77ed\u94fe\u63a5\u7684\u751f\u6210\u5668:<\/p>\n<p><a href=\"https:\/\/github.com\/icowan\/shorter\">https:\/\/github.com\/icowan\/shorter<\/a><\/p>\n<h2>\u9879\u76ee\u7b80\u4ecb<\/h2>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-10761\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2019\/11\/20191126_072237.jpeg\" alt=\"\" width=\"1280\" height=\"653\" \/><\/p>\n<p>\u8be5\u670d\u52a1\u57fa\u4e8ego-kit\u7ec4\u4ef6\u8fdb\u884c\u5f00\u53d1\uff0c\u6570\u636e\u5e93\u57fa\u4e8eRedis\u6216Mongo\u8fdb\u884c\u5b58\u50a8\u3002<\/p>\n<p>\u53ef\u4ee5\u901a\u8fc7\u5bb9\u5668\u8fdb\u884c\u90e8\u7f72\uff0c\u4e5f\u53ef\u4ee5\u5728kubernetes\u4e2d\u8fdb\u884c\u90e8\u7f72\u3002<\/p>\n<h2>\u76ee\u5f55\u7ed3\u6784<\/h2>\n<ul>\n<li>cmd: \u5e94\u7528\u542f\u52a8\u5165\u53e3<\/li>\n<li>dist: \u524d\u7aef\u9759\u6001\u6587\u4ef6\u76ee\u5f55<\/li>\n<li>install: \u5b89\u88c5\u76ee\u5f55<\/li>\n<li>pkg\n<ul>\n<li>endpoint: \u7aef\u70b9<\/li>\n<li>http: \u4f20\u8f93\u5904\u7406<\/li>\n<li>logging: \u65e5\u5fd7\u4e2d\u95f4\u4ef6<\/li>\n<li>repository: \u4ed3\u5e93\u5b58\u50a8\u903b\u8f91\u5b9e\u73b0<\/li>\n<li>service: \u903b\u8f91\u5b9e\u73b0\n<pre><code>\u251c\u2500\u2500 Dockerfile\r\n\u251c\u2500\u2500 Makefile\r\n\u251c\u2500\u2500 README.md\r\n\u251c\u2500\u2500 cmd\r\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 main.go\r\n\u2502\u00a0\u00a0 \u2514\u2500\u2500 service\r\n\u251c\u2500\u2500 dist\r\n\u251c\u2500\u2500 go.mod\r\n\u251c\u2500\u2500 go.sum\r\n\u251c\u2500\u2500 install\r\n\u2514\u2500\u2500 pkg\r\n\u251c\u2500\u2500 endpoint\r\n\u251c\u2500\u2500 http\r\n\u251c\u2500\u2500 logging\r\n\u251c\u2500\u2500 repository\r\n\u2514\u2500\u2500 service\r\n<\/code><\/pre>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h2>API<\/h2>\n<p>\u8be5\u670d\u52a1\u4e00\u5171\u6709\u4e24\u4e2a\u63a5\u53e3\uff0c\u4e00\u4e2a\u662f\u751f\u6210\u77ed\u5730\u5740\uff0c\u53e6\u4e00\u4e2a\u662f\u77ed\u5730\u5740\u8fdb\u884c\u8df3\u8f6c\u3002<\/p>\n<p>\u53ef\u4ee5\u901a\u8fc7Redis\u8fdb\u884c\u6570\u636e\u5b58\u50a8\u4e5f\u80fd\u901a\u8fc7MongoDB\u4f5c\u4e3a\u5b58\u50a8\u4ecb\u8d28\u3002<\/p>\n<h3>Repository<\/h3>\n<p><strong>model<\/strong><\/p>\n<p>\u5b58\u50a8\u7684\u6570\u636e\u7ed3\u6784\uff0c\u4e3b\u8981\u4e09\u4e2a\u5b57\u6bb5<\/p>\n<ul>\n<li>code: \u751f\u6210\u7684\u552f\u4e00\u7801<\/li>\n<li>url: \u6e90\u5730\u5740<\/li>\n<li>created_at: \u521b\u5efa\u65f6\u95f4<\/li>\n<\/ul>\n<pre><code class=\"language-go\">\/\/ pkg\/service\/model.go\r\n\r\ntype Redirect struct {\r\n\tCode      string    `json:\"code\"`\r\n\tURL       string    `json:\"url\"`\r\n\tCreatedAt time.Time `json:\"created_at\"`\r\n}\r\n<\/code><\/pre>\n<p><strong>repository<\/strong><\/p>\n<p>repository\u63d0\u4f9b\u4e86\u4e24\u4e2a\u65b9\u6cd5\uff0c\u4e00\u4e2a\u662fFind\u548cStore.<\/p>\n<ul>\n<li>Find \u6839\u636ecode\u67e5\u8be2url\u4fe1\u606f<\/li>\n<li>Store \u5b58\u50a8url\u4fe1\u606f<\/li>\n<\/ul>\n<pre><code class=\"language-go\">\/\/ pkg\/service\/repository.go\r\n\r\ntype Repository interface {\r\n\tFind(code string) (redirect *Redirect, err error)\r\n\tStore(redirect *Redirect) error\r\n}\r\n<\/code><\/pre>\n<p>Repository\u662f\u4e00\u4e2aInterface \u7c7b\u578b\u7684\u7ed3\u6784\u4f53\uff0c\u6ca1\u6709\u5177\u4f53\u5b9e\u73b0\u3002\u8fd9\u91cc\u6839\u636e\u4f7f\u7528\u7684\u5b58\u50a8\u6570\u636e\u5e93\u7684\u4e0d\u540c\u9700\u8981\u5b9e\u73b0\u4e0d\u540c\u7684\u5b58\u50a8\u65b9\u5f0f\u3002<\/p>\n<ul>\n<li>mongodb: <code>pkg\/repository\/mongo\/repository.go<\/code><\/li>\n<li>redis: <code>pkg\/repository\/redis\/repository.go<\/code><\/li>\n<\/ul>\n<p>\u5728\u542f\u52a8\u5165\u53e3 <code>cmd\/service\/service.go<\/code> \u6587\u4ef6\u91cc\u53ef\u4ee5\u770b\u5230\u542f\u52a8\u662f\u5982\u4f55\u9009\u62e9\u7684:<\/p>\n<pre><code class=\"language-go\">\/\/ cmd\/service\/service.go\r\n\r\nvar repo service.Repository\r\nswitch *dbDrive {\r\ncase \"mongo\":\r\n\trepo, err = mongodb.NewMongoRepository(*mongoAddr, \"redirect\", 60)\r\n\tif err != nil {\r\n\t\t_ = level.Error(logger).Log(\"connect\", \"db\", \"err\", err.Error())\r\n\t\treturn\r\n\t}\r\ncase \"redis\":\r\n\tdb, _ := strconv.Atoi(*redisDB)\r\n\trepo, err = redis.NewRedisRepository(redis.RedisDrive(*redisDrive), *redisHosts, *redisPassword, \"shorter\", db)\r\n\tif err != nil {\r\n\t\t_ = level.Error(logger).Log(\"connect\", \"db\", \"err\", err.Error())\r\n\t\treturn\r\n\t}\r\n}\r\n<\/code><\/pre>\n<h3>Service<\/h3>\n<p>service\u63d0\u4f9b\u4e86\u4e24\u4e2a\u65b9\u6cd5 Get \u548c Post\u3002<\/p>\n<pre><code class=\"language-go\">\/\/ pkg\/service\/service.go\r\n\r\ntype Service interface {\r\n\tGet(ctx context.Context, code string) (redirect *Redirect, err error)\r\n\tPost(ctx context.Context, domain string) (redirect *Redirect, err error)\r\n}\r\n<\/code><\/pre>\n<ul>\n<li>Get: \u4f20\u5165code\u7801\uff0c\u6839\u636ecode\u7801\u53bb\u6570\u636e\u67e5\u627e\u5b58\u50a8\u7684\u5730\u5740\u4fe1\u606f<\/li>\n<li>Post: \u4f20\u5165\u539furl\u5730\u5740\uff0c\u751f\u6210code\u7801\u5e76\u5b58\u5165\u6570\u636e\u5e93\uff0c\u8fd4\u56de\u7ed3\u6784\u4f53<\/li>\n<\/ul>\n<h3>Transport Post<\/h3>\n<p>\u751f\u6210\u5730\u5740\u9700\u8981\u901a\u8fc7POST\u7684\u65b9\u5f0f\u4f20\u5165JSON\u7ed3\u6784, \u63a5\u6536\u53c2\u8003\u6587\u4ef6:<\/p>\n<pre><code class=\"language-go\">\/\/ pkg\/endpoint\/endpoint.go\r\n\r\ntype PostRequest struct {\r\n\tURL string `json:\"url\" validate:\"required,url,lt=255\"`\r\n}\r\n\r\ntype dataResponse struct {\r\n\tUrl       string    `json:\"url\"`\r\n\tCode      string    `json:\"code\"`\r\n\tCreatedAt time.Time `json:\"created_at\"`\r\n\tShortUri  string    `json:\"short_uri\"`\r\n}\r\n\r\ntype PostResponse struct {\r\n\tErr  error        `json:\"err\"`\r\n\tData dataResponse `json:\"data\"`\r\n}\r\n<\/code><\/pre>\n<p>\u8be5\u63a5\u53e3\u53ea\u63a5\u6536\u4e00\u4e2a\u53c2\u6570 &#8220;url&#8221;\uff0c\u8fd4\u56de\u56db\u4e2a\u53c2\u6570\u3002<\/p>\n<ul>\n<li>url: \u539f\u5730\u5740<\/li>\n<li>short_uri: \u8df3\u8f6c\u7684\u77ed\u5730\u5740<\/li>\n<li>code: \u8df3\u8f6c\u77ed\u5730\u5740\u7684code<\/li>\n<li>created_at: \u751f\u6210\u65f6\u95f4<\/li>\n<\/ul>\n<h3>Transport Get<\/h3>\n<p>\u901a\u8fc7uri\u7684code\u8fdb\u884c\u67e5\u8be2\u4f8b\u5982:<\/p>\n<pre><code class=\"language-go\">r.Handle(\"\/{code}\", kithttp.NewServer(\r\n\t\tendpoints.GetEndpoint,\r\n\t\tdecodeGetRequest,\r\n\t\tencodeGetResponse,\r\n\t\toptions[\"Get\"]...)).Methods(http.MethodGet)\r\n<\/code><\/pre>\n<p>\u89e3\u6790 Request:<\/p>\n<pre><code class=\"language-go\">func decodeGetRequest(_ context.Context, r *http.Request) (interface{}, error) {\r\n\tvars := mux.Vars(r)\r\n\tcode, ok := vars[\"code\"]\r\n\tif !ok {\r\n\t\treturn nil, ErrCodeNotFound\r\n\t}\r\n\treq := endpoint.GetRequest{\r\n\t\tCode: code,\r\n\t}\r\n\treturn req, nil\r\n}\r\n<\/code><\/pre>\n<p>\u8df3\u8f6c:<\/p>\n<pre><code class=\"language-go\">func encodeGetResponse(ctx context.Context, w http.ResponseWriter, response interface{}) (err error) {\r\n\tif f, ok := response.(endpoint.Failure); ok &amp;&amp; f.Failed() != nil {\r\n\t\tErrorRedirect(ctx, f.Failed(), w)\r\n\t\treturn nil\r\n\t}\r\n\tresp := response.(endpoint.GetResponse)\r\n\tredirect := resp.Data.(*service.Redirect)\r\n\thttp.Redirect(w, &amp;http.Request{}, redirect.URL, http.StatusFound)\r\n\treturn\r\n}\r\n\r\n\/\/ \u9519\u8bef\u8df3\u56de\u9996\u9875\r\nfunc ErrorRedirect(_ context.Context, err error, w http.ResponseWriter) {\r\n\thttp.Redirect(w, &amp;http.Request{}, os.Getenv(\"SHORT_URI\"), http.StatusFound)\r\n}\r\n<\/code><\/pre>\n<h2>docker-compose\u90e8\u7f72<\/h2>\n<p>docker-compose\u542f\u52a8\u6bd4\u8f83\u7b80\u5355\uff0c\u76f4\u63a5\u8fdb\u5165\u76ee\u5f55<code>install\/docker-compose\/<\/code><\/p>\n<p>\u7136\u540e\u6267\u884c:<\/p>\n<pre><code>$ docker-compose up\r\n<\/code><\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-10762\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2019\/11\/20191126_072331.jpeg\" alt=\"\" width=\"1280\" height=\"617\" \/><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-10763\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2019\/11\/20191126_072339.jpeg\" alt=\"\" width=\"1280\" height=\"617\" \/><\/p>\n<h2>\u5728\u5f00\u666e\u52d2\u4e91\u5e73\u53f0\u8fdb\u884c\u90e8\u7f72<\/h2>\n<p>\u7531\u4e8e\u6b64\u9879\u76ee\u4f9d\u8d56\u6570\u636e\u5e93: Redis\u3001MongoDB\uff0c\u6240\u4ee5\u5728\u521b\u5efa\u5e94\u7528\u4e4b\u524d\u6211\u4eec\u5f97\u5148\u90e8\u7f72Redis\u6216MongoDB\u7684\u6301\u4e45\u5316\u5e94\u7528\u3002\u5728\u9879\u76ee\u91cc\u6211\u7ed9\u51fa\u4e86\u4e24\u6570\u636e\u5e93\u90e8\u7f72\u7684Demo\uff0c\u5927\u5bb6\u53ef\u4ee5\u5c1d\u8bd5\u5728\u81ea\u5df1\u7684\u73af\u5883\u4e2d\u542f\u52a8\u3002<\/p>\n<p>\u5f00\u666e\u52d2\u4e91\u5e73\u53f0\u503e\u5411\u4e8e\u90e8\u7f72\u65e0\u72b6\u6001\u7684\u5e94\u7528\u4e5f\u5c31\u662fDeployment\u7c7b\u578b\uff0c\u50cf\u8fd9\u79cd\u9700\u8981\u6301\u4e45\u5316\u7684\u5e94\u7528\u6700\u597d\u662f\u90e8\u7f72\u6210\u6709\u72b6\u6001\u7684\u5e94\u7528\u5982: StatefulSet\u7c7b\u578b\uff0c\u76f8\u5bf9\u6765\u8bf4\u6bd4\u8f83\u597d\u7ec4\u6210\u5206\u5e03\u5f0f\u96c6\u7fa4\u6216\u4e3b\u4ece\u8282\u6784\u3002<\/p>\n<p>\u5355\u70b9Redis\u670d\u52a1: <a href=\"https:\/\/github.com\/icowan\/shorter\/tree\/master\/install\/kubernetes\/redis\/\">install\/kubernetes\/redis\/<\/a> \u5355\u70b9MongoDB\u670d\u52a1: <a href=\"https:\/\/github.com\/icowan\/shorter\/tree\/master\/install\/kubernetes\/mongo\/\">install\/kubernetes\/mongo\/<\/a><\/p>\n<h3>\u521b\u5efa\u4e00\u4e2a\u5e94\u7528<\/h3>\n<p>\u6211\u4eec\u521b\u5efa\u4e00\u4e2a\u540d\u53eb<strong>shorter<\/strong>\u7684\u5e94\u7528:<\/p>\n<ol>\n<li>\u8f93\u5165github\u7684\u5730\u5740: <code>icowan\/shorter<\/code><\/li>\n<li>\u9009\u62e9\u7248\u672c: <code>v0.1.8<\/code><\/li>\n<li>\u9009\u62e9\u542f\u52a8\u7684\u5bb9\u5668\u6570\u91cf: <code>2<\/code><\/li>\n<li>\u6700\u5927<code>64Mi<\/code>\u5185\u5b58,\u5e94\u7528\u6bd4\u8f83\u7b80\u5355\u4e0d\u9700\u8981\u592a\u5927\u7684\u4f7f\u7528\u5185\u5b58<\/li>\n<li>\u542f\u52a8\u7684\u7aef\u53e3: <code>8080<\/code><\/li>\n<li>\u63d0\u4ea4\u7ba1\u7406\u5458\u5ba1\u6838<\/li>\n<\/ol>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-10764\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2019\/11\/20191126_072356.jpeg\" alt=\"\" width=\"1280\" height=\"920\" \/><\/p>\n<h3>\u7ba1\u7406\u5458\u5ba1\u6838\u3001\u521d\u59cb\u5316\u53d1\u5e03\u5e94\u7528<\/h3>\n<p>\u7ba1\u7406\u5458\u6536\u5230\u901a\u77e5\u540e\u8fdb\u5165\u57fa\u7840\u8be6\u60c5\u9875\u8fdb\u884c\u5ba1\u6838\uff1a<\/p>\n<p>\u4e3b\u8981\u67e5\u770b\u63d0\u4ea4\u7684\u57fa\u7840\u4fe1\u606f\u662f\u5426\u6b63\u786e\uff0c\u81ea\u52a8\u751f\u6210\u7684YAML\u6587\u4ef6\u662f\u5426\u6b63\u786e\uff0c\u81ea\u52a8\u751f\u6210\u7684Jenkins\u6a21\u7248\u662f\u5426\u6b63\u786e\u53ca\u7528\u6237\u9879\u76ee\u91cc\u7684Dockerfile\u6587\u4ef6\u662f\u5426\u6709\u8bef\uff0c\u82e5\u6ca1\u6709\u95ee\u9898\u70b9\u51fb<strong>\u201c\u5f00\u59cb\u90e8\u7f72\u201d<\/strong>\u6309\u94ae\u76f4\u63a5\u8fdb\u884c\u5e94\u7528\u7684\u6784\u5efa\u53ca\u53d1\u5e03\u3002<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-10765\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2019\/11\/20191126_072414.jpeg\" alt=\"\" width=\"1280\" height=\"782\" \/><\/p>\n<p>\u5e94\u7528\u90e8\u7f72\u6210\u529f\u540e\uff0c\u7cfb\u7edf\u4f1a\u5411\u50cf\u7684\u90ae\u4ef6\u3001\u5fae\u4fe1\u53d1\u9001\u901a\u77e5\uff0c\u544a\u77e5\u5e94\u7528\u53d1\u5e03\u7684\u60c5\u51b5\u3002\uff08\u5fae\u4fe1\u901a\u77e5\u9700\u8981\u60a8\u5728\u201c\u4e2a\u4eba\u8bbe\u7f6e\u201d-&gt;\u201c\u8d26\u53f7\u7ed1\u5b9a\u201d-&gt;\u201c\u7ed1\u5b9a\uff08\u5173\u6ce8\u5fae\u4fe1\u516c\u4f17\u53f7\u5373\u53ef\u81ea\u52a8\u7ed1\u5b9a\uff09\u201d-&gt;\u201c\u6d88\u606f\u8ba2\u9605\u8bbe\u7f6e\u201d \u5728\u6d88\u606f\u8ba2\u9605\u91cc\u52fe\u9009\u9700\u8981\u901a\u77e5\u7684\u7c7b\u578b\u53ca\u65b9\u5f0f\uff09\u8be6\u60c5\u8bf7\u770b\u6587\u6863:<\/p>\n<ul>\n<li>\u7ed1\u5b9a\u5fae\u4fe1\u901a\u77e5:<\/li>\n<li>\u8ba2\u9605\u901a\u77e5\u7c7b\u578b\u53ca\u65b9\u5f0f: <a href=\"https:\/\/r.nsini.com\/hi2hy1bWg\">https:\/\/r.nsini.com\/hi2hy1bWg<\/a><\/li>\n<\/ul>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-10766\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2019\/11\/20191126_072427.jpeg\" alt=\"\" width=\"750\" height=\"1334\" \/><\/p>\n<p>\u82e5\u6536\u5230\u6210\u529f\u53d1\u5e03\u7684\u4fe1\u606f\uff0c\u90a3\u5e94\u7528\u5c31\u7b97\u662f\u542f\u52a8\u6210\u529f\u4e86\u3002<\/p>\n<p>\u540e\u7eed\u82e5\u8981\u5347\u7ea7\u5e94\u7528\uff0c\u5e94\u7528\u521b\u5efa\u8005\u6216\u7ec4\u6210\u5458\u53ef\u4ee5\u76f4\u63a5\u5728\u5e94\u7528\u8be6\u60c5\u9875\u9009\u62e9<strong>\u201cBuild\u201d<\/strong>\u6309\u94ae\u5e76\u4e14\u9009\u62e9\u76f8\u5e94\u7528\u7248\u672c\u5c31\u597d\u4e86\u3002<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-10767\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2019\/11\/20191126_072441.jpeg\" alt=\"\" width=\"1072\" height=\"588\" \/><\/p>\n<p>\u56de\u6eda\u5e94\u7528\u4e5f\u540c\u6837\u65b9\u4fbf:<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-10768\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2019\/11\/20191126_072453.jpeg\" alt=\"\" width=\"1280\" height=\"873\" \/><\/p>\n<p>\u53ea\u9700\u8981\u70b9\u51fb<strong>\u201c\u56de\u6eda\u201d<\/strong>\u6309\u94ae\uff0c\u5728\u5f39\u51fa\u7684\u7a97\u53e3\u9009\u62e9\u6240\u9700\u8981\u56de\u6eda\u7684\u7248\u672c\uff0c\u70b9\u51fb\u3010\u201c\u56de\u6eda\u201d\u3011\u5e76\u786e\u8ba4\uff0c\u5e73\u53f0\u4f1a\u5c06\u8be5\u7248\u672c\u7684Docker Image\u8fdb\u884c\u542f\u52a8\u3002<\/p>\n<h3>\u751f\u6210\u5916\u95ee\u5730\u5740<\/h3>\n<p>\u5b8c\u6210\u4e4b\u540e\uff0c\u4e3a\u4e86\u8ba9\u5916\u90e8\u53ef\u4ee5\u8bbf\u95ee\u5230\u8be5\u4ee3\u7406\uff0c\u9700\u8981\u751f\u6210\u4e00\u4e2a\u5bf9\u5916\u53ef\u8bbf\u95ee\u7684\u5730\u5740\u3002<\/p>\n<p>\u5728\u5e94\u7528\u8be6\u60c5\u7684\u6700\u4e0b\u65b9\u6709\u4e00\u4e2a\u201c\u5916\u90e8\u5730\u5740\u201d\u7684\u5361\u7247\uff0c\u82e5\u662f\u7b2c\u4e00\u6b21\u521b\u5efa\u5e94\u7528\uff0c\u5728\u5361\u7247\u7684header\u7684\u53f3\u8fb9\u6709\u4e00\u4e2a\u6709<strong>\u201c\u6dfb\u52a0\u201d<\/strong>\u6309\u94ae\u70b9\u51fb\u5b83\uff0c\u5e76\u786e\u8ba4\u5c31\u53ef\u4ee5\u751f\u6210\u4e00\u4e2a\u5916\u90e8\u5730\u5740\u4e86\u3002<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-10769\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2019\/11\/20191126_072507.jpeg\" alt=\"\" width=\"1280\" height=\"165\" \/><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-10770\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2019\/11\/20191126_072520.jpeg\" alt=\"\" width=\"1280\" height=\"336\" \/><\/p>\n<p>\u4e0a\u9762\u5c31\u662f\u751f\u6210\u7684\u5730\u5740\uff0c\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u8fd9\u4e2a\u5730\u5740\u8bbf\u95ee\u5230shorter\u5e94\u7528\u3002<\/p>\n<h2>\u6d4b\u8bd5<\/h2>\n<p>\u6211\u8fd9\u90e8\u7f72\u4e86\u4e00\u4e2a\u751f\u901a\u8fc7\u77ed\u57df\u540d\u89e3\u6790\u5230\u8be5\u5e94\u7528\u4e0a\u7684\u4f8b\u5b50\uff0c\u70b9\u51fb\u4e0b\u9762\u5730\u5740\u8fdb\u884c\u77ed\u94fe\u751f\u6210\u9875\u9762\u3002<\/p>\n<ul>\n<li><a href=\"https:\/\/r.nsini.com\">https:\/\/r.nsini.com<\/a><\/li>\n<\/ul>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-10771\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2019\/11\/20191126_072545.jpeg\" alt=\"\" width=\"1280\" height=\"653\" \/><\/p>\n<p>\u628a\u9700\u8981\u751f\u6210\u77ed\u94fe\u63a5\u7684\u5730\u5740\u8d34\u5230\u8f93\u5165\u6846\uff0c\u5e76\u70b9\u51fb<strong>\u201c\u751f\u6210\u77ed\u94fe\u201d<\/strong>\u6309\u94ae\u5373\u53ef\u751f\u6210\u3002<\/p>\n<p>\u70b9\u51fb<strong>\u201c\u590d\u5236\u201d<\/strong> \u6309\u94ae\u5373\u53ef\u5c06\u77ed\u5730\u5740\u590d\u5236\u5e76\u4f7f\u7528\u3002<\/p>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>shorter\uff1a\u4e00\u4e2a\u77ed\u94fe\u63a5\u5728\u7ebf\u751f\u6210&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/10746"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10746"}],"version-history":[{"count":4,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/10746\/revisions"}],"predecessor-version":[{"id":10773,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/10746\/revisions\/10773"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10746"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10746"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10746"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}