{"id":22,"date":"2017-12-07T08:51:17","date_gmt":"2017-12-07T08:51:17","guid":{"rendered":"http:\/\/pramodbiligirisblog.home.blog\/2017\/12\/07\/rocking-it-with-docker-and-metaparticle\/"},"modified":"2017-12-07T08:51:17","modified_gmt":"2017-12-07T08:51:17","slug":"rocking-it-with-docker-and-metaparticle","status":"publish","type":"post","link":"https:\/\/www.pramodb.com\/index.php\/2017\/12\/07\/rocking-it-with-docker-and-metaparticle\/","title":{"rendered":"Rocking it with Docker and Metaparticle"},"content":{"rendered":"<p>My friend <a href=\"https:\/\/www.linkedin.com\/in\/sayedasadali\/\" target=\"_blank\" rel=\"noopener noreferrer\">Asad<\/a> messaged me from the ongoing <a href=\"http:\/\/events.linuxfoundation.org\/events\/kubecon-and-cloudnativecon-north-america\" target=\"_blank\" rel=\"noopener noreferrer\">KubeCon 2017<\/a> that a <a href=\"http:\/\/events.linuxfoundation.org\/events\/kubecon-and-cloudnativecon-north-america\/program\/schedule\" target=\"_blank\" rel=\"noopener noreferrer\">keynote<\/a> slide from Brendan Burns (one of the creators of Kubernetes) advocated that configuring your app for the cloud native world ought to become significantly simpler. That appealed to me instantly, since I too was wishing a few days ago that Docker and Kubernetes would work seamlessly from my language of choice (which is usually Java)\u200a\u2014\u200aand preferably, in tandem with my IDE of choice (which is of late IntelliJ); and all this without having to learn arcane commands and dealing with a bunch of YAML files\u00a0\ud83d\ude42<\/p>\n<p>So I took Burns\u2019 new <a href=\"https:\/\/metaparticle.io\/\" target=\"_blank\" rel=\"noopener noreferrer\">Metaparticle<\/a> library for a spin in the evening, and am glad to report that I went from \u201cNever tried Docker\u201d to using it successfully from a Java program, all in the space of a few hours! I haven\u2019t had success getting its Kubernetes executor to work yet, but hopefully that won\u2019t be too big a hurdle to jump over.<\/p>\n<p>In short, this is what I did, on my Ubuntu 17.04 VM:<\/p>\n<ul>\n<li>Installed docker (just ran the commands in this <a href=\"https:\/\/gist.github.com\/pramodbiligiri\/0e69260b3d4666d72ff0e353e8ae5d2e\" target=\"_blank\" rel=\"noopener noreferrer\">Gist<\/a>)<\/li>\n<li>Cloned the <a href=\"https:\/\/github.com\/metaparticle-io\/metaparticle-java\" target=\"_blank\" rel=\"noopener noreferrer\">metaparticle-java<\/a> repository and did a mvn clean install of the same<\/li>\n<li>Created a new account on the docker.io website, and created a repository called \u201ctest\u201d within my account<\/li>\n<li>Cloned the <a href=\"https:\/\/github.com\/metaparticle-io\/package\" target=\"_blank\" rel=\"noopener noreferrer\">metaparticle-package<\/a> repository, with an eye on running this Java <a href=\"https:\/\/github.com\/metaparticle-io\/package\/blob\/master\/java\/src\/main\/java\/io\/metaparticle\/examples\/web\/Main.java#L16\" target=\"_blank\" rel=\"noopener noreferrer\">web example<\/a> class therein<\/li>\n<li>Commented out the \u201cexecutor\u201d property of the Runtime annotation (it defaults to \u201cdocker\u201d)<\/li>\n<li>Changed the \u201crepository\u201d property of the Package annotation to docker.io\/my-docker-user-name<\/li>\n<li>Compiled the code in <a href=\"https:\/\/github.com\/metaparticle-io\/package\/tree\/master\/java\" target=\"_blank\" rel=\"noopener noreferrer\">metaparticle-package\/java<\/a> directory with mvn clean install<\/li>\n<li>Logged into docker using sudo docker login (so that the docker push commands that would be executed by the example program work fine)<\/li>\n<li>Downloaded the linux-amd64 version of <a href=\"https:\/\/github.com\/metaparticle-io\/metaparticle-ast\/releases\" target=\"_blank\" rel=\"noopener noreferrer\">mp-compiler<\/a> and added it to the $PATH environment variable<\/li>\n<li>Then I ran the example, again through Maven:<br \/>mvn exec:java -Dexec.mainClass=io.metaparticle.examples.web.Main<\/li>\n<\/ul>\n<p>And that was it! Browsing to <a href=\"http:\/\/localhost:8080\" target=\"_blank\" rel=\"noopener noreferrer\">http:\/\/localhost:8080<\/a> showed me this text:<\/p>\n<p>Hello containers [\/] from e6ddee21ff84<\/p>\n<p>And I can verify that the app is indeed running within docker:<\/p>\n<p>pramod@deepwork:~$ docker ps -a<br \/>CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES<br \/>e6ddee21ff84 pramodbiligiri\/test \u201c\/bin\/sh -c \u2018java\u00a0\u2026\u201d 14 seconds ago Up 13 seconds 0.0.0.0:8080-&gt;8080\/tcp web<\/p>\n<p>It is nice to see more focus on developer experience. I feel that unless you are in the business of making applications run on the cloud, you should avoid burdening developers with having to learn the machinery that is used to make that happen.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>My friend Asad messaged me from the ongoing KubeCon 2017 that a keynote slide from Brendan Burns (one of the creators of Kubernetes) advocated that configuring your app for the cloud native world ought to become significantly simpler. That appealed to me instantly, since I too was wishing a few days ago that Docker and [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":""},"categories":[1],"tags":[11],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/www.pramodb.com\/index.php\/wp-json\/wp\/v2\/posts\/22"}],"collection":[{"href":"https:\/\/www.pramodb.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.pramodb.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.pramodb.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.pramodb.com\/index.php\/wp-json\/wp\/v2\/comments?post=22"}],"version-history":[{"count":0,"href":"https:\/\/www.pramodb.com\/index.php\/wp-json\/wp\/v2\/posts\/22\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.pramodb.com\/index.php\/wp-json\/wp\/v2\/media?parent=22"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.pramodb.com\/index.php\/wp-json\/wp\/v2\/categories?post=22"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.pramodb.com\/index.php\/wp-json\/wp\/v2\/tags?post=22"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}