Skip to content

Commit

Permalink
Configure for Heroku
Browse files Browse the repository at this point in the history
- Rather than following the instructions on the Phoenix website (http://www.phoenixframework.org/docs/heroku) we opted
  for setting up an app.json file and used the Deploy button to build the dyno
- Note the references to prod.secret.exs have been removed since these files will not be present
- All secrets for production will be set via environment variables
- The phoenix_static_buildpack.config needed settings for the umbrella app and to handle Phoenix 1.3
  • Loading branch information
nicholasjhenry committed May 7, 2017
1 parent 235e161 commit 9840b15
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 9 deletions.
2 changes: 2 additions & 0 deletions README.md
@@ -1 +1,3 @@
# MontrealElixir.Umbrella

[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy)
33 changes: 33 additions & 0 deletions app.json
@@ -0,0 +1,33 @@
{
"name": "Montreal Elixir",
"description": "The offical website for the Montreal Elixir community",
"repository": "https://github.com/montrealelixir/website",
"keywords": ["elixir", "umbrella", "phoenix", "ecto"],
"success_url": "/",
"addons": ["heroku-postgresql:hobby-dev", "papertrail:choklad"],
"env": {
"MIX_ENV": "prod",
"SECRET_KEY_BASE": {
"generator": "secret"
},
"POOL_SIZE": {
"description": "Database pool size",
"value": "18"
},
"SETUP_BY": {
"description": "Who initiated this setup",
"value": "Nicholas Henry"
}
},
"scripts": {
"postdeploy": "mix do ecto.migrate"
},
"buildpacks": [
{
"url": "https://github.com/HashNuke/heroku-buildpack-elixir.git#560e1bd7d22edf8e4d0c6706dfbcaa94fa60c397"
},
{
"url": "https://github.com/gjaldon/heroku-buildpack-phoenix-static.git#45e77b3b64996422e846d375a6f57e79d212488f"
}
]
}
6 changes: 5 additions & 1 deletion apps/montreal_elixir/config/prod.exs
@@ -1,3 +1,7 @@
use Mix.Config

import_config "prod.secret.exs"
config :montreal_elixir, MontrealElixir.Repo,
adapter: Ecto.Adapters.Postgres,
url: System.get_env("DATABASE_URL"),
pool_size: String.to_integer(System.get_env("POOL_SIZE") || "10"),
ssl: true
Empty file.
11 changes: 4 additions & 7 deletions apps/montreal_elixir_web/config/prod.exs
Expand Up @@ -14,9 +14,10 @@ use Mix.Config
# manifest is generated by the mix phoenix.digest task
# which you typically run after static files are built.
config :montreal_elixir_web, MontrealElixir.Web.Endpoint,
on_init: {MontrealElixir.Web.Endpoint, :load_from_system_env, []},
url: [host: "example.com", port: 80],
cache_static_manifest: "priv/static/cache_manifest.json"
http: [port: {:system, "PORT"}],
url: [scheme: "https", host: "www.montrealelixir.ca", port: 80],
cache_static_manifest: "priv/static/cache_manifest.json",
secret_key_base: System.get_env("SECRET_KEY_BASE")

# ## SSL Support
#
Expand Down Expand Up @@ -55,7 +56,3 @@ config :montreal_elixir_web, MontrealElixir.Web.Endpoint,
#
# config :montreal_elixir_web, MontrealElixir.Web.Endpoint, server: true
#

# Finally import the config/prod.secret.exs
# which should be versioned separately.
import_config "prod.secret.exs"
Expand Up @@ -5,7 +5,7 @@ defmodule MontrealElixir.Web.UserSocket do
# channel "room:*", MontrealElixir.Web.RoomChannel

## Transports
transport :websocket, Phoenix.Transports.WebSocket
transport :websocket, Phoenix.Transports.WebSocket, timeout: 45_000
# transport :longpoll, Phoenix.Transports.LongPoll

# Socket params are passed from the client and can
Expand Down
3 changes: 3 additions & 0 deletions elixir_buildpack.config
@@ -0,0 +1,3 @@
erlang_version=19.3
elixir_version=1.4.2
always_rebuild=false
3 changes: 3 additions & 0 deletions phoenix_static_buildpack.config
@@ -0,0 +1,3 @@
node_version=7.4.0
phoenix_relative_path=apps/montreal_elixir_web
phoenix_ex=phx

0 comments on commit 9840b15

Please sign in to comment.