{"id":13319,"date":"2019-05-06T14:34:35","date_gmt":"2019-05-06T06:34:35","guid":{"rendered":"https:\/\/www.ptt.ai\/?page_id=13319"},"modified":"2019-09-27T15:54:40","modified_gmt":"2019-09-27T07:54:40","slug":"installation-ch","status":"publish","type":"page","link":"https:\/\/www.ptt.ai\/?page_id=13319","title":{"rendered":"\u5b89\u88dd\u8aaa\u660e"},"content":{"rendered":"<div id='av_section_1' class='avia-section main_color avia-section-default avia-no-border-styling avia-bg-style-scroll  avia-builder-el-0  el_before_av_image  avia-builder-el-first    container_wrap sidebar_right' style='background-color: #ffffff;  '  ><div class='container' ><main  role=\"main\" itemprop=\"mainContentOfPage\"  class='template-page content  av-content-small alpha units'><div class='post-entry post-entry-type-page post-entry-13319'><div class='entry-content-wrapper clearfix'>\n<section class=\"av_textblock_section \"  itemscope=\"itemscope\" itemtype=\"https:\/\/schema.org\/CreativeWork\" ><div class='avia_textblock less_wider_row av_inherit_color '  style='color:#444444; '  itemprop=\"text\" ><h1 dir=\"auto\" style=\"text-align: center;\" data-sourcepos=\"1:1-1:34\"><strong><span style=\"color: #333333;\">\u5b89\u88dd\u8aaa\u660e<\/span><\/strong><\/h1>\n<p><\/br><\/p>\n<p dir=\"auto\" data-sourcepos=\"3:1-3:447\">\n<h3 dir=\"auto\" data-sourcepos=\"7:1-7:13\"><\/h3>\n<h3><strong>Type of installation<\/strong><\/h3>\n<ol>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">SSH Tunnel<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Linode<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Digital Ocean<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">AWS<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">AWS Elastic Beanstalk (On-click deploy)<\/span><\/li>\n<\/ol>\n<h3 dir=\"auto\" data-sourcepos=\"7:1-7:13\"><strong>SSH Tunnel<\/strong><\/h3>\n<ol>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">ssh -L [rpcport-for-localhost]:localhost:[rpcport-for-remote-host] [username]@[remote-host]<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">ssh -L [httpport-for-localhost]:localhost:[httpport-for-remote-host] [username]@[remote-host]<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">.\/build\/bin\/gptt &#8211;testp2p &#8211;rpcport [port-for-remote-host] &#8211;httpaddr 127.0.0.1:[http-port] &#8211;exthttpaddr <\/span><a href=\"about:blank\"><span style=\"font-weight: 400;\">\/\/localhost:[httpport-for-localhost]<\/span><\/a><span style=\"font-weight: 400;\"> &#8211;extrpcaddr <\/span><a href=\"about:blank\"><span style=\"font-weight: 400;\">\/\/localhost:[rpcport-for-localhost]<\/span><\/a><\/li>\n<\/ol>\n<p><span style=\"font-weight: 400;\">(in browser) <\/span><a href=\"about:blank\"><span style=\"font-weight: 400;\">\/\/localhost:[httpport-for-localhost]<\/span><\/a><\/p>\n<h3 dir=\"auto\" data-sourcepos=\"7:1-7:13\"><b>Linode<\/b><\/h3>\n<ol>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Create Linode with Stackscript ID: 399252 (hsiaochuanheng \/ p.me-docker (go-pttai))<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Launch the console and ensure that the new linode is created successfully.<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">ssh -L 14779:localhost:14779 admin@[IP]<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">ssh -L 9774:localhost:9774 admin@[IP]<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">open browser and connect to <\/span><a href=\"\/\/localhost:9774\/\"><span style=\"font-weight: 400;\">\/\/localhost:9774<\/span><\/a><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Update (in admin@[IP]):<\/span><\/li>\n<\/ol>\n<p style=\"padding-left: 40px;\"><span style=\"color: #adadad;\">sudo -s<\/span><br \/>\n<span style=\"color: #adadad;\"> docker pull ailabstw\/go-pttai:latest<\/span><br \/>\n<span style=\"color: #adadad;\"> HTTPPORT=9774<\/span><br \/>\n<span style=\"color: #adadad;\"> APIPORT=14779<\/span><br \/>\n<span style=\"color: #adadad;\"> docker run -e HTTPPORT=${HTTPPORT} -e APIPORT=${APIPORT} -itd &#8211;restart=always -p 9487:9487 -p 127.0.0.1:9774:9774 -p 127.0.0.1:14779:14779 -v \/home\/admin\/pttai.docker:\/root\/.pttai &#8211;name go-pttai ailabstw\/go-pttai:latest gptt &#8220;&#8211;testp2p&#8221; &#8220;&#8211;httpdir&#8221; &#8220;\/static&#8221; &#8220;&#8211;httpaddr&#8221; &#8220;0.0.0.0:9774&#8221; &#8220;&#8211;rpcaddr&#8221; &#8220;0.0.0.0&#8221; &#8220;&#8211;exthttpaddr&#8221; &#8220;\/\/localhost:${HTTPPORT}&#8221; &#8220;&#8211;extrpcaddr&#8221; &#8220;\/\/localhost:${APIPORT}&#8221;<\/span><\/p>\n<h3 dir=\"auto\" data-sourcepos=\"7:1-7:13\"><b>Digital Ocean<\/b><\/h3>\n<ol>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Create docker-with-ubuntu in One-click Applications.<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Install \/ Update (in root@[IP]):<\/span><\/li>\n<\/ol>\n<p style=\"padding-left: 40px;\"><span style=\"font-weight: 400; color: #adadad;\">sudo -s<\/span><\/p>\n<p style=\"padding-left: 40px;\"><span style=\"font-weight: 400; color: #adadad;\">docker pull ailabstw\/go-pttai:latest<\/span><\/p>\n<p style=\"padding-left: 40px;\"><span style=\"font-weight: 400; color: #adadad;\">HTTPPORT=9774<\/span><\/p>\n<p style=\"padding-left: 40px;\"><span style=\"font-weight: 400; color: #adadad;\">APIPORT=14779<\/span><\/p>\n<p style=\"padding-left: 40px;\"><span style=\"font-weight: 400; color: #adadad;\">docker run -e HTTPPORT=${HTTPPORT} -e APIPORT=${APIPORT} -itd &#8211;restart=always -p 9487:9487 -p 127.0.0.1:9774:9774 -p 127.0.0.1:14779:14779 -v \/home\/admin\/pttai.docker:\/root\/.pttai &#8211;name go-pttai ailabstw\/go-pttai:latest gptt &#8220;&#8211;testp2p&#8221; &#8220;&#8211;httpdir&#8221; &#8220;\/static&#8221; &#8220;&#8211;httpaddr&#8221; &#8220;0.0.0.0:9774&#8221; &#8220;&#8211;rpcaddr&#8221; &#8220;0.0.0.0&#8221; &#8220;&#8211;exthttpaddr&#8221; &#8220;\/\/localhost:${HTTPPORT}&#8221; &#8220;&#8211;extrpcaddr&#8221; &#8220;\/\/localhost:${APIPORT}&#8221;<\/span><\/p>\n<ol start=\"3\">\n<li style=\"font-weight: 400;\">ssh -L 14779:localhost:14779 root@[IP]<\/li>\n<li style=\"font-weight: 400;\">ssh -L 9774:localhost:9774 root@[IP]<\/li>\n<li style=\"font-weight: 400;\">open browser and connect to <a href=\"\/\/localhost:9774\/\">\/\/localhost:9774<\/a><\/li>\n<\/ol>\n<h3 dir=\"auto\" data-sourcepos=\"7:1-7:13\"><b>AWS<\/b><\/h3>\n<ol>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Setup Key Pair in <\/span><a href=\"\/\/console.aws.amazon.com\/ec2\/home#KeyPairs\"><span style=\"font-weight: 400;\">AWS ec2 console<\/span><\/a><span style=\"font-weight: 400;\">. (for SSH use)<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Setup Security Group in <\/span><a href=\"\/\/console.aws.amazon.com\/ec2\/home#SecurityGroups\"><span style=\"font-weight: 400;\">AWS ec2 console<\/span><\/a>\n<ul>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Be sure to have port 22, 9487, 9774, 14779 open to 0.0.0.0\/0<\/span><\/li>\n<\/ul>\n<\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Create an <\/span><a href=\"\/\/console.aws.amazon.com\/ecs\"><span style=\"font-weight: 400;\">ECS cluster<\/span><\/a><span style=\"font-weight: 400;\"> with the correpsonding Key Pair and Security Group.<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Install \/ Update (in ec2-user@[IP]):<\/span><\/span><span style=\"font-weight: 400; color: #adadad;\"><br \/>\nsudo -s<\/span><span style=\"font-weight: 400; color: #adadad;\">docker pull ailabstw\/go-pttai:latest<\/span><span style=\"font-weight: 400; color: #adadad;\">HTTPPORT=9774<\/span><span style=\"font-weight: 400; color: #adadad;\">APIPORT=14779<\/span><span style=\"font-weight: 400; color: #adadad;\">docker run -e HTTPPORT=${HTTPPORT} -e APIPORT=${APIPORT} -itd &#8211;restart=always -p 9487:9487 -p 127.0.0.1:9774:9774 -p 127.0.0.1:14779:14779 -v \/home\/admin\/pttai.docker:\/root\/.pttai &#8211;name go-pttai ailabstw\/go-pttai:latest gptt &#8220;&#8211;testp2p&#8221; &#8220;&#8211;httpdir&#8221; &#8220;\/static&#8221; &#8220;&#8211;httpaddr&#8221; &#8220;0.0.0.0:9774&#8221; &#8220;&#8211;rpcaddr&#8221; &#8220;0.0.0.0&#8221; &#8220;&#8211;exthttpaddr&#8221; &#8220;\/\/localhost:${HTTPPORT}&#8221; &#8220;&#8211;extrpcaddr&#8221; &#8220;\/\/localhost:${APIPORT}&#8221;<\/span><\/li>\n<li><span style=\"font-weight: 400;\">ssh -L 14779:localhost:14779 ec2-user@[IP]<\/span><\/li>\n<li><span style=\"font-weight: 400;\">ssh -L 9774:localhost:9774 ec2-user@[IP]<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">open browser and connect to <\/span><a href=\"\/\/localhost:9774\/\"><span style=\"font-weight: 400;\">\/\/localhost:9774<\/span><\/a><\/li>\n<\/ol>\n<ol>\n<li style=\"list-style-type: none;\"><\/li>\n<\/ol>\n<h3><b>AWS Elastic Beanstalk (On-click deploy)<\/b><\/h3>\n<ol>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Setup Key Pair in <\/span><a href=\"\/\/console.aws.amazon.com\/ec2\/home#KeyPairs\"><span style=\"font-weight: 400;\">AWS ec2 console<\/span><\/a><span style=\"font-weight: 400;\">. (for SSH use)<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Please remeber where you save the private key in your computer, you will need it at the last step.<\/span><\/li>\n<li style=\"font-weight: 400;\"><a href=\"\/\/console.aws.amazon.com\/elasticbeanstalk\/?region=ap-northeast-1#\/newApplication?applicationName=My.P.Me&#038;platform=Multi-container%20Docker&#038;sourceBundleUrl=https%3A%2F%2Fs3-ap-northeast-1.amazonaws.com%2Fptt.ai%2Fpme.zip&#038;environmentType=SingleInstance&#038;tierName=WebServer&#038;instanceType=m1.small\"><span style=\"font-weight: 400;\">Click this link<\/span><\/a><\/li>\n<li style=\"font-weight: 400;\"><i><span style=\"font-weight: 400;\">This will deploy the pre-build <\/span><\/i><a href=\"\/\/hub.docker.com\/r\/secret104278\/pme\"><i><span style=\"font-weight: 400;\">p.me docker image<\/span><\/i><\/a><i><span style=\"font-weight: 400;\"> for you<\/span><\/i><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Click choice option <\/span><span style=\"font-weight: 400;\">Upload your code<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">(Note: the code is already uploaded for you, you only have to click this option. This seems to be a bug of AWS.)<\/span><\/li>\n<\/ol>\n<\/div><\/section>\n<\/div><\/div><\/main><!-- close content main element --><\/div><\/div><div id='after_section_1' class='main_color av_default_container_wrap container_wrap sidebar_right' style=' '  ><div class='container' ><div class='template-page content  av-content-small alpha units'><div class='post-entry post-entry-type-page post-entry-13319'><div class='entry-content-wrapper clearfix'><div class='avia-image-container  av-styling-    avia-builder-el-2  el_after_av_section  el_before_av_image  avia-builder-el-first   avia-align-center '  itemprop=\"ImageObject\" itemscope=\"itemscope\" itemtype=\"https:\/\/schema.org\/ImageObject\"  ><div class='avia-image-container-inner'><div class='avia-image-overlay-wrap'><img class='avia_image' src='https:\/\/www.ptt.ai\/wp-content\/uploads\/2019\/05\/doc_1.png' alt='' title='doc_1' height=\"336\" width=\"512\"  itemprop=\"thumbnailUrl\"  \/><\/div><\/div><\/div><\/p>\n<div class='avia-image-container  av-styling-    avia-builder-el-3  el_after_av_image  el_before_av_textblock   avia-align-center '  itemprop=\"ImageObject\" itemscope=\"itemscope\" itemtype=\"https:\/\/schema.org\/ImageObject\"  ><div class='avia-image-container-inner'><div class='avia-image-overlay-wrap'><img class='avia_image' src='https:\/\/www.ptt.ai\/wp-content\/uploads\/2019\/05\/doc_2.png' alt='' title='doc_2' height=\"355\" width=\"512\"  itemprop=\"thumbnailUrl\"  \/><\/div><\/div><\/div>\n<section class=\"av_textblock_section \"  itemscope=\"itemscope\" itemtype=\"https:\/\/schema.org\/CreativeWork\" ><div class='avia_textblock less_wider_row '   itemprop=\"text\" ><ol start=\"9\">\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Chose the key pair you just setup in <\/span><span style=\"font-weight: 400;\">EC2 key pair<\/span><span style=\"font-weight: 400;\">\uff0cthen <\/span><span style=\"font-weight: 400;\">Save<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Click button <\/span><span style=\"font-weight: 400;\">Create app<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">ssh -L 14779:localhost:14779 ec2-user@[IP]<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">ssh -L 9774:localhost:9774 ec2-user@[IP]<\/span><\/li>\n<li style=\"font-weight: 400;\">open browser and connect to <a style=\"text-align: center;\" href=\"\/\/localhost:9774\/\">\/\/localhost:9774<\/a><\/li>\n<\/ol>\n<\/div><\/section>\n<div class='avia-button-wrap avia-button-center  avia-builder-el-5  el_after_av_textblock  avia-builder-el-last  '><a href='https:\/\/www.ptt.ai\/?page_id=6898'  class='avia-button   avia-icon_select-yes-left-icon avia-color-theme-color avia-size-x-large avia-position-center '   ><span class='avia_button_icon avia_button_icon_left ' aria-hidden='true' data-av_icon='\ue880' data-av_iconfont='entypo-fontello'><\/span><span class='avia_iconbox_title' >\u8fd4\u56de\u524d\u9801<\/span><\/a><\/div>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0},"_links":{"self":[{"href":"https:\/\/www.ptt.ai\/index.php?rest_route=\/wp\/v2\/pages\/13319"}],"collection":[{"href":"https:\/\/www.ptt.ai\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.ptt.ai\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.ptt.ai\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ptt.ai\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=13319"}],"version-history":[{"count":7,"href":"https:\/\/www.ptt.ai\/index.php?rest_route=\/wp\/v2\/pages\/13319\/revisions"}],"predecessor-version":[{"id":13516,"href":"https:\/\/www.ptt.ai\/index.php?rest_route=\/wp\/v2\/pages\/13319\/revisions\/13516"}],"wp:attachment":[{"href":"https:\/\/www.ptt.ai\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=13319"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}