Skip to content

Instantly share code, notes, and snippets.

View paveltyk's full-sized avatar

Pavel Tsiukhtsiayeu paveltyk

  • BILL
  • North Carolina, US
  • 01:44 (UTC -04:00)
View GitHub Profile
/.git
/_build
/deps
/assets/build
/assets/node_modules
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
build:
docker:
web: Dockerfile
release:
image: web
command:
- POOL_SIZE=2 mix ecto.migrate
run:
web: mix phx.server
# 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}
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__,
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]}