⚠️ Latest Amberv0.7.2
is not compatible with Crystalv0.25.0
Please use a
.crystal-version
file with0.24.2
instead
Based on Crystal Heroku Buildpack
You can create an app in Heroku with Amber's buildpack by running the following command:
$ heroku create myapp --buildpack https://github.com/amberframework/heroku-buildpack-amber.git
The default behaviour is to use the latest crystal release.
If you need to use a specific version create a .crystal-version
file in your
application root directory with the version that should be used (e.g. 0.17.1
).
In order for the buildpack to work properly you should have a shard.yml
file,
as it is how it will detect that your app is a Crystal app.
Your application has to listen on a port defined by Heroku.
Append the following code to your config/application.cr
file:
Amber::Server.configure do |settings|
settings.port = ENV["PORT"].to_i if ENV["PORT"]?
end
To be able to use production enviroment config Heroku needs .amber_secret_key
or .encryption_key
during compilation process, so in this case you should remove the encryption key from .gitignore
file.
DISCLAIMER: Don't publish encryption key in open source projects if you have sensitive config
To test a change to this buildpack, write a unit test in tests/run
that asserts your change and
run make test
to ensure the change works as intended and does not break backwards compatibility.
This buildpack have been configured to work with Amber Framework projects.
To learn more about how to deploy other Crystal applications to Heroku, read this blog post.
Currently latest Amber v0.3.6
is compatible with Crystal v0.23.1
Other versions aren't guaranteed to be compatible.