{"id":3159,"date":"2016-07-07T12:23:40","date_gmt":"2016-07-07T11:23:40","guid":{"rendered":"http:\/\/www.gamlor.info\/wordpress\/?p=3159"},"modified":"2021-03-11T09:42:57","modified_gmt":"2021-03-11T08:42:57","slug":"joyents-triton-lets-start","status":"publish","type":"post","link":"https:\/\/www.gamlor.info\/wordpress\/2016\/07\/joyents-triton-lets-start\/","title":{"rendered":"Joyent&#8217;s Triton: Let&#8217;s Start"},"content":{"rendered":"<p>You know Docker? Right, these days everyone knows Docker. However, how do you deploy your Docker containers? You have a bunch of Linux servers and upload the Docker containers to there. You&#8217;ve many Server and many containers, which containers goes to what server? Does your Linux server run on a VM? Does running your app running on top of two operating systems and Docker make it any faster?<br \/>\n<div id=\"attachment_3171\" style=\"width: 295px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2016\/07\/cant-hear-you-en.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-3171\" src=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2016\/07\/cant-hear-you-en-285x300.jpg\" alt=\"Using two operating systems\" width=\"285\" height=\"300\" class=\"size-medium wp-image-3171\" srcset=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2016\/07\/cant-hear-you-en-285x300.jpg 285w, https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2016\/07\/cant-hear-you-en-768x809.jpg 768w, https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2016\/07\/cant-hear-you-en.jpg 972w\" sizes=\"(max-width: 285px) 100vw, 285px\" \/><\/a><p id=\"caption-attachment-3171\" class=\"wp-caption-text\">Using two operating systems<\/p><\/div><br \/>\nI just want to use Docker containers. I don&#8217;t want to worry about servers and operating systems. With Joyent Triton I can do that. This post is a small introduction. Maybe I&#8217;ll write more about Triton ;).<\/p>\n<p>Joyent Triton is open source. However, I will use Joyents AWS like public cloud service here.<\/p>\n<h3>Preparing<\/h3>\n<p>First we have to create a Joyent account. Probably also need to register a credit card (I don&#8217;t remember it well). And you have to add your <a href=\"https:\/\/my.joyent.com\/main\/#!\/account\">SSH-Key<\/a>.<br \/>\n<a href=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2016\/07\/signup.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-3152\" src=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2016\/07\/signup-300x293.png\" alt=\"Sigup\" width=\"300\" height=\"293\" srcset=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2016\/07\/signup-300x293.png 300w, https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2016\/07\/signup-768x750.png 768w, https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2016\/07\/signup.png 944w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>You&#8217;ve <a href=\"https:\/\/www.docker.com\/\">Docker<\/a> already installed, right? Otherwise do that too.<br \/>\nWe also need the Triton app, which need Node.js with npm. On my computer node.js 4.x didn&#8217;t seem to work, so install  <a href=\"https:\/\/nodejs.org\/en\/\">nodejs 6.x<\/a>. Then install Triton via npm:<br \/>\n<script src=\"https:\/\/gist.github.com\/263c05fa68cff94b754df3bf55deab4d.js?file=install-triton-cmd.sh\"><\/script><noscript><pre><code class=\"language-shell shell\">sudo npm install triton -g<\/code><\/pre><\/noscript><br \/>\nLast, we need to configure the Triton app. We&#8217;ll need the Joyent account id, the datacenter name and the location of your ssh key:<br \/>\n<script src=\"https:\/\/gist.github.com\/263c05fa68cff94b754df3bf55deab4d.js?file=create-profile.sh\"><\/script><noscript><pre><code class=\"language-shell shell\">gamlor@minty ~ $ triton profile create\n    A profile name. A short string to identify a CloudAPI endpoint to the\n    `triton` CLI.\n    name: us-west-1\n    \n    The CloudAPI endpoint URL.\n    url: https:\/\/us-west-1.api.joyent.com\n    \n    Your account login name.\n    account: Gamlor\n    \n    The fingerprint of the SSH key you have registered for your account.\n    Alternatively, You may enter a local path to a public or private SSH key to\n    have the fingerprint calculated for you.\n    keyId: ~\/.ssh\/id_rsa\n    Fingerprint: 07:9a:a5:c8:07:82:72:82:63:ce:5b:e3:e6:bf:83:61\n    \n    Saved profile &quot;us-west-1&quot;.\n    Setting up profile &quot;us-west-1&quot; to use Docker.\n    Setup profile &quot;us-west-1&quot; to use Docker (v1.10.3). Try this:\n        eval &quot;$(triton env --docker us-west-1)&quot;\n        docker info\n    Set &quot;us-west-1&quot; as current profile (because it is your only profile).\n<\/code><\/pre><\/noscript><\/p>\n<h3>Let&#8217;s Start<\/h3>\n<p>First, we have to change to the Triton environment. That way when using Docker, it will talk to Triton:<br \/>\n<script src=\"https:\/\/gist.github.com\/263c05fa68cff94b754df3bf55deab4d.js?file=switch-env.sh\"><\/script><noscript><pre><code class=\"language-shell shell\">#What enviroment will be setup\ngamlor@minty ~ $ triton env\n#Ok...let&#039;s set it up\ngamlor@minty ~ $ eval $(triton env)\n<\/code><\/pre><\/noscript><br \/>\nThen we deploy a Docker container. We just use the regular Docker commands. A web server example: First use <code>docker run<\/code> to start the container, then <code>docker ps<\/code> to see your containers and <code>docker inspect<\/code> to find the IP address:<br \/>\n<script src=\"https:\/\/gist.github.com\/263c05fa68cff94b754df3bf55deab4d.js?file=first-container.sh\"><\/script><noscript><pre><code class=\"language-shell shell\">#Let&#039;s nginx\nroman@minty ~ $ docker run -d -p 80 --name blog-server nginx\n  Unable to find image &#039;nginx:latest&#039; locally\n  latest: Pulling from nginx (req 49871310-4381-11e6-8f6a-1d7cd58ced5b)\n  6685b2154893: Already exists \n  a2295636c7aa: Already exists \n  3035387b9e83: Already exists \n  963493e54e68: Already exists \n  968c69f18673: Already exists \n  755b4eb93a9e: Already exists \n  f3b2532b0301: Already exists \n  f3bf4daa2ff2: Already exists \n  Digest: sha256:1fd7247f7bdb19ab1ccabb53ec5ecfa31e2ea39a24dfe636f78265980f4eebfb\n  Status: Image is up to date for nginx:latest\n  4f0cb241c17b4de4ad7e8c813f0d48c19a5c209a8eae4ce19e142770684adb5\n  \n#Check it running\nroman@minty$ docker ps -a\n  CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                         NAMES\n  4f0cb241c17b        nginx               &quot;nginx -g &#039;daemon off&quot;   2 minutes ago       Up About a minute   0.0.0.0:80-&gt;80\/tcp, 443\/tcp   blog-server\n\n#What IP do we have?\nroman@minty$ docker inspect --format &#039;{{ .NetworkSettings.IPAddress }}&#039; blog-server\n  8.19.33.77\n<\/code><\/pre><\/noscript><\/p>\n<p>And, really the container did start and is running. Check it by using the IP address:<br \/>\n<a href=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2016\/07\/ngnix-works.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-3155 size-medium\" src=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2016\/07\/ngnix-works-300x170.png\" alt=\"ngnix works!\" width=\"300\" height=\"170\" srcset=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2016\/07\/ngnix-works-300x170.png 300w, https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2016\/07\/ngnix-works.png 750w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Easy!<br \/>\n<a href=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2016\/07\/can-hear-you-en-1.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2016\/07\/can-hear-you-en-1-262x300.jpg\" alt=\"can-hear-you-en\" width=\"262\" height=\"300\" class=\"aligncenter size-medium wp-image-3191\" srcset=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2016\/07\/can-hear-you-en-1-262x300.jpg 262w, https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2016\/07\/can-hear-you-en-1-768x881.jpg 768w, https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2016\/07\/can-hear-you-en-1-893x1024.jpg 893w, https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2016\/07\/can-hear-you-en-1.jpg 900w\" sizes=\"(max-width: 262px) 100vw, 262px\" \/><\/a><\/p>\n<p>Don&#8217;t forget to stop you&#8217;re container:<br \/>\n<script src=\"https:\/\/gist.github.com\/263c05fa68cff94b754df3bf55deab4d.js?file=stop.sh\"><\/script><noscript><pre><code class=\"language-shell shell\">roman@minty ~ $ docker rm -f blog-server\n  blog-server\n<\/code><\/pre><\/noscript><\/p>\n<h2>Done for today<\/h2>\n<p>I&#8217;ll (hope to) write more blog posts \ud83d\ude09<\/p>\n","protected":false},"excerpt":{"rendered":"<p>You know Docker? Right, these days everyone knows Docker. However, how do you deploy your Docker containers? You have a bunch of Linux servers and upload the Docker containers to&hellip; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","_links_to":"","_links_to_target":""},"categories":[268,187],"tags":[300,301,302],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.gamlor.info\/wordpress\/wp-json\/wp\/v2\/posts\/3159"}],"collection":[{"href":"https:\/\/www.gamlor.info\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gamlor.info\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gamlor.info\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gamlor.info\/wordpress\/wp-json\/wp\/v2\/comments?post=3159"}],"version-history":[{"count":17,"href":"https:\/\/www.gamlor.info\/wordpress\/wp-json\/wp\/v2\/posts\/3159\/revisions"}],"predecessor-version":[{"id":3192,"href":"https:\/\/www.gamlor.info\/wordpress\/wp-json\/wp\/v2\/posts\/3159\/revisions\/3192"}],"wp:attachment":[{"href":"https:\/\/www.gamlor.info\/wordpress\/wp-json\/wp\/v2\/media?parent=3159"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gamlor.info\/wordpress\/wp-json\/wp\/v2\/categories?post=3159"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gamlor.info\/wordpress\/wp-json\/wp\/v2\/tags?post=3159"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}