https://github.com/techgaun/heroku-buildpack-mix-tasks
A simple buildpack to run mix tasks during build process
https://github.com/techgaun/heroku-buildpack-mix-tasks
elixir heroku heroku-buildpack
Last synced: about 1 year ago
JSON representation
A simple buildpack to run mix tasks during build process
- Host: GitHub
- URL: https://github.com/techgaun/heroku-buildpack-mix-tasks
- Owner: techgaun
- Created: 2016-04-13T03:58:58.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2017-02-03T17:22:23.000Z (over 9 years ago)
- Last Synced: 2025-03-26T06:34:36.055Z (over 1 year ago)
- Topics: elixir, heroku, heroku-buildpack
- Language: Shell
- Homepage:
- Size: 7.81 KB
- Stars: 7
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# heroku-buildpack-mix-tasks
> A simple buildpack that just runs mix commands on deployment
## Instruction
This buildpack is intended to be used after [heroku buildpack for elixir](https://github.com/HashNuke/heroku-buildpack-elixir) to run arbitrary mix tasks during deployment. This is a perfect buildpack if you're looking to run custom mix tasks as part of your heroku build pipeline.
### Usage
Make sure your app has heroku-buildpack-elixir configured.
```shell
heroku create --buildpack "https://github.com/techgaun/heroku-buildpack-elixir.git" # for new app
heroku config:set BUILDPACK_URL="https://github.com/techgaun/heroku-buildpack-elixir.git" # for existing app
```
Set this buildpack after the heroku-buildpack-elixir.
```shell
# Set the buildpack for your Heroku app
heroku buildpacks:set https://github.com/techgaun/heroku-buildpack-elixir.git
# Add this buildpack after the Elixir buildpack
heroku buildpacks:add --index 1 https://github.com/techgaun/heroku-buildpack-mix-tasks.git
```
Note: Right now, [HashNuke/heroku-buildpack-elixir](https://github.com/HashNuke/heroku-buildpack-elixir) does not export paths of previous buildpacks in sequence for subsequent buildpacks so you might need to use [techgaun/heroku-buildpack-elixir](https://github.com/techgaun/heroku-buildpack-elixir) in some cases.
### Configuration
Configure the `MIX_DEPLOY_TASKS` environment variable with the tasks you want to run.
```shell
heroku config:set MIX_DEPLOY_TASKS='ecto.migrate'
```
You can separate tasks with semicolon if you want to run multiple tasks. Note that they will run in a sequential order.
```shell
heroku config:set MIX_DEPLOY_TASKS='ecto.drop;ecto.create;ecto.migrate;run priv/repo/my_custom_seeds.exs'
```
On a side note, I do not recommend running `ecto.migrate`, db related commands and other various time consuming commands on Production. Esp. running `ecto.migrate` on Production can become a nightmare when you have grown to big database.
## License
MIT