Skip to content

Instantly share code, notes, and snippets.

@mfontani
Created April 29, 2011 23:06
Show Gist options
  • Save mfontani/949192 to your computer and use it in GitHub Desktop.
Save mfontani/949192 to your computer and use it in GitHub Desktop.
Deploying a dancer webapp to DotCloud.com
Dancing on the cloud
okram@BLUEDESK ~> sudo aptitude install python-setuptools
[...]
okram@BLUEDESK ~> sudo easy_install dotcloud
[...]
okram@BLUEDESK ~> dotcloud
Warning: /home/okram/.dotcloud/dotcloud.conf does not exist.
Enter your api key (You can find it at http://www.dotcloud.com/account/settings): XXXXXXXXXXXXXXXXXXXXXXXXX
error: usage: dotcloud [-h]
{status,info,run,logs,deploy,setup,list,alias,ssh,destroy,push,rollback,create,restart}
...
okram@BLUEDESK ~> dotcloud deploy -t perl weasel.www
Created "weasel.www".
okram@BLUEDESK ~> dotcloud info weasel.www
cluster: wolverine
config: {}
created_at: 1304117136.2035949
name: weasel.www
namespace: weasel
state: booting
type: perl
okram@BLUEDESK ~> mkdir -p GIT/weasel/www
okram@BLUEDESK ~> cd !$
okram@BLUEDESK ~/GIT/weasel/www> git init
Initialized empty Git repository in /home/okram/GIT/weasel/www/.git/
(M=init) okram@BLUEDESK ~/GIT/weasel/www> vi -p myapp.pl Makefile.PL app.psgi
3 files to edit
(M=init: Makefile.PL app.psgi myapp.pl) okram@BLUEDESK ~/GIT/weasel/www> git add * ; git commit -am "Hello"
[...]
(M=e4d8d8) okram@BLUEDESK ~/GIT/weasel/www> dotcloud push weasel.www .
# upload . ssh://[email protected]:1060/weasel.www
# git
Warning: Permanently added '[uploader.dotcloud.com]:1060,[174.129.15.77]:1060' (RSA) to the list of known hosts.
Counting objects: 5, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (5/5), 533 bytes, done.
Total 5 (delta 0), reused 0 (delta 0)
To ssh://[email protected]:1060/weasel.www
* [new branch] master -> master
Scheduling build
Fetching logs...
Warning: Permanently added '[www.weasel.dotcloud.com]:3254,[174.129.17.131]:3254' (RSA) to the list of known hosts.
-- Build started...
Makefile.PL
app.psgi
myapp.pl
Fetched code revision e4d8d81
--> Working on .
Configuring /home/dotcloud/e4d8d81 ... OK
==> Found dependencies: Dancer
--> Working on Dancer
Fetching http://search.cpan.org/CPAN/authors/id/X/XS/XSAWYERX/Dancer-1.3030.tar.gz ... OK
Configuring Dancer-1.3030 ... OK
==> Found dependencies: HTTP::Server::Simple::PSGI, HTTP::Body, MIME::Types
--> Working on HTTP::Server::Simple::PSGI
Fetching http://search.cpan.org/CPAN/authors/id/M/MI/MIYAGAWA/HTTP-Server-Simple-PSGI-0.14.tar.gz ... OK
Configuring HTTP-Server-Simple-PSGI-0.14 ... OK
==> Found dependencies: HTTP::Server::Simple
--> Working on HTTP::Server::Simple
Fetching http://search.cpan.org/CPAN/authors/id/J/JE/JESSE/HTTP-Server-Simple-0.44.tar.gz ... OK
Configuring HTTP-Server-Simple-0.44 ... OK
Building HTTP-Server-Simple-0.44 ... OK
Successfully installed HTTP-Server-Simple-0.44
Building HTTP-Server-Simple-PSGI-0.14 ... OK
Successfully installed HTTP-Server-Simple-PSGI-0.14
--> Working on HTTP::Body
Fetching http://search.cpan.org/CPAN/authors/id/G/GE/GETTY/HTTP-Body-1.12.tar.gz ... OK
Configuring HTTP-Body-1.12 ... OK
==> Found dependencies: Test::Deep
--> Working on Test::Deep
Fetching http://search.cpan.org/CPAN/authors/id/R/RJ/RJBS/Test-Deep-0.108.tar.gz ... OK
Configuring Test-Deep-0.108 ... OK
==> Found dependencies: Test::Tester, Test::NoWarnings
--> Working on Test::Tester
Fetching http://search.cpan.org/CPAN/authors/id/F/FD/FDALY/Test-Tester-0.107.tar.gz ... OK
Configuring Test-Tester-0.107 ... OK
Building Test-Tester-0.107 ... OK
Successfully installed Test-Tester-0.107
--> Working on Test::NoWarnings
Fetching http://search.cpan.org/CPAN/authors/id/A/AD/ADAMK/Test-NoWarnings-1.02.tar.gz ... OK
Configuring Test-NoWarnings-1.02 ... OK
Building Test-NoWarnings-1.02 ... OK
Successfully installed Test-NoWarnings-1.02
Building Test-Deep-0.108 ... OK
Successfully installed Test-Deep-0.108
Building HTTP-Body-1.12 ... OK
Successfully installed HTTP-Body-1.12
--> Working on MIME::Types
Fetching http://search.cpan.org/CPAN/authors/id/M/MA/MARKOV/MIME-Types-1.31.tar.gz ... OK
Configuring MIME-Types-1.31 ... OK
Building MIME-Types-1.31 ... OK
Successfully installed MIME-Types-1.31
Building Dancer-1.3030 ... OK
Successfully installed Dancer-1.3030
<== Installed dependencies for .. Finishing.
8 distributions installed
uwsgi: stopped
uwsgi: ERROR (abnormal termination)
Connection to www.weasel.dotcloud.com closed.
(M=e4d8d8) okram@BLUEDESK ~/GIT/weasel/www> dotcloud logs weasel.www
# tail -F /var/log/{supervisor,nginx}/*.log
Warning: Permanently added '[www.weasel.dotcloud.com]:3254,[174.129.17.131]:3254' (RSA) to the list of known hosts.
==> /var/log/supervisor/supervisord.log <==
2011-04-29 22:52:33,086 INFO gave up: uwsgi entered FATAL state, too many start retries too quickly
2011-04-29 22:53:34,980 INFO spawned: 'uwsgi' with pid 1083
2011-04-29 22:53:35,174 INFO exited: uwsgi (exit status 1; not expected)
2011-04-29 22:53:36,180 INFO spawned: 'uwsgi' with pid 1084
2011-04-29 22:53:36,390 INFO exited: uwsgi (exit status 1; not expected)
2011-04-29 22:53:38,397 INFO spawned: 'uwsgi' with pid 1085
2011-04-29 22:53:38,598 INFO exited: uwsgi (exit status 1; not expected)
2011-04-29 22:53:41,606 INFO spawned: 'uwsgi' with pid 1087
2011-04-29 22:53:41,810 INFO exited: uwsgi (exit status 1; not expected)
2011-04-29 22:53:42,811 INFO gave up: uwsgi entered FATAL state, too many start retries too quickly
==> /var/log/supervisor/uwsgi.log <==
compiled with version: 4.4.3 on 30 March 2011 06:14:59
writing pidfile to /var/dotcloud/uwsgi.pid
your memory page size is 4096 bytes
uwsgi socket 0 bound to UNIX address /var/dotcloud/uwsgi.sock fd 3
initializing Perl environment
your server socket listen backlog is limited to 100 connections
*** Operational MODE: single process ***
Plack::Request is needed by the PSGI handler at /home/dotcloud/perl5/lib/perl5/Dancer.pm line 334
Compilation failed in require at (eval 3) line 1.
[...]
(M=e4d8d8) okram@BLUEDESK ~/GIT/weasel/www> vi Makefile.PL
(M=e4d8d8: Makefile.PL) okram@BLUEDESK ~/GIT/weasel/www> git commit -am "Also Plack::Request"
[master faa342f] Also Plack::Request
1 files changed, 1 insertions(+), 0 deletions(-)
(M=faa342) okram@BLUEDESK ~/GIT/weasel/www> dotcloud push weasel.www .
# upload . ssh://[email protected]:1060/weasel.www
# git
Warning: Permanently added '[uploader.dotcloud.com]:1060,[174.129.15.77]:1060' (RSA) to the list of known hosts.
Counting objects: 5, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 381 bytes, done.
Total 3 (delta 1), reused 0 (delta 0)
To ssh://[email protected]:1060/weasel.www
e4d8d81..faa342f master -> master
Scheduling build
Fetching logs...
Warning: Permanently added '[www.weasel.dotcloud.com]:3254,[174.129.17.131]:3254' (RSA) to the list of known hosts.
-- Build started...
Makefile.PL
tar: Makefile.PL: time stamp 2011-04-29 22:55:50 is 3.123334323 s in the future
app.psgi
tar: app.psgi: time stamp 2011-04-29 22:55:50 is 3.123077445 s in the future
myapp.pl
tar: myapp.pl: time stamp 2011-04-29 22:55:50 is 3.122996876 s in the future
Fetched code revision faa342f
--> Working on .
Configuring /home/dotcloud/faa342f ... OK
==> Found dependencies: Plack::Request
--> Working on Plack::Request
Fetching http://search.cpan.org/CPAN/authors/id/M/MI/MIYAGAWA/Plack-0.9976.tar.gz ... OK
Configuring Plack-0.9976 ... OK
==> Found dependencies: Hash::MultiValue, Try::Tiny, Test::Requires, Devel::StackTrace, Test::TCP, Filesys::Notify::Simple, File::ShareDir, Devel::StackTrace::AsHTML
--> Working on Hash::MultiValue
Fetching http://search.cpan.org/CPAN/authors/id/M/MI/MIYAGAWA/Hash-MultiValue-0.08.tar.gz ... OK
Configuring Hash-MultiValue-0.08 ... OK
Building Hash-MultiValue-0.08 ... OK
Successfully installed Hash-MultiValue-0.08
--> Working on Try::Tiny
Fetching http://search.cpan.org/CPAN/authors/id/D/DO/DOY/Try-Tiny-0.09.tar.gz ... OK
Configuring Try-Tiny-0.09 ... OK
Building Try-Tiny-0.09 ... OK
Successfully installed Try-Tiny-0.09
--> Working on Test::Requires
Fetching http://search.cpan.org/CPAN/authors/id/T/TO/TOKUHIROM/Test-Requires-0.06.tar.gz ... OK
Configuring Test-Requires-0.06 ... OK
Building Test-Requires-0.06 ... OK
Successfully installed Test-Requires-0.06
--> Working on Devel::StackTrace
Fetching http://search.cpan.org/CPAN/authors/id/D/DR/DROLSKY/Devel-StackTrace-1.27.tar.gz ... OK
Configuring Devel-StackTrace-1.27 ... OK
Building Devel-StackTrace-1.27 ... OK
Successfully installed Devel-StackTrace-1.27
--> Working on Test::TCP
Fetching http://search.cpan.org/CPAN/authors/id/T/TO/TOKUHIROM/Test-TCP-1.12.tar.gz ... OK
Configuring Test-TCP-1.12 ... OK
==> Found dependencies: Test::More, Test::SharedFork
--> Working on Test::More
Fetching http://search.cpan.org/CPAN/authors/id/M/MS/MSCHWERN/Test-Simple-0.98.tar.gz ... OK
Configuring Test-Simple-0.98 ... OK
Building Test-Simple-0.98 ... OK
Successfully installed Test-Simple-0.98 (upgraded from 0.94)
--> Working on Test::SharedFork
Fetching http://search.cpan.org/CPAN/authors/id/T/TO/TOKUHIROM/Test-SharedFork-0.16.tar.gz ... OK
Configuring Test-SharedFork-0.16 ... OK
Building Test-SharedFork-0.16 ... OK
Successfully installed Test-SharedFork-0.16
Building Test-TCP-1.12 ... OK
Successfully installed Test-TCP-1.12
--> Working on Filesys::Notify::Simple
Fetching http://search.cpan.org/CPAN/authors/id/M/MI/MIYAGAWA/Filesys-Notify-Simple-0.07.tar.gz ... OK
Configuring Filesys-Notify-Simple-0.07 ... OK
Building Filesys-Notify-Simple-0.07 ... OK
Successfully installed Filesys-Notify-Simple-0.07
--> Working on File::ShareDir
Fetching http://search.cpan.org/CPAN/authors/id/A/AD/ADAMK/File-ShareDir-1.03.tar.gz ... OK
Configuring File-ShareDir-1.03 ... OK
==> Found dependencies: Class::Inspector
--> Working on Class::Inspector
Fetching http://search.cpan.org/CPAN/authors/id/A/AD/ADAMK/Class-Inspector-1.25.tar.gz ... OK
Configuring Class-Inspector-1.25 ... OK
Building Class-Inspector-1.25 ... OK
Successfully installed Class-Inspector-1.25
Building File-ShareDir-1.03 ... OK
Successfully installed File-ShareDir-1.03
--> Working on Devel::StackTrace::AsHTML
Fetching http://search.cpan.org/CPAN/authors/id/M/MI/MIYAGAWA/Devel-StackTrace-AsHTML-0.11.tar.gz ... OK
Configuring Devel-StackTrace-AsHTML-0.11 ... OK
Building Devel-StackTrace-AsHTML-0.11 ... OK
Successfully installed Devel-StackTrace-AsHTML-0.11
Building Plack-0.9976 ... OK
Successfully installed Plack-0.9976
<== Installed dependencies for .. Finishing.
12 distributions installed
uwsgi: started
Connection to www.weasel.dotcloud.com closed.
(M=bfdc4f) okram@BLUEDESK ~/GIT/weasel/www> curl http://www.weasel.dotcloud.com/
Why, hello there!
(M=bfdc4f) okram@BLUEDESK ~/GIT/weasel/www> curl http://www.weasel.dotcloud.com/test-123
Hello test123!
(M=bfdc4f) okram@BLUEDESK ~/GIT/weasel/www> cat Makefile.PL
#!/usr/bin/env perl
use ExtUtils::MakeMaker;
WriteMakefile(
PREREQ_PM => {
'Dancer' => '1.3030',
'Plack::Request' => '0.9976',
},
);
(M=bfdc4f) okram@BLUEDESK ~/GIT/weasel/www> cat myapp.pl
#!/usr/bin/env perl
use Dancer;
use Dancer;
get '/' => sub {
return "Why, hello there!\n";
};
get '/:name' => sub {
my $name = params->{name};
$name =~ s/[^a-z0-9 ]//i;
return "Hello $name!\n";
};
dance;
(M=bfdc4f) okram@BLUEDESK ~/GIT/weasel/www> cat app.psgi
require 'myapp.pl';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment