Skip to content

Commit

Permalink
Revert "Use Carton; add support for PSGI"
Browse files Browse the repository at this point in the history
This reverts commit 5c6bd6f.
  • Loading branch information
judofyr committed Feb 13, 2012
1 parent aff025b commit 4fc09c7
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 39 deletions.
35 changes: 18 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Perloku

Deploy Perl applications in seconds.

## Step 1: App
## Step 1

Write an app:

Expand Down Expand Up @@ -32,7 +32,7 @@ Welcome to the Mojolicious real-time web framework!
</html>
```
## Step 2: Dependencies
## Step 2
Create a Makefile.PL with your dependencies:
Expand All @@ -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
```
Expand Down
24 changes: 9 additions & 15 deletions bin/compile
Original file line number Diff line number Diff line change
Expand Up @@ -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

9 changes: 4 additions & 5 deletions bin/detect
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions bin/release
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 4fc09c7

Please sign in to comment.