This is the official Heroku buildback for the Marten web framework.
The Heroku CLI should be installed and properly configured.
You should ensure that your project defines a Procfile file with at least the following content:
web: bin/server --port \$PORTIf your application requires the use of a database, you should also add a release process that runs the Marten migrate management command to your Procfile file:
web: bin/server --port \$PORT
release: marten migrateOnce your setup meets all the requirements, you can create an application in Heroku using this buildpack by running the following heroku create command:
heroku create myapp --buildpack=git@github.com:martenframework/heroku-buildpack-marten.gitIf you need to add this buildback to an existing application, you can use the following heroku buildpacks command:
heroku buildpacks:add https://github.com/martenframework/heroku-buildpack-martenA few additional things should be noted regarding this buildpack:
- The compiled server binary will be placed under the
bin/serverpath. - Your project's
manage.crfile will be compiled as well and will be available by simply calling themartencommand. This means that you can runmarten <command>if you need to call specific management commands. - The buildpack will automatically cache Crystal and your project's installed shards. Note that the Crystal version used for your application will be determined by looking for a
.crystal-versionfile at the root of your project: if this file is not found, the buildpack will default to using the latest Crystal release. - The buildpack will automatically call the
collectassetsmanagement command in order to collect your project's assets and copy them to your configured assets storage. You can set theDISABLE_COLLECTASSETSenvironment variable to1if you don't want this behavior. - If you need to build and package assets before the Marten buildpack is executed, you could use the official Node.js buildpback and define a "build" script in your project's
package.jsonfile. You should ensure that the index you assign to the Node.js buildpack is lower than the one assigned to the Marten buildpack. This will ensure that assets are built before they are collected by Marten.
This buildpack is inspired by the official Crystal buildpack and essentially extends it to support Marten applications.
Morgan Aubert (@ellmetha) and contributors.
MIT. See LICENSE for more details.