- Docker : http://docs.docker.com/v1.8/installation/
- Heroku toolbelt : https://toolbelt.heroku.com/
heroku plugins:install heroku-docker
Copy app.json and Procfile from this repository to your
phoenix application root folder
Edit app.json to change name & description
heroku docker:init
# Compile elixir files for production
ENV MIX_ENV prod
# This prevents us from installing devDependencies
ENV NODE_ENV production
# This causes brunch to build minified and hashed assets
ENV BRUNCH_ENV production
# We add manifests first, to cache deps on successive rebuilds
COPY ["mix.exs", "mix.lock", "/app/user/"]
RUN mix deps.get
# Again, we're caching node_modules if you don't change package.json
ADD package.json /app/user/
RUN npm install
# Add the rest of your app, and compile for production
ADD . /app/user/
RUN mix compile \
&& brunch build \
&& mix phoenix.digest
# Configure your database
config :chatapp, Chatapp.Repo,
adapter: Ecto.Adapters.Postgres,
url: {:system, "DATABASE_URL"},
pool_size: 20
heroku create
heroku docker:release
- Executing 'heroku docker:release' command for very first time will take some time, subsequent runs will be much quicker.
No need to run "mix ecto.create" with heroku as we just use
postgresql database in heroku, rather than creating it.
heroku run "cd /app/user;MIX_ENV=prod NODE_ENV=production BRUNCH_ENV=production mix ecto.migrate"
heroku open
heroku pg:psql DATABASE
- Note: Run above command as it is, without replacing DATABASE with anything
heroku pg:reset DATABASE_URL
- Note: Run above command as it is, without replacing DATABASE_URL with anything
heroku logs -t --app <<app_name>>
Based on Docker image & instructions found at
https://hub.docker.com/r/joshwlewis/docker-heroku-phoenix/