#2143 [ANN] Deploy Fantom Apps to Heroku!

SlimerDude Sat 18 May 2013

Deploy Fantom to Heroku!

Now you can deploy your fantom apps to Heroku! Full instructions here:

https://bitbucket.org/AlienFactory/heroku-buildpack-fantom

Heroku?

For thoese who don't know (and ignoring the buzz words and marketing speak) Heroku is a neat and ridiculously easy way to deploy your apps into a live environment.

How?

Your code needs to exist in a Git repository (*) and whenever you git push to Heroku:

  • it creates a fresh VM (called a dyno)
  • it detects your app type and automatically builds it
  • it runs your app on a given port and maps it to a URL

And it is virtually config free!

So, you write code, push, and ta daa! It's live!

All this is far easier than setting up your own application server on a VM... say, such as Linode! (Sorry Andy!) I know, I've done both.

(*) BitBucket lovers fear not, it only needs to be a local Git repo, which can co-exist along side Mercurial or other SCMs.

Wots the Catch?

There are obviously constraints and caveats to all this though. Things for the Heroku newcomer to note are:

  • each dyno has 512 Mb of RAM
  • web traffic is free (well, soft capped at 2 TB per month)
  • there is no file system to speak of (don't save flat files, use a DB instead)
  • the dyno can only listen on one (assigned) port
  • it uses OpenJDK not the Sun JDK
  • your first dyno is FREE!

What're you waiting for? Get to it!

brian Sat 18 May 2013

This is very cool!

So my understanding is that Heroku only persistence mechanism is their database right? But you can pick which database you want to use?

SlimerDude Sat 18 May 2013

You can pick any Data Store from their Add-On page. They tend to be other cloud services, such as

Most have free starter tiers also.

LightDye Tue 21 May 2013

Thank you SlimerDude for posting this. Perfect timing as I was about to try it myself. Now I'm sure it can be done.

SlimerDude Thu 23 May 2013

Cool, let us know how you get on!

andy Thu 23 May 2013

That's pretty cool Steve

ikhwanhayat Wed 24 Jul 2013

Hi SlimerDude, I'm giving your buildpack a spin.. For local repo, how's the path should be? Relative to the build script? Or the /app/.fan/bin/fanr?

SlimerDude Wed 24 Jul 2013

Hiya,

The local repo should be checked into your Git repository, as it needs to be checked out by Heroku when it builds your app. Therefore I put it relative to my build script, build.fan. My project dir structure usually looks something like:

|-fan/
|  |...
|
|-libs/
|  |-jar
|  |  |...
|  |  
|  |-fanr/
|    |-afBedSheet/
|    |  |-afBedSheet-0.0.X.pod
|    |
|    |-afIoc/
|       |-afIoc-1.3.X.pod
|
|-test/
|  |...
|
|-build.fan

To install I'd then use:

// install pods from a local fan repository
fanr("install -y -r file:libs/fanr/ afBedSheet")

ikhwanhayat Fri 26 Jul 2013

Thanks SlimerDude, it's working now. My mistake really, I used a custom build script from my own pod, which just fails because the pod is not even installed yet. Duhh..

I wonder if it's better that the build script should be named "buildheroku.fan" or something. I might want to reserve "build.fan" for something else.

Anyway, awesome job SlimerDude!

SlimerDude Fri 26 Jul 2013

Cool, happy to hear it's working!

I'm not sure about using a differently named build script though, as by convention, build.fan is used to build your .pod from source.

I'll look to revisit the docs this weekend, see if anything can be made clearer.

SlimerDude Sun 27 Apr 2014

Hi,

To say I've updated the Heroku Buildpack for Fantom to install Fantom-1.0.66 by default.

If you need Heroku to install a specific version of Java or Fantom, you can save a system.properties file in the root of your project that looks like:

java.runtime.version=1.6
fantom.version=1.0.66

More details / documentation can found over on BitBucket.

SlimerDude Sat 10 May 2014

If you use Mercurial for source control then it may be an annoyance that Heroku requires you to keep your project in Git. I say how I use the two together in Using Mercurial and Git in Harmony.

Login or Signup to reply.