Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Imanol Cea committed Jan 7, 2020
0 parents commit 29ebe09
Show file tree
Hide file tree
Showing 104 changed files with 15,505 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/_build/
/deps/
erl_crash.dump
5 changes: 5 additions & 0 deletions .formatter.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[
import_deps: [:ecto, :phoenix],
inputs: ["*.{ex,exs}", "priv/*/seeds.exs", "{config,lib,test}/**/*.{ex,exs}"],
subdirectories: ["priv/*/migrations"]
]
41 changes: 41 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# The directory Mix will write compiled artifacts to.
/_build/

# If you run "mix test --cover", coverage assets end up here.
/cover/

# The directory Mix downloads your dependencies sources to.
/deps/

# Where 3rd-party dependencies like ExDoc output generated docs.
/doc/

# Ignore .fetch files in case you like to edit your project deps locally.
/.fetch

# If the VM crashes, it generates a dump, let's ignore it too.
erl_crash.dump

# Also ignore archive artifacts (built via "mix archive.build").
*.ez

# Ignore package tarball (built via "mix hex.build").
my_app-*.tar

# Since we are building assets from assets/,
# we ignore priv/static. You may want to comment
# this depending on your deployment strategy.
/priv/static/

.elixir_ls/

# Production secrets
prod.secret.exs
.vscode/
assets/node_modules
rel/

# User-specific stuff:
.idea/

Makefile
31 changes: 31 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# BUILD
FROM elixir:1.9.4-alpine as build

RUN apk add --no-cache --update make g++ nodejs npm

RUN mix local.hex --force && \
mix local.rebar --force

ENV MIX_ENV prod

WORKDIR /app

COPY . .

RUN mkdir /secrets
COPY config/dummy-credentials.json /secrets/credentials.json

RUN mix deps.get --only prod && npm run deploy --prefix ./assets && mix phx.digest && mix release --quiet

# RELEASE
FROM alpine:3.10.3

RUN apk add --no-cache --update bash

RUN mkdir /secrets
WORKDIR /app

COPY --from=build /app/_build/prod/rel/postoffice ./

CMD ["start"]
ENTRYPOINT ["/app/bin/postoffice"]
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Postoffice

To start your Phoenix server:
* `brew update`
* `brew install elixir`
* Create the following environmet variables in order to start the application:
* `GCLOUD_PUBSUB_CREDENTIALS_PATH` with the absolute path to the pubsub credentials file. We provide `config/dummy-credentials.json` to be able to start the app.
* `GCLOUD_PUBSUB_PROJECT_ID` with the project_id used.
* `mix local.hex`
* `mix archive.install hex phx_new 1.4.11`
* Install dependencies with `mix deps.get`
* Inside `docker` directory, run `docker-compose up -d` to start a new postgres database
* Create and migrate your database with `mix ecto.setup`
* Execute `npm install` inside `assets/`
* Start Phoenix endpoint with `mix phx.server`

Now you can visit [`localhost:4000`](http://localhost:4000) from your browser.
5 changes: 5 additions & 0 deletions assets/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"presets": [
"env"
]
}
13 changes: 13 additions & 0 deletions assets/css/app.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

@import "../node_modules/bootstrap/dist/css/bootstrap.css";
@import "../node_modules/admin-lte/dist/css/adminlte.css";
@import "../node_modules/font-awesome/css/font-awesome.css";

.data-content {
padding: 0.5rem 1.5rem !important;
}

.input-group.input-group-sm {
width: 200px;
}

67 changes: 67 additions & 0 deletions assets/css/live_view.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
.phx-disconnected{
cursor: wait;
}
.phx-disconnected *{
pointer-events: none;
}
.phx-disconnected::before{
-webkit-animation-play-state: running;
animation-play-state: running;
opacity: 1;
content: "";
position: absolute;
top: 0;
left: 0;
background-color: rgba(255, 255, 255, .5);
height: 100%;
width: 100%;
display: flex;
justify-content: center;
align-items: center;
}
@-webkit-keyframes phx-spinner {
0% {
-webkit-transform: translate3d(-50%, -50%, 0) rotate(0deg);
transform: translate3d(-50%, -50%, 0) rotate(0deg);
}
100% {
-webkit-transform: translate3d(-50%, -50%, 0) rotate(360deg);
transform: translate3d(-50%, -50%, 0) rotate(360deg);
}
}
@keyframes phx-spinner {
0% {
-webkit-transform: translate3d(-50%, -50%, 0) rotate(0deg);
transform: translate3d(-50%, -50%, 0) rotate(0deg);
}
100% {
-webkit-transform: translate3d(-50%, -50%, 0) rotate(360deg);
transform: translate3d(-50%, -50%, 0) rotate(360deg);
}
}

.phx-disconnected::after {
-webkit-animation: 0.8s linear infinite phx-spinner;
animation: 0.8s linear infinite phx-spinner;
-webkit-animation-play-state: inherit;
animation-play-state: inherit;
border: solid 3px #dedede;
border-bottom-color: #0069d9;
border-radius: 50%;
content: "";
height: 40px;
left: 50%;
opacity: inherit;
position: absolute;
top: 50%;
-webkit-transform: translate3d(-50%, -50%, 0);
transform: translate3d(-50%, -50%, 0);
width: 40px;
will-change: transform;
}


.phx-error {
background: #ffe6f0!important;
}

Loading

0 comments on commit 29ebe09

Please sign in to comment.