Browse Source

ported Mojolicious setup to bash, added app.conf, added stop.sh for symmetry

PATH variable doesn't seem to work

carton handles PATH on its own

use hypnotoad with explicit perl interpreter

need carton full path to hypnotoad

updated dependencies
Joel Berger 10 years ago
parent
commit
3e8383ca1b

+ 7 - 0
frameworks/Perl/mojolicious/app.conf

@@ -0,0 +1,7 @@
+{
+  database_host => $ENV{DBHOST},
+  hypnotoad_merge => {
+    workers => 2*`nproc`,
+  },
+};
+

+ 1 - 1
frameworks/Perl/mojolicious/app.pl

@@ -6,7 +6,7 @@ use Scalar::Util 'looks_like_number';
 
 
 # configuration
 # configuration
 
 
-plugin JSONConfig => {
+plugin Config => {
   file => 'app.conf',
   file => 'app.conf',
   default => {
   default => {
     database_host => 'localhost',
     database_host => 'localhost',

+ 2 - 1
frameworks/Perl/mojolicious/bash_profile.sh

@@ -1,4 +1,5 @@
 #!/bin/bash
 #!/bin/bash
 
 
 export PERL_HOME=${IROOT}/perl-5.18
 export PERL_HOME=${IROOT}/perl-5.18
-export NGINX_HOME=${IROOT}/nginx
+export NGINX_HOME=${IROOT}/nginx
+

+ 13 - 10
frameworks/Perl/mojolicious/cpanfile.snapshot

@@ -1,9 +1,9 @@
 # carton snapshot format: version 1.0
 # carton snapshot format: version 1.0
 DISTRIBUTIONS
 DISTRIBUTIONS
-  EV-4.17
-    pathname: M/ML/MLEHMANN/EV-4.17.tar.gz
+  EV-4.18
+    pathname: M/ML/MLEHMANN/EV-4.18.tar.gz
     provides:
     provides:
-      EV 4.17
+      EV 4.18
       EV::MakeMaker undef
       EV::MakeMaker undef
     requirements:
     requirements:
       ExtUtils::MakeMaker 0
       ExtUtils::MakeMaker 0
@@ -16,10 +16,10 @@ DISTRIBUTIONS
       ExtUtils::MakeMaker 0
       ExtUtils::MakeMaker 0
       Types::Serialiser 0
       Types::Serialiser 0
       common::sense 0
       common::sense 0
-  Mango-1.06
-    pathname: S/SR/SRI/Mango-1.06.tar.gz
+  Mango-1.14
+    pathname: S/SR/SRI/Mango-1.14.tar.gz
     provides:
     provides:
-      Mango 1.06
+      Mango 1.14
       Mango::BSON undef
       Mango::BSON undef
       Mango::BSON::Binary undef
       Mango::BSON::Binary undef
       Mango::BSON::Code undef
       Mango::BSON::Code undef
@@ -32,6 +32,7 @@ DISTRIBUTIONS
       Mango::Bulk undef
       Mango::Bulk undef
       Mango::Collection undef
       Mango::Collection undef
       Mango::Cursor undef
       Mango::Cursor undef
+      Mango::Cursor::Query undef
       Mango::Database undef
       Mango::Database undef
       Mango::GridFS undef
       Mango::GridFS undef
       Mango::GridFS::Reader undef
       Mango::GridFS::Reader undef
@@ -39,9 +40,9 @@ DISTRIBUTIONS
       Mango::Protocol undef
       Mango::Protocol undef
     requirements:
     requirements:
       ExtUtils::MakeMaker 0
       ExtUtils::MakeMaker 0
-      Mojolicious 5.32
-  Mojolicious-5.32
-    pathname: S/SR/SRI/Mojolicious-5.32.tar.gz
+      Mojolicious 5.40
+  Mojolicious-5.65
+    pathname: S/SR/SRI/Mojolicious-5.65.tar.gz
     provides:
     provides:
       Mojo undef
       Mojo undef
       Mojo::Asset undef
       Mojo::Asset undef
@@ -104,7 +105,7 @@ DISTRIBUTIONS
       Mojo::UserAgent::Server undef
       Mojo::UserAgent::Server undef
       Mojo::UserAgent::Transactor undef
       Mojo::UserAgent::Transactor undef
       Mojo::Util undef
       Mojo::Util undef
-      Mojolicious 5.32
+      Mojolicious 5.65
       Mojolicious::Command undef
       Mojolicious::Command undef
       Mojolicious::Command::cgi undef
       Mojolicious::Command::cgi undef
       Mojolicious::Command::cpanify undef
       Mojolicious::Command::cpanify undef
@@ -152,7 +153,9 @@ DISTRIBUTIONS
       ojo undef
       ojo undef
     requirements:
     requirements:
       ExtUtils::MakeMaker 0
       ExtUtils::MakeMaker 0
+      IO::Socket::IP 0.26
       Pod::Simple 3.09
       Pod::Simple 3.09
+      Time::Local 1.2
   Types-Serialiser-1.0
   Types-Serialiser-1.0
     pathname: M/ML/MLEHMANN/Types-Serialiser-1.0.tar.gz
     pathname: M/ML/MLEHMANN/Types-Serialiser-1.0.tar.gz
     provides:
     provides:

+ 2 - 2
frameworks/Perl/mojolicious/install.sh

@@ -2,5 +2,5 @@
 
 
 fw_depends perl
 fw_depends perl
 
 
-${PERL_HOME}/bin/carton install --cpanfile $TROOT/cpanfile
-echo installed Mojolicious app dependencies
+${PERL_HOME}/bin/carton install --cpanfile ${TROOT}/cpanfile
+

+ 0 - 30
frameworks/Perl/mojolicious/setup.py

@@ -1,30 +0,0 @@
-import subprocess
-import json
-import os
-import multiprocessing
-
-def start(args, logfile, errfile):
-  conf = { 
-    'database_host' : args.database_host,
-    'hypnotoad_merge' : {
-      'workers' : 2*multiprocessing.cpu_count(), 
-      # can use args.max_threads and args.max_concurrency to set
-    },
-  }
-  with open(args.troot + '/app.conf', 'w') as f:
-    f.write(json.dumps(conf))
-
-  try:
-    # os.environ["MOJO_MODE"] = "production"
-    subprocess.Popen("carton exec hypnotoad $TROOT/app.pl", shell=True, cwd="mojolicious", stderr=errfile, stdout=logfile)
-    return 0
-  except subprocess.CalledProcessError:
-    return 1
-
-def stop(logfile, errfile):
-  try:
-    subprocess.call("carton exec hypnotoad -s $TROOT/app.pl", shell=True, cwd="mojolicious", stderr=errfile, stdout=logfile)
-    return 0
-  except subprocess.CalledProcessError:
-    return 1
-

+ 8 - 0
frameworks/Perl/mojolicious/setup.sh

@@ -0,0 +1,8 @@
+#!/bin/bash
+
+HYPNOTOAD=$(${PERL_HOME}/bin/carton exec which hypnotoad)
+${PERL_HOME}/bin/carton exec ${PERL_HOME}/bin/perl ${HYPNOTOAD} ${TROOT}/app.pl
+
+## stop:
+# ${PERL_HOME}/bin/carton exec ${PERL_HOME}/bin/perl ${HYPNOTOAD} -s ${TROOT}/app.pl
+

+ 5 - 0
frameworks/Perl/mojolicious/stop.sh

@@ -0,0 +1,5 @@
+#!/bin/bash
+
+HYPNOTOAD=$(${PERL_HOME}/bin/carton exec which hypnotoad)
+${PERL_HOME}/bin/carton exec ${PERL_HOME}/bin/perl ${HYPNOTOAD} -s ${TROOT}/app.pl
+