Skip to content

Instantly share code, notes, and snippets.

@will
Created November 22, 2012 07:24
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save will/4129809 to your computer and use it in GitHub Desktop.
Save will/4129809 to your computer and use it in GitHub Desktop.
Heroku Redline Smalltalk Quickstart

Step 1: create a Procfile and Stout app

~ ➤ mkdir redline-on-heroku
~ ➤ cd redline-on-heroku

➤ echo "web: stout Web" > Procfile
➤ echo "
import: 'st.redline.stout.Stout'.
Stout < #Web.
- route
  self onGet: '/' do: [ 'Hello World from Redline Smalltalk on Heroku' ].
" > Web.st

Step 2: create a git repo

➤ git init
Initialized empty Git repository in /Users/will/redline-on-heroku/.git/
➤ git add .
➤ git commit -m 'example'
[master (root-commit) abbb277] example
 2 files changed, 7 insertions(+)
 create mode 100644 Procfile
 create mode 100644 Web.st

Step 3: create a heroku app with the custom buildpack

➤ heroku create redline-example --buildpack https://github.com/will/heroku-buildpack-redline.git
Creating redline-example... done, stack is cedar
BUILDPACK_URL=https://github.com/will/heroku-buildpack-redline.git
http://redline-example.herokuapp.com/ | git@heroku.com:redline-example.git
Git remote heroku added

Step 4: deploy!

➤ git push heroku master
Counting objects: 4, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (4/4), 377 bytes, done.
Total 4 (delta 0), reused 0 (delta 0)

-----> Heroku receiving push
-----> Fetching custom git buildpack... done
-----> Redline Smalltalk app detected
-----> Installing OpenJDK 1.6...done
-----> Installing Redline
-----> Discovering process types
       Procfile declares types -> web
-----> Compiled slug size: 43.5MB
-----> Launching... done, v5
       http://redline-example.herokuapp.com deployed to Heroku

To git@heroku.com:redline-example.git
 * [new branch]      master -> master

That's it. See it running on Heroku:

➤ curl http://redline-example.herokuapp.com/ -H 'Accept: text/html'
Hello World from Redline Smalltalk on Heroku%

or attach a bash process and poke around

➤ heroku run bash
~ $ stic -s ~/.redline/examples st.redline.HelloWorld
Hello World from Redline Smalltalk.                                                                                                                                       

The Buildpack

The buildpack is over at [https://github.com/will/heroku-buildpack-redline]. To start off, it was a fork of the official scala buildpack.

The buildpack is fairly simple:

  1. It fetches a precompiled archive of the target/redline-deploy directory*
  2. puts that in ~/.redline
  3. adds ~/.redline to $PATH and as $REDLINE_HOME
  • there is one small patch to have the default webserver read from $PORT instead of hard coded to 8080.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment