diff --git a/config/config.exs b/config/config.exs index 5f8db21c6d..17a1dfcabb 100644 --- a/config/config.exs +++ b/config/config.exs @@ -14,8 +14,7 @@ config :explorer, ExplorerWeb.Endpoint, url: [host: "localhost"], secret_key_base: "RMgI4C1HSkxsEjdhtGMfwAHfyT6CKWXOgzCboJflfSm4jeAlic52io05KB6mqzc5", render_errors: [view: ExplorerWeb.ErrorView, accepts: ~w(html json)], - pubsub: [name: Explorer.PubSub, - adapter: Phoenix.PubSub.PG2] + pubsub: [name: Explorer.PubSub, adapter: Phoenix.PubSub.PG2] # Configures Elixir's Logger config :logger, :console, diff --git a/config/prod.exs b/config/prod.exs index 1c5588bb4d..9205c16f6a 100644 --- a/config/prod.exs +++ b/config/prod.exs @@ -18,49 +18,13 @@ config :explorer, ExplorerWeb.Endpoint, url: [scheme: "https", host: Map.fetch!(System.get_env(), "HEROKU_APP_NAME") <> ".herokuapp.com", port: 443], force_ssl: [rewrite_on: [:x_forwarded_proto]], cache_static_manifest: "priv/static/cache_manifest.json", - secret_key_base: Map.fetch!(System.get_env(), "SECRET_KEY_BASE") + secret_key_base: Map.fetch!(System.get_env(), "SECRET_KEY_BASE"), + pubsub: [adapter: Phoenix.PubSub.Redis, url: Map.fetch!(System.get_env(), "REDIS_URL"), node_name: Map.fetch!(System.get_env(), "HEROKU_DYNO_ID")] # Do not print debug messages in production config :logger, level: :info -# ## SSL Support -# -# To get SSL working, you will need to add the `https` key -# to the previous section and set your `:url` port to 443: -# -# config :explorer, ExplorerWeb.Endpoint, -# ... -# url: [host: "example.com", port: 443], -# https: [:inet6, -# port: 443, -# keyfile: System.get_env("SOME_APP_SSL_KEY_PATH"), -# certfile: System.get_env("SOME_APP_SSL_CERT_PATH")] -# -# Where those two env variables return an absolute path to -# the key and cert in disk or a relative path inside priv, -# for example "priv/ssl/server.key". -# -# We also recommend setting `force_ssl`, ensuring no data is -# ever sent via http, always redirecting to https: -# -# config :explorer, ExplorerWeb.Endpoint, -# force_ssl: [hsts: true] -# -# Check `Plug.SSL` for all available options in `force_ssl`. - -# ## Using releases -# -# If you are doing OTP releases, you need to instruct Phoenix -# to start the server for all endpoints: -# -# config :phoenix, :serve_endpoints, true -# -# Alternatively, you can configure exactly which server to -# start per endpoint: -# -# config :explorer, ExplorerWeb.Endpoint, server: true -# - +# Configures the database config :explorer, Explorer.Repo, adapter: Ecto.Adapters.Postgres, url: System.get_env("DATABASE_URL"), diff --git a/mix.exs b/mix.exs index 397db1083a..7271256fef 100644 --- a/mix.exs +++ b/mix.exs @@ -20,7 +20,7 @@ defmodule Explorer.Mixfile do def application do [ mod: {Explorer.Application, []}, - extra_applications: [:logger, :runtime_tools] + extra_applications: extra_applications(Mix.env) ] end @@ -28,6 +28,10 @@ defmodule Explorer.Mixfile do defp elixirc_paths(:test), do: ["lib", "test/support"] defp elixirc_paths(_), do: ["lib"] + # Specifies extra applications to start per environment + defp extra_applications(:prod), do: [:logger, :runtime_tools, :phoenix_pubsub_redis] + defp extra_applications(_), do: [:logger, :runtime_tools] + # Specifies your project dependencies. # # Type `mix help deps` for examples and options. @@ -35,6 +39,7 @@ defmodule Explorer.Mixfile do [ {:phoenix, "~> 1.3.0"}, {:phoenix_pubsub, "~> 1.0"}, + {:phoenix_pubsub_redis, "~> 2.1.0"}, {:phoenix_ecto, "~> 3.2"}, {:postgrex, ">= 0.0.0"}, {:phoenix_html, "~> 2.10"}, diff --git a/mix.lock b/mix.lock index 9b1af75f46..580236caae 100644 --- a/mix.lock +++ b/mix.lock @@ -21,11 +21,14 @@ "phoenix_html": {:hex, :phoenix_html, "2.10.5", "4f9df6b0fb7422a9440a73182a566cb9cbe0e3ffe8884ef9337ccf284fc1ef0a", [:mix], [{:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm"}, "phoenix_live_reload": {:hex, :phoenix_live_reload, "1.1.3", "1d178429fc8950b12457d09c6afec247bfe1fcb6f36209e18fbb0221bdfe4d41", [:mix], [{:file_system, "~> 0.2.1 or ~> 0.3", [hex: :file_system, repo: "hexpm", optional: false]}, {:phoenix, "~> 1.0 or ~> 1.2 or ~> 1.3", [hex: :phoenix, repo: "hexpm", optional: false]}], "hexpm"}, "phoenix_pubsub": {:hex, :phoenix_pubsub, "1.0.2", "bfa7fd52788b5eaa09cb51ff9fcad1d9edfeb68251add458523f839392f034c1", [:mix], [], "hexpm"}, + "phoenix_pubsub_redis": {:hex, :phoenix_pubsub_redis, "2.1.4", "aca57023215810af493e15f73aa71e51b0cd186747e38ec7a3ef4743bf13967f", [:mix], [{:phoenix_pubsub, "~> 1.0", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}, {:poolboy, "~> 1.5.1 or ~> 1.6", [hex: :poolboy, repo: "hexpm", optional: false]}, {:redix, "~> 0.6.1", [hex: :redix, repo: "hexpm", optional: false]}, {:redix_pubsub, "~> 0.4.1", [hex: :redix_pubsub, repo: "hexpm", optional: false]}], "hexpm"}, "plug": {:hex, :plug, "1.4.3", "236d77ce7bf3e3a2668dc0d32a9b6f1f9b1f05361019946aae49874904be4aed", [:mix], [{:cowboy, "~> 1.0.1 or ~> 1.1", [hex: :cowboy, repo: "hexpm", optional: true]}, {:mime, "~> 1.0", [hex: :mime, repo: "hexpm", optional: false]}], "hexpm"}, "poison": {:hex, :poison, "3.1.0", "d9eb636610e096f86f25d9a46f35a9facac35609a7591b3be3326e99a0484665", [:mix], [], "hexpm"}, "poolboy": {:hex, :poolboy, "1.5.1", "6b46163901cfd0a1b43d692657ed9d7e599853b3b21b95ae5ae0a777cf9b6ca8", [:rebar], [], "hexpm"}, "postgrex": {:hex, :postgrex, "0.13.3", "c277cfb2a9c5034d445a722494c13359e361d344ef6f25d604c2353185682bfc", [:mix], [{:connection, "~> 1.0", [hex: :connection, repo: "hexpm", optional: false]}, {:db_connection, "~> 1.1", [hex: :db_connection, repo: "hexpm", optional: false]}, {:decimal, "~> 1.0", [hex: :decimal, repo: "hexpm", optional: false]}], "hexpm"}, "ranch": {:hex, :ranch, "1.3.2", "e4965a144dc9fbe70e5c077c65e73c57165416a901bd02ea899cfd95aa890986", [:rebar3], [], "hexpm"}, + "redix": {:hex, :redix, "0.6.1", "20986b0e02f02b13e6f53c79a1ae70aa83147488c408f40275ec261f5bb0a6d0", [:mix], [{:connection, "~> 1.0", [hex: :connection, repo: "hexpm", optional: false]}], "hexpm"}, + "redix_pubsub": {:hex, :redix_pubsub, "0.4.1", "26e6a69129072ac2226be49139019bdf951bb1e9e210a773c1372acf88100936", [:mix], [{:connection, "~> 1.0", [hex: :connection, repo: "hexpm", optional: false]}, {:redix, "~> 0.6.0", [hex: :redix, repo: "hexpm", optional: false]}], "hexpm"}, "ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.1", "28a4d65b7f59893bc2c7de786dec1e1555bd742d336043fe644ae956c3497fbe", [:make, :rebar], [], "hexpm"}, "unicode_util_compat": {:hex, :unicode_util_compat, "0.3.1", "a1f612a7b512638634a603c8f401892afbf99b8ce93a45041f8aaca99cadb85e", [:rebar3], [], "hexpm"}, "wallaby": {:hex, :wallaby, "0.19.2", "358bbff251e3555e02566280d1795132da792969dd58ff89963536d013058719", [:mix], [{:httpoison, "~> 0.12", [hex: :httpoison, repo: "hexpm", optional: false]}, {:poison, ">= 1.4.0", [hex: :poison, repo: "hexpm", optional: false]}, {:poolboy, "~> 1.5", [hex: :poolboy, repo: "hexpm", optional: false]}], "hexpm"}}