View application.ex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule GoogleStorage.Application do | |
# ... | |
@impl true | |
def start(_type, _args) do | |
producer_module = Application.get_env(:google_storage, :producer_module) | |
children = [ | |
{GoogleStorage.Pipeline, [producer_module: producer_module]} |
View pipeline.ex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule GoogleStorage.Pipeline do | |
use Broadway | |
require Logger | |
alias Broadway.Message | |
def start_link(opts) do | |
producer_module = Keyword.fetch!(opts, :producer_module) | |
Broadway.start_link(__MODULE__, |
View config.exs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# config/config.exs | |
import Config | |
config :goth, json: File.read!("priv/creds.json") | |
subscription = "projects/gcs-pubsub-1/subscriptions/api-subscription" | |
config :google_storage, | |
producer_module: {BroadwayCloudPubSub.Producer, subscription: subscription} |
View heroku.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
build: | |
docker: | |
web: Dockerfile | |
release: | |
image: web | |
command: | |
- POOL_SIZE=2 mix ecto.migrate | |
run: | |
web: mix phx.server |
View Dockerfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM node:10-alpine AS assets | |
WORKDIR /app/assets | |
COPY ./assets /app/assets | |
RUN yarn install && yarn build | |
FROM elixir:1.9.1-alpine | |
ARG MIX_ENV=prod | |
ARG DATABASE_URL=postgres://postgres:postgres@localhost/healthyskin_dev | |
ARG SECRET_KEY_BASE=secret | |
ENV MIX_HOME=/root/.mix |
View .dockerignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/.git | |
/_build | |
/deps | |
/assets/build | |
/assets/node_modules |
View changes-heroku.ex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# config/prod.exs - url builder options and `force_ssl` behind Heroku proxy | |
config :healthyskin, HealthyskinWeb.Endpoint, | |
url: [scheme: "https", host: "example.com", port: 443], | |
force_ssl: [rewrite_on: [:x_forwarded_proto]] | |
# config/prod.secret.exs - use secure database connection | |
config :healthyskin, Healthyskin.Repo, | |
ssl: true, |
View page_view.ex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule HealthyskinWeb.PageView do | |
use HealthyskinWeb, :view | |
def render("index.html", _assigns) do | |
{:safe, File.read!("assets/build/index.html")} | |
end | |
end |
View page_controller.ex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule HealthyskinWeb.PageController do | |
use HealthyskinWeb, :controller | |
plug :put_layout, false | |
def index(conn, _params) do | |
render(conn, "index.html") | |
end | |
end |
View changes-spa.ex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# config/prod.exs - Remove cache_manifest | |
config :healthyskin, HealthyskinWeb.Endpoint, url: [host: "example.com", port: 80] | |
# lib/healthyskin_web/endpoint.ex - Instruct Plug.Static how to serve assets | |
plug Plug.Static, | |
at: "/", | |
from: "assets/build", | |
gzip: false, |
NewerOlder