Skip to content

Commit

Permalink
Merge pull request #69 from ellie-app/aws-setup
Browse files Browse the repository at this point in the history
AWS setup
  • Loading branch information
tbash authored Jan 16, 2019
2 parents cd242be + 6efb2e9 commit bdf85cf
Show file tree
Hide file tree
Showing 63 changed files with 2,045 additions and 671 deletions.
13 changes: 0 additions & 13 deletions .dockerignore

This file was deleted.

5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,8 @@ priv/docs_table
.local_tmp/
.DS_Store
.env*

*.pem
*.tar.gz

/config/*.toml
15 changes: 0 additions & 15 deletions .travis.yml

This file was deleted.

86 changes: 0 additions & 86 deletions Dockerfile

This file was deleted.

49 changes: 49 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
.PHONY: help

VERSION ?= `grep 'version' mix.exs | sed -e 's/ //g' -e 's/version://' -e 's/[",]//g'`
IMAGE_NAME ?= ellie
PWD ?= `pwd`
BUILD ?= `git rev-parse --short HEAD`

help:
@echo "$(IMAGE_NAME):$(VERSION)"
@perl -nle'print $& if m{^[a-zA-Z_-]+:.*?## .*$$}' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

compile: ## Build the application
mix do deps.get, compile
mix do loadpaths, absinthe.schema.json priv/graphql/schema.json
cd assets && \
npm install && \
npm run graphql && \
npm run build
mix phx.digest

clean: ## Clean up generated artifacts
@rm -rf \
assets/node_modules \
assets/elm-stuff \
priv/graphql \
priv/bin \
mix clean --deps

image: ## Mimic CodeBuild build
$(MAKE) clean
docker run --rm -e BUILD_DIR=/app -v $(PWD):/app -it centos:7 /app/scripts/build all

release: ## Build a release of the application with MIX_ENV=prod
MIX_ENV=prod mix do deps.get, compile
MIX_ENV=prod mix do loadpaths, absinthe.schema.json priv/graphql/schema.json
cd assets && \
NODE_ENV=production npm install && \
NODE_ENV=production npm run graphql && \
NODE_ENV=production npm run build
MIX_ENV=prod mix phx.digest
MIX_ENV=prod mix release --verbose --env=prod
@cp _build/prod/rel/$(IMAGE_NAME)/releases/$(VERSION)/$(IMAGE_NAME).tar.gz $(IMAGE_NAME).tar.gz

bootstrap: ## Setup the app dev
$(MAKE) clean
scripts/bootstrap

server: ## Run the app locally for dev
scripts/server
24 changes: 24 additions & 0 deletions appspec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
version: 0.0
os: linux
files:
- source: .
destination: /app
hooks:
ApplicationStop:
- location: scripts/stop
timeout: 300
AfterInstall:
- location: scripts/unpack
- location: scripts/postunpack
runas: root
ApplicationStart:
- location: scripts/binstall
runas: ec2-user
- location: scripts/migrate
runas: ec2-user
timeout: 300
- location: scripts/start
timeout: 3600
ValidateService:
- location: scripts/healthz
timeout: 3600
15 changes: 1 addition & 14 deletions assets/src/Pages/Editor/Views/StatusBar.elm
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
module Pages.Editor.Views.StatusBar exposing (..)
module Pages.Editor.Views.StatusBar exposing (Config, view)

import Css exposing (..)
import Ellie.Ui.Icon as Icon
import Ellie.Ui.Theme as Theme
import Html.Styled as Html exposing (Html)
import Html.Styled.Attributes as Attributes exposing (css)
import Html.Styled.Events exposing (onClick)
import Pages.Editor.Types.Notification as Notification exposing (Notification)
import Pages.Editor.Views.Notifications as Notifications


type alias Config =
Expand Down Expand Up @@ -40,16 +37,6 @@ view config =
]
[]
[ Html.styled Html.a
[ marginRight (px 16)
, color Theme.primaryForeground
, textDecoration none
, fontSize (px 16)
]
[ Attributes.href "https://zeit.co"
, Attributes.target "_blank"
]
[ Html.text "Hosted on ▲ ZEIT Now" ]
, Html.styled Html.a
[ marginRight (px 16)
, color Theme.primaryForeground
, textDecoration none
Expand Down
1 change: 0 additions & 1 deletion assets/webpack.dev.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ module.exports = {
options: {
maxInstances: 1,
forceWatch: true,
cache: true,
yes: true,
debug: true,
cwd: __dirname
Expand Down
34 changes: 34 additions & 0 deletions buildspec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
version: 0.2

env:
variables:
MIX_ENV: "prod"

phases:
install:
commands:
- chmod +x scripts/build
- scripts/build install
pre_build:
commands:
- scripts/build pre_build
build:
commands:
- scripts/build build
post_build:
commands:
- scripts/build post_build

artifacts:
files:
- ellie.tar.gz
- appspec.yml
- templates/infra.yml
- scripts/unpack
- scripts/postunpack
- scripts/stop
- scripts/migrate
- scripts/start
- scripts/healthz
- scripts/binstall
discard-paths: no
2 changes: 1 addition & 1 deletion config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ config :phoenix, :template_engines,

# Configures the endpoint
config :ellie, EllieWeb.Endpoint,
url: [host: "localhost"],
url: [host: "localhost", port: 4000],
secret_key_base: "+ODF8PyQMpBDb5mxA117MqkLne/bGi0PZoTl5uIHAzck2hDAJ8uGJPzark0Aolyi",
render_errors: [view: EllieWeb.ErrorView, accepts: ~w(html json)],
pubsub: [name: Ellie.PubSub,
Expand Down
35 changes: 32 additions & 3 deletions config/dev.exs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,40 @@ use Mix.Config
# with brunch.io to recompile .js and .css sources.
config :ellie, EllieWeb.Endpoint,
http: [port: 4000],
url: [port: 4000],
static_url: [scheme: "http", host: "localhost", port: 8080],
debug_errors: true,
code_reloader: true,
check_origin: false,
watchers: [],
instrumenters: []
watchers: [
node: [
"node_modules/webpack-dev-server/bin/webpack-dev-server.js",
"--watch-stdin",
"--config",
"./webpack.dev.config.js",
cd: Path.expand("../assets", __DIR__)
],
node: [
"node_modules/graphqelm/bin/graphqelm",
"--introspection-file",
"../priv/graphql/schema.json",
"--base",
"Ellie.Api",
"--output",
"elm-stuff/generated/dillonkearns/graphqelm",
cd: Path.expand("../assets", __DIR__)
]
]

# Watch static and templates for browser reloading.
config :ellie, EllieWeb.Endpoint,
live_reload: [
patterns: [
~r{priv/static/.*(js|css|png|jpeg|jpg|gif|svg)$},
~r{lib/ellie_web/views/.*(ex)$},
~r{lib/ellie_web/templates/.*(eex)$}
]
]

# Do not include metadata nor timestamps in development logs
config :logger, :console, format: "[$level] $message\n"
Expand All @@ -27,6 +56,6 @@ config :ellie, Ellie.Repo,
username: "postgres",
password: "postgres",
database: "ellie",
hostname: "database",
hostname: "localhost",
port: 5432,
pool_size: 10
10 changes: 7 additions & 3 deletions config/prod.exs
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
use Mix.Config

config :logger, backends: []
config :logger,
level: :info,
handle_sasl_reports: true,
handle_otp_reports: true

config :ellie, EllieWeb.Endpoint,
load_from_system_env: true,
cache_static_manifest: "priv/static/manifest.json"
cache_static_manifest: "priv/static/manifest.json",
server: true,
version: Application.spec(:ellie, :vsn)

config :ellie, Ellie.Repo,
adapter: Ecto.Adapters.Postgres,
Expand Down
44 changes: 0 additions & 44 deletions docker-compose.yml

This file was deleted.

Loading

0 comments on commit bdf85cf

Please sign in to comment.