From 13ba070631aabb28805a30e0d8a7e1e97a1ae675 Mon Sep 17 00:00:00 2001 From: Dan Barber Date: Mon, 19 Feb 2018 17:43:04 -0500 Subject: [PATCH] Changes for Gigalixir deploy --- .buildpacks | 4 +++ assets/package-lock.json | 8 +++++ config/prod.exs | 70 +++++++--------------------------------- mix.exs | 1 + mix.lock | 7 ++-- rel/config.exs | 53 ++++++++++++++++++++++++++++++ 6 files changed, 80 insertions(+), 63 deletions(-) create mode 100644 .buildpacks create mode 100644 rel/config.exs diff --git a/.buildpacks b/.buildpacks new file mode 100644 index 0000000..a90e52d --- /dev/null +++ b/.buildpacks @@ -0,0 +1,4 @@ +https://github.com/gigalixir/gigalixir-buildpack-clean-cache.git +https://github.com/HashNuke/heroku-buildpack-elixir +https://github.com/gjaldon/heroku-buildpack-phoenix-static +https://github.com/gigalixir/gigalixir-buildpack-distillery.git diff --git a/assets/package-lock.json b/assets/package-lock.json index 45cdcf3..d5b7ec8 100644 --- a/assets/package-lock.json +++ b/assets/package-lock.json @@ -2175,12 +2175,20 @@ "resolved": "https://registry.npmjs.org/fbjs/-/fbjs-0.8.16.tgz", "integrity": "sha1-XmdDL1UNxBtXK/VYR7ispk5TN9s=", "requires": { + "core-js": "1.2.7", "isomorphic-fetch": "2.2.1", "loose-envify": "1.3.1", "object-assign": "4.1.1", "promise": "7.3.1", "setimmediate": "1.0.5", "ua-parser-js": "0.7.17" + }, + "dependencies": { + "core-js": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-1.2.7.tgz", + "integrity": "sha1-ZSKUwUZR2yj6k70tX/KYOk8IxjY=" + } } }, "fcache": { diff --git a/config/prod.exs b/config/prod.exs index 0502d81..9d98190 100644 --- a/config/prod.exs +++ b/config/prod.exs @@ -1,65 +1,17 @@ use Mix.Config -# For production, we configure the host to read the PORT -# from the system environment. Therefore, you will need -# to set PORT=80 before running your server. -# -# You should also configure the url host to something -# meaningful, we use this information when generating URLs. -# -# Finally, we also include the path to a manifest -# containing the digested version of static files. This -# manifest is generated by the mix phoenix.digest task -# which you typically run after static files are built. -config :chess, ChessWeb.Endpoint, - http: [port: {:system, "PORT"}], +config :chess, Chess.Endpoint, + load_from_system_env: true, url: [host: "example.com", port: 80], cache_static_manifest: "priv/static/cache_manifest.json" -# Do not print debug messages in production -config :logger, level: :info +config :chess, Chess.Endpoint, + server: true, + secret_key_base: "${SECRET_KEY_BASE}" -# ## 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 :chess, ChessWeb.Endpoint, -# ... -# url: [host: "example.com", port: 443], -# https: [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 :chess, ChessWeb.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 :chess, ChessWeb.Endpoint, server: true -# -# You will also need to set the application root to `.` in order -# for the new static assets to be served after a hot upgrade: -# -# config :chess, ChessWeb.Endpoint, root: "." - -# Finally import the config/prod.secret.exs -# which should be versioned separately. -import_config "prod.secret.exs" +config :chess, Chess.Repo, + adapter: Ecto.Adapters.Postgres, + url: "${DATABASE_URL}", + database: "", + ssl: true, + pool_size: 1 diff --git a/mix.exs b/mix.exs index 9d1a4fa..3716b07 100644 --- a/mix.exs +++ b/mix.exs @@ -33,6 +33,7 @@ defmodule Chess.Mixfile do [{:argon2_elixir, "~> 1.2"}, {:comeonin, "~> 4.0"}, {:credo, "~> 0.8", only: [:dev, :test]}, + {:distillery, "~> 1.5"}, {:formulator, "~> 0.1.6"}, {:phoenix, "~> 1.3.0"}, {:phoenix_pubsub, "~> 1.0"}, diff --git a/mix.lock b/mix.lock index e845451..669f1a1 100644 --- a/mix.lock +++ b/mix.lock @@ -1,5 +1,4 @@ -%{ - "argon2_elixir": {:hex, :argon2_elixir, "1.2.14", "0fc4bfbc1b7e459954987d3d2f3836befd72d63f3a355e3978f5005dd6e80816", [:make, :mix], [{:elixir_make, "~> 0.4", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm"}, +%{"argon2_elixir": {:hex, :argon2_elixir, "1.2.14", "0fc4bfbc1b7e459954987d3d2f3836befd72d63f3a355e3978f5005dd6e80816", [:make, :mix], [{:elixir_make, "~> 0.4", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm"}, "base64url": {:hex, :base64url, "0.0.1", "36a90125f5948e3afd7be97662a1504b934dd5dac78451ca6e9abf85a10286be", [:rebar], [], "hexpm"}, "bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], [], "hexpm"}, "certifi": {:hex, :certifi, "2.0.0", "a0c0e475107135f76b8c1d5bc7efb33cd3815cb3cf3dea7aefdd174dabead064", [:rebar3], [], "hexpm"}, @@ -11,6 +10,7 @@ "credo": {:hex, :credo, "0.8.10", "261862bb7363247762e1063713bb85df2bbd84af8d8610d1272cd9c1943bba63", [:mix], [{:bunt, "~> 0.2.0", [hex: :bunt, repo: "hexpm", optional: false]}], "hexpm"}, "db_connection": {:hex, :db_connection, "1.1.3", "89b30ca1ef0a3b469b1c779579590688561d586694a3ce8792985d4d7e575a61", [:mix], [{:connection, "~> 1.0.2", [hex: :connection, repo: "hexpm", optional: false]}, {:poolboy, "~> 1.5", [hex: :poolboy, repo: "hexpm", optional: true]}, {:sbroker, "~> 1.0", [hex: :sbroker, repo: "hexpm", optional: true]}], "hexpm"}, "decimal": {:hex, :decimal, "1.4.1", "ad9e501edf7322f122f7fc151cce7c2a0c9ada96f2b0155b8a09a795c2029770", [:mix], [], "hexpm"}, + "distillery": {:hex, :distillery, "1.5.2", "eec18b2d37b55b0bcb670cf2bcf64228ed38ce8b046bb30a9b636a6f5a4c0080", [:mix], [], "hexpm"}, "ecto": {:hex, :ecto, "2.2.8", "a4463c0928b970f2cee722cd29aaac154e866a15882c5737e0038bbfcf03ec2c", [:mix], [{:db_connection, "~> 1.1", [hex: :db_connection, repo: "hexpm", optional: true]}, {:decimal, "~> 1.2", [hex: :decimal, repo: "hexpm", optional: false]}, {:mariaex, "~> 0.8.0", [hex: :mariaex, repo: "hexpm", optional: true]}, {:poison, "~> 2.2 or ~> 3.0", [hex: :poison, repo: "hexpm", optional: true]}, {:poolboy, "~> 1.5", [hex: :poolboy, repo: "hexpm", optional: false]}, {:postgrex, "~> 0.13.0", [hex: :postgrex, repo: "hexpm", optional: true]}, {:sbroker, "~> 1.0", [hex: :sbroker, repo: "hexpm", optional: true]}], "hexpm"}, "elixir_make": {:hex, :elixir_make, "0.4.0", "992f38fabe705bb45821a728f20914c554b276838433349d4f2341f7a687cddf", [:mix], [], "hexpm"}, "file_system": {:hex, :file_system, "0.2.4", "f0bdda195c0e46e987333e986452ec523aed21d784189144f647c43eaf307064", [:mix], [], "hexpm"}, @@ -41,5 +41,4 @@ "tzdata": {:hex, :tzdata, "0.5.16", "13424d3afc76c68ff607f2df966c0ab4f3258859bbe3c979c9ed1606135e7352", [:mix], [{:hackney, "~> 1.0", [hex: :hackney, repo: "hexpm", optional: false]}], "hexpm"}, "unicode_util_compat": {:hex, :unicode_util_compat, "0.3.1", "a1f612a7b512638634a603c8f401892afbf99b8ce93a45041f8aaca99cadb85e", [:rebar3], [], "hexpm"}, "uuid": {:hex, :uuid, "1.1.8", "e22fc04499de0de3ed1116b770c7737779f226ceefa0badb3592e64d5cfb4eb9", [:mix], [], "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"}, -} + "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"}} diff --git a/rel/config.exs b/rel/config.exs new file mode 100644 index 0000000..999a06c --- /dev/null +++ b/rel/config.exs @@ -0,0 +1,53 @@ +# Import all plugins from `rel/plugins` +# They can then be used by adding `plugin MyPlugin` to +# either an environment, or release definition, where +# `MyPlugin` is the name of the plugin module. +Path.join(["rel", "plugins", "*.exs"]) +|> Path.wildcard() +|> Enum.map(&Code.eval_file(&1)) + +use Mix.Releases.Config, + # This sets the default release built by `mix release` + default_release: :default, + # This sets the default environment used by `mix release` + default_environment: Mix.env() + +# For a full list of config options for both releases +# and environments, visit https://hexdocs.pm/distillery/configuration.html + + +# You may define one or more environments in this file, +# an environment's settings will override those of a release +# when building in that environment, this combination of release +# and environment configuration is called a profile + +environment :dev do + # If you are running Phoenix, you should make sure that + # server: true is set and the code reloader is disabled, + # even in dev mode. + # It is recommended that you build with MIX_ENV=prod and pass + # the --env flag to Distillery explicitly if you want to use + # dev mode. + set dev_mode: true + set include_erts: false + set cookie: :"?Oxo8uJ@&D@Sw@`NN!<5rFxVDA)JO1r$OT{{Py79R9`C4&DRNM~%joji8B2%&TCe" +end + +environment :prod do + set include_erts: true + set include_src: false + set cookie: :";IXx6btpc8P4w2LQl*Zq4aD%.`*:k!^|,W=:_21,T?v!Bd0i=NfVv~3J>awv|7^$" +end + +# You may define one or more releases in this file. +# If you have not set a default release, or selected one +# when running `mix release`, the first release in the file +# will be used by default + +release :chess do + set version: current_version(:chess) + set applications: [ + :runtime_tools + ] +end +