{"id":459,"date":"2013-08-24T18:29:00","date_gmt":"2013-08-24T23:29:00","guid":{"rendered":"http:\/\/www.aibistin.com\/?p=459"},"modified":"2020-04-11T14:11:12","modified_gmt":"2020-04-11T18:11:12","slug":"deploying-my-perl-application-to-dotcloud","status":"publish","type":"post","link":"https:\/\/www.aibistin.com\/?p=459","title":{"rendered":"Deploying My Perl Application to dotCloud"},"content":{"rendered":"<p><strong>Note<\/strong>:<span style=\"color: #0000ff;\"> dotCloud has since been renamed to <a style=\"color: #0000ff;\" href=\"https:\/\/hub.docker.com\/\" target=\"_blank\" rel=\"noopener noreferrer\">docker or &#8220;docker hub&#8221;<\/a><\/span><\/p>\n<p class=\"important\"><a title=\"dotCloud\" href=\"https:\/\/www.dotcloud.com\/\" target=\"_blank\" rel=\"noopener noreferrer\">dotCloud<\/a> provides an easy way for you to show your Web application to the world.<\/p>\n<p class=\"code-heading\">This is how I deployed my <a class=\"vital-link\" title=\"CarryOnMoving Net\" href=\"http:\/\/www.carryonmoving.net\/quick\" target=\"_blank\" rel=\"noopener noreferrer\">Moving Company Travel Time Calculator<\/a> on dotCloud.<\/p>\n<p><span class=\"code-description\">Create the dotCloud application.<\/span><\/p>\n<pre><pre class=\"brush: css; auto-links: false; collapse: false; first-line: 1; gutter: true; light: true; pad-line-numbers: false; smart-tabs: false; tab-size: 4; title: Create command and its output.; toolbar: true; notranslate\" title=\"Create command and its output.\">\ntraveltime &amp;amp;amp;amp;amp;amp;amp;amp;amp;gt; dotcloud create traveltime\n    ==&amp;amp;amp;amp;amp;amp;amp;amp;amp;gt; Creating a live application named &quot;traveltime&quot;\n    ==&amp;amp;amp;amp;amp;amp;amp;amp;amp;gt; Application &quot;traveltime&quot; created.\n        Connect the current directory to &quot;traveltime&quot;? &#x5B;Y\/n]: Y\n    ==&amp;amp;amp;amp;amp;amp;amp;amp;amp;gt; Connecting with the application &quot;traveltime&quot;\n    ==&amp;amp;amp;amp;amp;amp;amp;amp;amp;gt; Connected with default push options: --rsync\n<\/pre>\n<p>It looks like the application has been created. I then created a configuration file, &#8220;dotcloud.yml&#8221;.<\/p>\n<pre><pre class=\"brush: css; auto-links: false; collapse: false; first-line: 1; gutter: true; light: true; pad-line-numbers: false; smart-tabs: false; tab-size: 4; title: Config file dotcloud.yml; toolbar: true; notranslate\" title=\"Config file dotcloud.yml\">\nwww:\n  type: perl\n  approot: traveltime\n  requirements:\n    - App::cpanminus\n<\/pre>\n<p>Then connect..<\/p>\n<pre><pre class=\"brush: css; auto-links: false; collapse: false; first-line: 1; gutter: true; light: true; pad-line-numbers: false; smart-tabs: false; tab-size: 4; title: Connect; toolbar: true; notranslate\" title=\"Connect\">\ntraveltime &amp;amp;amp;amp;amp;amp;amp;amp;amp;gt; dotcloud connect traveltime\n    ==&amp;amp;amp;amp;amp;amp;amp;amp;amp;gt; Connecting with the application &quot;traveltime&quot;\n    ==&amp;amp;amp;amp;amp;amp;amp;amp;amp;gt; Connected with default push options: --rsync\n<\/pre>\n<p>I need to tell &#8220;app.psgi&#8221; who my Dancer2 script is.<\/p>\n<pre><pre class=\"brush: css; auto-links: false; collapse: false; first-line: 1; gutter: true; light: true; pad-line-numbers: false; smart-tabs: false; tab-size: 4; title: ; toolbar: true; notranslate\" title=\"\">\n\ntraveltime &amp;amp;amp;amp;amp;amp;amp;amp;amp;gt; echo &quot;require 'bin\/app.pl';&quot; &amp;amp;amp;amp;amp;amp;amp;amp;amp;gt; app.psgi\n\n<\/pre>\n<p>Then deploy the application<\/p>\n<pre><pre class=\"brush: css; auto-links: false; collapse: false; first-line: 1; gutter: true; light: true; pad-line-numbers: false; smart-tabs: false; tab-size: 4; title: ; toolbar: true; notranslate\" title=\"\">\n\ntraveltime &amp;amp;amp;amp;amp;amp;amp;amp;amp;gt; dotcloud push\n    ==&amp;amp;amp;amp;amp;amp;amp;amp;amp;gt; Pushing code with rsync from &quot;.\/&quot; to application traveltime\n        building file list ... done\n        .\/\n        dotcloud.yml\n        .dotcloud\/\n        .dotcloud\/config\n        traveltime\/\n        traveltime\/Changes\n        traveltime\/MANIFEST\n        traveltime\/MANIFEST.SKIP\n        traveltime\/Makefile.PL\n        traveltime\/README.pod\n         ...\n         14:34:17.360184: &#x5B;www] Successfully installed Dancer2-0.04\n         14:34:17.539632: &#x5B;www] &amp;amp;amp;amp;amp;amp;amp;amp;amp;lt;== Installed dependencies for .. Finishing.\n         14:34:17.540369: &#x5B;www] 49 distributions installed\n         14:34:22.529592: &#x5B;www] Build completed successfully. Compiled image size is 11MB\n         14:34:22.548716: &#x5B;www] Build successful for service (www)\n         14:34:22.563869: --&amp;amp;amp;amp;amp;amp;amp;amp;amp;gt; Application (traveltime) build is done\n         14:34:22.582326: --&amp;amp;amp;amp;amp;amp;amp;amp;amp;gt; Provisioning services... (This may take a few minutes)\n         14:34:22.599485: &#x5B;www] Using default scaling for service www (1 instance(s)).\n         14:34:22.651213: &#x5B;www] Using limits for service &quot;www&quot;: ram=64M\n         14:34:22.696068: &#x5B;www.0] Provisioning service (www) instance #0\n         14:34:27.002331: --&amp;amp;amp;amp;amp;amp;amp;amp;amp;gt; All services' instances have been provisioned. Installing code...\n         14:34:27.015045: &#x5B;www.0] Installing build revision rsync-1371306712243 for service (www) instance                    #0\n         14:34:34.852233: &#x5B;www.0] Running postinstall script...\n         14:34:35.582842: &#x5B;www.0] Launching...\n         14:34:36.905954: &#x5B;www.0] Waiting for the instance to become responsive...\n         14:34:37.910787: &#x5B;www.0] Re-routing traffic to the new build...\n         14:34:38.031666: &#x5B;www.0] Successfully installed build revision rsync-1371306712243 for service  (www) instance #0\n         14:34:38.039928: &#x5B;www.0] Installation successful for service (www) instance #0\n         14:34:38.043176: --&amp;amp;amp;amp;amp;amp;amp;amp;amp;gt; Application (traveltime) fully installed\n    ==&amp;amp;amp;amp;amp;amp;amp;amp;amp;gt; Application is live at http:\/\/traveltime-aibistin.dotcloud.com\n    &#x5B;10:34 - 0.20]\n    traveltime &amp;amp;amp;amp;amp;amp;amp;amp;amp;gt; \n\n<\/pre>\n<p>I then checked the URL http:\/\/traveltime-aibistin.dotcloud.com, which gave me an error.<br \/>\n<code><br \/>\n\"uWSGI Error<br \/>\nPerl application not found\"<br \/>\n<\/code><br \/>\nSo off to the log files to check what went wrong.<\/p>\n<pre><pre class=\"brush: css; auto-links: false; collapse: false; first-line: 1; gutter: true; light: true; pad-line-numbers: false; smart-tabs: false; tab-size: 4; title: ; toolbar: true; notranslate\" title=\"\">\n traveltime &amp;amp;amp;amp;amp;amp;amp;amp;amp;gt; dotcloud logs www\n&#x5B;www.0] ==&amp;amp;amp;amp;amp;amp;amp;amp;amp;gt; \/var\/log\/supervisor\/supervisord.log &amp;amp;amp;amp;amp;amp;amp;amp;amp;lt;==\n...\ncloud\/rsync-1371314776610\/traveltime\/config.conf: Cannot load \/home\/dotcloud\/rsync-1371314776610\/traveltime\/config.conf: required support modules are not available.\n&#x5B;www.0] Please install Config::General at \/home\/dotcloud\/perl5\/lib\/perl5\/Dancer2\/Core\/Role\/Config.pm line 97\n&#x5B;www.0]  at (eval 35) line 19\n&#x5B;www.0] BEGIN failed--compilation aborted at bin\/app.pl line 3.\n...\n&#x5B;www.0] ==&amp;amp;amp;amp;amp;amp;amp;amp;amp;gt; \/var\/log\/nginx\/access.log &amp;amp;amp;amp;amp;amp;amp;amp;amp;lt;==\n<\/pre>\n<p>So it looks like dotCloud couldn&#8217;t find Config::General CPAN module. It looks like I didn&#8217;t do such a good job managing my modules dependencies. I could have used the Behemoth of Module creation <a title=\"Dist::Zilla\" href=\"https:\/\/metacpan.org\/module\/Dist::Zilla\" target=\"_blank\" rel=\"noopener noreferrer\">Dist::Zilla<\/a> to do this. However as this is not an app that I wish to upload to CPAN, or install on my laptop I wanted an easier way.<\/p>\n<p>I came across this new <a title=\"Carton\" href=\"https:\/\/metacpan.org\/module\/Carton\" target=\"_blank\" rel=\"noopener noreferrer\">&#8220;Bundle I searched the <\/a><a title=\"Meta CPAN\" href=\"https:\/\/metacpan.org\/\" target=\"_blank\" rel=\"noopener noreferrer\">CPAN<\/a>for another way. r for Perl&#8221; developed by the prolific and excellent Pearl developer <a title=\"Tatsuhiko Miyagawa\" href=\"https:\/\/metacpan.org\/author\/MIYAGAWA\" target=\"_blank\" rel=\"noopener noreferrer\">Tatsuhiko Miyagawa<\/a>. So I figured it must be good. And it is. I won&#8217;t bore you with the details here, as you can read his documentation yourself.<\/p>\n<p>I now seem to have all my dependencies in order and I ran the &#8220;dotcloud push&#8221; command again. I ran into another problem. I was running Perl 5.12 on my Ubuntu laptop, and dotCloud needs at least Perl 5.14. Well I guess it was about time that I upgraded my Perl version. This took a while, as I decided to load <a title=\"Perlbrew\" href=\"\/module\/GUGOD\/App-perlbrew-0.66\/bin\/perlbrew\" target=\"_blank\" rel=\"noopener noreferrer\">perlbrew<\/a> to manage my Perl installations.<\/p>\n<p>I ran into a few glitches here and there, but I finally got it working with lots of help from <a title=\"Perlbrew Installation\" href=\"http:\/\/blog.fox.geek.nz\/2010\/09\/installing-multiple-perls-with.html\" target=\"_blank\" rel=\"noopener noreferrer\">KENTNL&#8217;s perlbrew blog<\/a>,and a little help from <a title=\"DA Golden perlbrew blog\" href=\"http:\/\/www.dagolden.com\/index.php\/2134\/how-i-manage-new-perls-with-perlbrew\/\">DA Golden&#8217;s blog<\/a>.<br \/>\nSo, it&#8217;s time to try again from scratch.<\/p>\n<pre><pre class=\"brush: css; auto-links: false; collapse: false; first-line: 1; gutter: true; light: true; pad-line-numbers: false; smart-tabs: false; tab-size: 4; title: ; toolbar: true; notranslate\" title=\"\">\n\ntraveltime &amp;amp;amp;amp;amp;amp;amp;amp;amp;gt; dotcloud destroy\n    Destroy the application &quot;traveltime&quot;? &#x5B;y\/N]: y\n    ==&amp;amp;amp;amp;amp;amp;amp;amp;amp;gt; Destroying &quot;traveltime&quot;\n\n<\/pre>\n<pre><pre class=\"brush: css; auto-links: false; collapse: false; first-line: 1; gutter: true; light: true; pad-line-numbers: false; smart-tabs: false; tab-size: 4; title: ; toolbar: true; notranslate\" title=\"\">\n\ndotcloud create traveltime\n    ==&amp;amp;amp;amp;amp;amp;amp;amp;amp;gt; Creating a live application named &quot;traveltime&quot;\n    ==&amp;amp;amp;amp;amp;amp;amp;amp;amp;gt; Application &quot;traveltime&quot; created.\n    Connect the current directory to &quot;traveltime&quot;? &#x5B;Y\/n]: y\n    ==&amp;amp;amp;amp;amp;amp;amp;amp;amp;gt; Connecting with the application &quot;traveltime&quot;\n    ==&amp;amp;amp;amp;amp;amp;amp;amp;amp;gt; Connected with default push options: --rsync\n\n<\/pre>\n<p>OK, looking good so far. Now, I have my dotCloud &#8220;traveltime&#8221; application up and running. I&#8217;m not too happy with the domain name that I have been issued by dotCloud, &#8220;http:\/\/traveltime-aibistin.dotcloud.com&#8221;.<br \/>\nSo, I decided to change this to one that I already have.<\/p>\n<pre><pre class=\"brush: css; auto-links: false; collapse: false; first-line: 1; gutter: true; light: true; pad-line-numbers: false; smart-tabs: false; tab-size: 4; title: ; toolbar: true; notranslate\" title=\"\">\n\nTravelTime &amp;amp;amp;amp;amp;amp;amp;amp;amp;gt; dotcloud domain add www www.carryonmoving.net\n    ==&amp;amp;amp;amp;amp;amp;amp;amp;amp;gt; domain &quot;www.carryonmoving.net&quot; created for &quot;www&quot;\n    ==&amp;amp;amp;amp;amp;amp;amp;amp;amp;gt; Now please add the following DNS record:\n        www.carryonmoving.net. IN CNAME gateway.dotcloud.com.\n\n<\/pre>\n<p>Then update my DNS settings on <a title=\"Cloudflare\" href=\"https:\/\/www.cloudflare.com\/\">CloudFlare<\/a> and I&#8217;m done.<\/p>\n<p class=\"important\">The &#8220;finished&#8221; (well almost) App <a class=\"vital-link\" title=\"CarryOnMoving Net\" href=\"http:\/\/www.carryonmoving.net\/quick\" target=\"_blank\" rel=\"noopener noreferrer\">Moving Company Travel Time Calculator can be viewed here<\/a>.<\/p>\n<p class=\"code-heading\">Useful Links<\/p>\n<p><span class=\"code-description\">This is where I got lots of helpful advice for this endeavour.<\/span><\/p>\n<ol class=\"vital-details\">\n<li><a title=\"dotCloud Perl Tutorial\" href=\"http:\/\/docs.dotcloud.com\/services\/perl\/\" target=\"_blank\" rel=\"noopener noreferrer\">dotCloud Perl Tutorial<\/a><\/li>\n<li><a title=\"Dancer2 Deployment\" href=\"https:\/\/metacpan.org\/module\/Dancer::Deployment#Hosting-on-DotCloud\" target=\"_blank\" rel=\"noopener noreferrer\">Dancer2 Deployment With dotCloud<\/a><\/li>\n<li><a title=\"Marco Fontani Perl Blog\" href=\"http:\/\/blogs.perl.org\/users\/marco_fontani\/2011\/04\/dancing-on-a-cloud-made-of-pearls.html\" target=\"_blank\" rel=\"noopener noreferrer\">Marco Fontani&#8217;s Dancer Deployment with dotCloud piece, on blogs.perl.org<\/a><\/li>\n<li><a title=\"Perl Mongers dotCloud\" href=\"http:\/\/www.slideshare.net\/daoswald\/deploying-perl-apps-on-dotcloud\" target=\"_blank\" rel=\"noopener noreferrer\">Perl Mongers dotCloud Presentation (which I just found)<\/a><\/li>\n<li><a title=\"Catalyst dotCloud blog\" href=\"http:\/\/blogs.perl.org\/users\/phillip_smith\/2011\/08\/dotcloud-loves-catalyst-apps-up-and-running-in-10-minutes-perl-in-the-cloud-part-iii.html\" target=\"_blank\" rel=\"noopener noreferrer\">Phillip Smith&#8217;s Catalyst with dotCloud piece, on blogs.perl.org<\/a><\/li>\n<\/ol>\n<p><a class=\"twitter-follow-button\" href=\"https:\/\/twitter.com\/aibistin\" data-show-count=\"false\">Follow @aibistin<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Note: dotCloud has since been renamed to docker or &#8220;docker hub&#8221; dotCloud provides an easy way for you to show your Web application to the world. This is how I deployed my Moving Company Travel Time Calculator on dotCloud. Create the dotCloud application. traveltime &amp;amp;amp;amp;amp;amp;amp;amp;amp;gt; dotcloud create traveltime ==&amp;amp;amp;amp;amp;amp;amp;amp;amp;gt; Creating a live application named &quot;traveltime&quot; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1],"tags":[7,21,19,39,27,20],"class_list":["post-459","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-dancer","tag-dancer2","tag-deploy","tag-docker","tag-dotcloud","tag-perl"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.aibistin.com\/index.php?rest_route=\/wp\/v2\/posts\/459","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.aibistin.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.aibistin.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.aibistin.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.aibistin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=459"}],"version-history":[{"count":42,"href":"https:\/\/www.aibistin.com\/index.php?rest_route=\/wp\/v2\/posts\/459\/revisions"}],"predecessor-version":[{"id":1048,"href":"https:\/\/www.aibistin.com\/index.php?rest_route=\/wp\/v2\/posts\/459\/revisions\/1048"}],"wp:attachment":[{"href":"https:\/\/www.aibistin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=459"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.aibistin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=459"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.aibistin.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=459"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}