{"id":13507810,"url":"https://github.com/HashNuke/heroku-buildpack-elixir","last_synced_at":"2025-03-30T09:33:04.354Z","repository":{"id":14072893,"uuid":"16776391","full_name":"HashNuke/heroku-buildpack-elixir","owner":"HashNuke","description":"Heroku Buildpack for Elixir with nitro boost","archived":false,"fork":false,"pushed_at":"2024-05-01T00:20:51.000Z","size":393,"stargazers_count":814,"open_issues_count":19,"forks_count":316,"subscribers_count":25,"default_branch":"master","last_synced_at":"2025-03-25T08:05:04.380Z","etag":null,"topics":["elixir","heroku-buildpack"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/HashNuke.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-02-12T18:02:09.000Z","updated_at":"2025-01-24T05:48:27.000Z","dependencies_parsed_at":"2024-05-05T06:32:48.684Z","dependency_job_id":"6cea8a6b-1a75-4dbd-a5d9-b38c03c14ae4","html_url":"https://github.com/HashNuke/heroku-buildpack-elixir","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HashNuke%2Fheroku-buildpack-elixir","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HashNuke%2Fheroku-buildpack-elixir/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HashNuke%2Fheroku-buildpack-elixir/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HashNuke%2Fheroku-buildpack-elixir/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HashNuke","download_url":"https://codeload.github.com/HashNuke/heroku-buildpack-elixir/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246301963,"owners_count":20755512,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["elixir","heroku-buildpack"],"created_at":"2024-08-01T02:00:39.704Z","updated_at":"2025-03-30T09:33:04.080Z","avatar_url":"https://github.com/HashNuke.png","language":"Shell","readme":"# Heroku Buildpack for Elixir\n\n## Features\n\n* **Easy configuration** with `elixir_buildpack.config` file\n* Use **prebuilt Elixir binaries**\n* Allows configuring Erlang\n* If your app doesn't have a Procfile, default web task `mix run --no-halt` will be run.\n* Consolidates protocols\n* Hex and rebar support\n* Caching of Hex packages, Mix dependencies and downloads\n* Compilation procedure hooks through `hook_pre_compile`, `hook_compile`, `hook_post_compile` configuration\n\n#### Version support\n\n* Erlang - Prebuilt packages (17.5, 17.4, etc)\n  * The full list of prebuilt packages can be found here: \n    * gigalixir-20 or heroku-20 stacks: https://builds.hex.pm/builds/otp/ubuntu-20.04/builds.txt\n    * heroku-22 stacks: https://builds.hex.pm/builds/otp/ubuntu-22.04/builds.txt\n    * All other stacks: https://github.com/HashNuke/heroku-buildpack-elixir-otp-builds/blob/master/otp-versions\n* Elixir - Prebuilt releases (1.0.4, 1.0.3, etc) or prebuilt branches (master, v1.7, etc)\n  * The full list of releases can be found here: https://github.com/elixir-lang/elixir/releases\n  * The full list of branches can be found here: https://github.com/elixir-lang/elixir/branches\n\nNote: you should choose an Elixir and Erlang version that are [compatible with one another](https://hexdocs.pm/elixir/compatibility-and-deprecations.html#compatibility-between-elixir-and-erlang-otp).\n\n#### Cloud Native Support\n\n* Cloud Native users should use [this buildpack](https://github.com/elixir-buildpack/cloud-native-buildpack)\n\n**This buildpack is not guaranteed to be Cloud Native compatible.** \nThe [elixir-buildpack/cloud-native-buildpack](https://github.com/elixir-buildpack/cloud-native-buildpack) is a buildpack that is actively under development\nand is designed specifically to follow the Cloud Native Buildpack conventions.\n\n## Usage\n\n#### Create a Heroku app with this buildpack\n\n```\nheroku create --buildpack hashnuke/elixir\n```\n\n#### Set the buildpack for an existing Heroku app\n\n```\nheroku buildpacks:set hashnuke/elixir\n```\n\n#### Use the edge version of buildpack\n\nThe `hashnuke/elixir` buildpack contains the latest published version of the buildpack, but you can use the edge version (i.e. the source code in this repo) by running:\n\n```\nheroku buildpacks:set https://github.com/HashNuke/heroku-buildpack-elixir.git\n```\n\nWhen you decide to use the published or the edge version of the buildpack you should be aware that, although we attempt to maintain the buildpack for as many old Elixir and Erlang releases as possible, it is sometimes difficult since there's a matrix of 3 variables involved: Erlang version, Elixir version and Heroku stack. If your application cannot be updated for some reason and requires an older version of the buildpack then [use a specific version of buildpack](#use-a-specific-version-of-buildpack).\n\n#### Use a specific version of buildpack\n\nThe methods above always use the latest version of the buildpack code. To use a specific version of the buildpack, choose a commit from the [commits](https://github.com/HashNuke/heroku-buildpack-elixir/commits/master) page. The commit SHA forms part of your buildpack url.\n\nFor example, if you pick the commit [\"883f33e10879b4b8b030753c13aa3d0dda82e1e7\"](https://github.com/HashNuke/heroku-buildpack-elixir/commit/883f33e10879b4b8b030753c13aa3d0dda82e1e7), then the buildpack url for your app would be:\n\n```\nhttps://github.com/HashNuke/heroku-buildpack-elixir.git#883f33e10879b4b8b030753c13aa3d0dda82e1e7\n```\n\n**It is recommended to use a buildpack url with a commit SHA on production apps.** This prevents the unpleasant moment when your Heroku build fails because the buildpack you use just got updated with a breaking change. Having buildpacks pinned to a specific version is like having your Hex packages pinned to a specific version in `mix.lock`.\n\n#### Using Heroku CI\n\nThis buildpack supports Heroku CI. \n\n* To enable viewing test runs on Heroku, add [tapex](https://github.com/joshwlewis/tapex) to your project.\n* To detect compilation warnings use the `hook_compile` configuration option set to `mix compile --force --warnings-as-errors`.\n\n#### Elixir Releases\n\nThis buildpack can optionally build an [Elixir release](https://hexdocs.pm/mix/Mix.Tasks.Release.html). The release build will be run after `hook_post_compile`.\n\nWARNING: If you need to do further compilation using another buildpack, such as the [Phoenix static buildpack](https://github.com/gjaldon/heroku-buildpack-phoenix-static), you probably don't want to use this option. See the [Elixir release buildpack](https://github.com/chrismcg/heroku-buildpack-elixir-mix-release) instead.\n\nTo build and use a release for an app called `foo` compiled with `MIX_ENV=prod`:\n1. Make sure `elixir_version` in `elixir_buildpack.config` is at least 1.9\n2. Add `release=true` to `elixir_buildpack.config`\n3. Use `web: _build/prod/rel/foo/bin/foo start` in your Procfile\n\nNOTE: This requires the master version of the buildpack (or a commit later than 7d369c)\n\n## Configuration\n\nCreate a `elixir_buildpack.config` file in your app's root dir. The file's syntax is bash.\n\nIf you don't specify a config option, then the default option from the buildpack's [`elixir_buildpack.config`](https://github.com/HashNuke/heroku-buildpack-elixir/blob/master/elixir_buildpack.config) file will be used.\n\n\n__Here's a full config file with all available options:__\n\n```\n# Erlang version\nerlang_version=18.2.1\n\n# Elixir version\nelixir_version=1.2.0\n\n# Always rebuild from scratch on every deploy?\nalways_rebuild=false\n\n# Create a release using `mix release`? (requires Elixir 1.9)\nrelease=true\n\n# A command to run right before fetching dependencies\nhook_pre_fetch_dependencies=\"pwd\"\n\n# A command to run right before compiling the app (after elixir, .etc)\nhook_pre_compile=\"pwd\"\n\nhook_compile=\"mix compile --force --warnings-as-errors\"\n\n# A command to run right after compiling the app\nhook_post_compile=\"pwd\"\n\n# Set the path the app is run from\nruntime_path=/app\n\n# Enable or disable additional test arguments\ntest_args=\"--cover\"\n```\n\n\n#### Migrating from previous build pack\nthe following has been deprecated and should be removed from `elixir_buildpack.config`:\n```\n# Export heroku config vars\nconfig_vars_to_export=(DATABASE_URL)\n```\n\n#### Specifying Elixir version\n\n* Use prebuilt Elixir release\n\n```\nelixir_version=1.2.0\n```\n\n* Use prebuilt Elixir branch, the *branch* specifier ensures that it will be downloaded every time\n\n```\nelixir_version=(branch master)\n```\n\n#### Specifying Erlang version\n\n* You can specify an Erlang release version like below\n\n```\nerlang_version=18.2.1\n```\n\n#### Specifying config vars to export at compile time\n\n* To set a config var on your heroku node you can exec from the shell:\n\n```\nheroku config:set MY_VAR=the_value\n```\n\n## Other notes\n\n* Add your own `Procfile` to your application, else the default web task `mix run --no-halt` will be used.\n\n* Your application should build embedded and start permanent. Build embedded will consolidate protocols for a performance boost, start permanent will ensure that Heroku restarts your application if it crashes. See below for an example of how to use these features in your Mix project:\n\n  ```elixir\n  defmodule MyApp.Mixfile do\n    use Mix.Project\n\n    def project do\n      [app: :my_app,\n       version: \"0.0.1\",\n       build_embedded: Mix.env == :prod,\n       start_permanent: Mix.env == :prod]\n    end\n  end\n  ```\n\n* The buildpack will execute the commands configured in `hook_pre_compile` and/or `hook_post_compile` in the root directory of your application before/after it has been compiled (respectively). These scripts can be used to build or prepare things for your application, for example compiling assets.\n* The buildpack will execute the commands configured in `hook_pre_fetch_dependencies` in the root directory of your application before it fetches the application dependencies. This script can be used to clean certain dependencies before fetching new ones.\n\n## Development\n\n* Build scripts to build erlang are at \u003chttps://github.com/HashNuke/heroku-buildpack-elixir-otp-builds\u003e\n* Sample app to test is available at \u003chttps://github.com/HashNuke/heroku-buildpack-elixir-test\u003e\n\n## Testing\n\nTo run tests\n```\ngit clone https://github.com/HashNuke/heroku-buildpack-elixir\nexport BUILDPACK=\"$(pwd)/heroku-buildpack-elixir\"\ngit clone https://github.com/jesseshieh/heroku-buildpack-testrunner\ngit clone https://github.com/jesseshieh/shunit2\nexport SHUNIT_HOME=\"$(pwd)/shunit2\"\ncd heroku-buildpack-testrunner\nbin/run $BUILDPACK\n```\n\nSee more info at https://github.com/jesseshieh/heroku-buildpack-testrunner/blob/master/README.md\n\n## Credits\n\n\u0026copy; Akash Manohar under The MIT License. Feel free to do whatever you want with it.\n","funding_links":[],"categories":["Deployment","Shell","Tooling"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FHashNuke%2Fheroku-buildpack-elixir","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FHashNuke%2Fheroku-buildpack-elixir","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FHashNuke%2Fheroku-buildpack-elixir/lists"}