From 4fc09c72e4a93ef4f7f5cdd87d2966fea3b3f6b5 Mon Sep 17 00:00:00 2001 From: Magnus Holm Date: Mon, 13 Feb 2012 15:25:02 +0100 Subject: [PATCH] Revert "Use Carton; add support for PSGI" This reverts commit 5c6bd6f147b11700fbef39a956eb5d5d33238244. --- README.md | 35 ++++++++++++++++++----------------- bin/compile | 24 +++++++++--------------- bin/detect | 9 ++++----- bin/release | 4 ++-- 4 files changed, 33 insertions(+), 39 deletions(-) diff --git a/README.md b/README.md index bc3fad9..53a1075 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ Perloku Deploy Perl applications in seconds. -## Step 1: App +## Step 1 Write an app: @@ -32,7 +32,7 @@ Welcome to the Mojolicious real-time web framework! ``` -## Step 2: Dependencies +## Step 2 Create a Makefile.PL with your dependencies: @@ -52,30 +52,31 @@ WriteMakefile( ); ``` -Run Carton and generate a `carton.lock`: +## Step 3 + +Create an executable file called Perloku which runs a server on the port +given as an enviroment variable: ```sh -carton install -git add carton.lock -git commit -m "Added carton.lock" +#!/bin/sh +./app.pl daemon --listen http://*:$PORT ``` -## Step 3: Server - -If you're using PSGI you can simply create an `app.psgi` and Perloku will -automatically run the app using Starman. - -If you're not using PSGI, you must create a -[Procfile](http://devcenter.heroku.com/articles/procfile) that tells -Heroku how to run your server: +Test that you can start the server: +```sh +chmod +x Perloku +PORT=3000 ./Perloku ``` -web: ./app.pl daemon --listen http://*:$PORT -``` -## Step 4: Deploy +## Step 4 + +Deploy: ```sh +git init +git add . +git commit -m "Initial version" heroku create -s cedar --buildpack http://github.com/judofyr/perloku.git git push heroku master ``` diff --git a/bin/compile b/bin/compile index f2b2c07..a34ad46 100755 --- a/bin/compile +++ b/bin/compile @@ -22,23 +22,17 @@ export PERL5LIB="$VENDORED_PERL/lib/$PERL_VERSION:$VENDORED_PERL/lib/site_perl/$ echo "Using Perl $PERL_VERSION" | indent -CPANM="perl -S cpanm --notest" +if [ -f $BUILD_DIR/Makefile.PL ]; then + echo "-----> Installing dependencies" + VENDOR_DEPS="$BUILD_DIR/vendor/perl-deps" + CACHE_DEPS="$CACHE_DIR/perl-deps" + CPANM="perl -S $(which cpanm) -l $CACHE_DEPS" -echo "-----> Installing Carton" -$CPANM carton + mkdir -p "$CACHE_DIR" + $CPANM --notest --installdeps $BUILD_DIR 2>&1 | indent -# Clear previous cache dir -rm -rf "$CACHE_DIR/perl-deps" -VENDOR_DEPS="$BUILD_DIR/local" -CACHE_DEPS="$CACHE_DIR/local" + cp -R "$CACHE_DEPS" "$VENDOR_DEPS" -if [ -f $BUILD_DIR/app.psgi ]; then - echo "-----> Installing Starman" - $CPANM -l $CACHE_DEPS Starman + echo "Dependencies installed" | indent fi -echo "-----> Installing dependencies" -perl -S carton install --path "$CACHE_DEPS" 2>&1 | indent -cp -R "$CACHE_DEPS" "$VENDOR_DEPS" -echo "Dependencies installed" | indent - diff --git a/bin/detect b/bin/detect index 3767e32..312194b 100755 --- a/bin/detect +++ b/bin/detect @@ -1,11 +1,10 @@ #!/bin/sh -[ -f $1/carton.lock ] || exit 1 - -if [ -f $1/app.psgi ]; then - echo "PSGI" +if [ -x $1/Perloku ]; then + echo "Perloku" + exit 0 else - echo "Perl" + exit 1 fi exit 0 diff --git a/bin/release b/bin/release index 190b57d..970e7fa 100755 --- a/bin/release +++ b/bin/release @@ -6,7 +6,7 @@ cat << EOF --- config_vars: PATH: /app/vendor/perl/bin:/usr/bin:/bin - PERL5OPT: -Mlocal::lib=/app/local + PERL5OPT: -Mlocal::lib=/app/vendor/perl-deps default_process_types: - web: perl -S starman --preload-app --port \$PORT + web: ./Perloku $PORT EOF