Skip to content

Commit

Permalink
Initial commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
hex337 committed Aug 9, 2018
0 parents commit d1d145c
Show file tree
Hide file tree
Showing 175 changed files with 2,857 additions and 0 deletions.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export SLACK_TOKEN=xoxb-2151756753-411261156134-FEJXvyN59Bix3QsOgNflzAaV
16 changes: 16 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# App artifacts
/_build
/db
/deps
/*.ez

# Generated on crash by the VM
erl_crash.dump

# Files matching config/*.secret.exs pattern contain sensitive
# data and you should not commit them into version control.
#
# Alternatively, you may comment the line below and commit the
# secrets files as long as you replace their contents by environment
# variables.
/config/*.secret.exs
Binary file added .hex/cache.ets
Binary file not shown.
Binary file added .hex/packages/hexpm/certifi-2.3.1.tar
Binary file not shown.
Binary file added .hex/packages/hexpm/connection-1.0.4.tar
Binary file not shown.
Binary file added .hex/packages/hexpm/cowboy-1.1.2.tar
Binary file not shown.
Binary file added .hex/packages/hexpm/cowlib-1.0.2.tar
Binary file not shown.
Binary file added .hex/packages/hexpm/db_connection-1.1.3.tar
Binary file not shown.
Binary file added .hex/packages/hexpm/decimal-1.5.0.tar
Binary file not shown.
Binary file added .hex/packages/hexpm/ecto-2.2.10.tar
Binary file not shown.
Binary file added .hex/packages/hexpm/elixir_uuid-1.2.0.tar
Binary file not shown.
Binary file added .hex/packages/hexpm/gettext-0.15.0.tar
Binary file not shown.
Binary file added .hex/packages/hexpm/hackney-1.13.0.tar
Binary file not shown.
Binary file added .hex/packages/hexpm/httpoison-0.13.0.tar
Binary file not shown.
Binary file added .hex/packages/hexpm/idna-5.1.2.tar
Binary file not shown.
Binary file added .hex/packages/hexpm/metrics-1.0.1.tar
Binary file not shown.
Binary file added .hex/packages/hexpm/mime-1.3.0.tar
Binary file not shown.
Binary file added .hex/packages/hexpm/mimerl-1.0.2.tar
Binary file not shown.
Binary file added .hex/packages/hexpm/parse_trans-3.2.0.tar
Binary file not shown.
Binary file added .hex/packages/hexpm/phoenix-1.3.3.tar
Binary file not shown.
Binary file added .hex/packages/hexpm/phoenix_ecto-3.3.0.tar
Binary file not shown.
Binary file added .hex/packages/hexpm/phoenix_pubsub-1.0.2.tar
Binary file not shown.
Binary file added .hex/packages/hexpm/plug-1.6.1.tar
Binary file not shown.
Binary file added .hex/packages/hexpm/poison-3.1.0.tar
Binary file not shown.
Binary file added .hex/packages/hexpm/poolboy-1.5.1.tar
Binary file not shown.
Binary file added .hex/packages/hexpm/postgrex-0.13.5.tar
Binary file not shown.
Binary file added .hex/packages/hexpm/ranch-1.3.2.tar
Binary file not shown.
Binary file added .hex/packages/hexpm/slack-0.14.0.tar
Binary file not shown.
Binary file added .hex/packages/hexpm/ssl_verify_fun-1.1.1.tar
Binary file not shown.
Binary file not shown.
Binary file added .hex/packages/hexpm/websocket_client-1.2.4.tar
Binary file not shown.
1 change: 1 addition & 0 deletions .mix/archives/hex-0.18.1/hex-0.18.1/.elixir
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
~> 1.0
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
52 changes: 52 additions & 0 deletions .mix/archives/hex-0.18.1/hex-0.18.1/ebin/hex.app
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{application,hex,
[{description,"hex"},
{modules,['Elixir.Hex','Elixir.Hex.API','Elixir.Hex.API.Auth',
'Elixir.Hex.API.Key',
'Elixir.Hex.API.Key.Organization',
'Elixir.Hex.API.Package',
'Elixir.Hex.API.Package.Owner',
'Elixir.Hex.API.Release','Elixir.Hex.API.ReleaseDocs',
'Elixir.Hex.API.User','Elixir.Hex.Config',
'Elixir.Hex.Crypto',
'Elixir.Hex.Crypto.AES_CBC_HMAC_SHA2',
'Elixir.Hex.Crypto.AES_GCM',
'Elixir.Hex.Crypto.ContentEncryptor',
'Elixir.Hex.Crypto.Encryption',
'Elixir.Hex.Crypto.KeyManager',
'Elixir.Hex.Crypto.PBES2_HMAC_SHA2',
'Elixir.Hex.Crypto.PKCS5',
'Elixir.Hex.Crypto.PublicKey','Elixir.Hex.HTTP',
'Elixir.Hex.HTTP.Certs','Elixir.Hex.HTTP.SSL',
'Elixir.Hex.HTTP.VerifyHostname','Elixir.Hex.Mix',
'Elixir.Hex.OptionParser','Elixir.Hex.Parallel',
'Elixir.Hex.Registry','Elixir.Hex.Registry.Server',
'Elixir.Hex.RemoteConverger','Elixir.Hex.Repo',
'Elixir.Hex.Resolver',
'Elixir.Hex.Resolver.Backtracks','Elixir.Hex.SCM',
'Elixir.Hex.Server','Elixir.Hex.Set',
'Elixir.Hex.Shell','Elixir.Hex.State',
'Elixir.Hex.UpdateChecker','Elixir.Hex.Utils',
'Elixir.Hex.Version',
'Elixir.Hex.Version.InvalidRequirementError',
'Elixir.Hex.Version.InvalidVersionError',
'Elixir.Hex.Version.Requirement',
'Elixir.Mix.Tasks.Hex','Elixir.Mix.Tasks.Hex.Audit',
'Elixir.Mix.Tasks.Hex.Build',
'Elixir.Mix.Tasks.Hex.Config',
'Elixir.Mix.Tasks.Hex.Docs',
'Elixir.Mix.Tasks.Hex.Info',
'Elixir.Mix.Tasks.Hex.Install',
'Elixir.Mix.Tasks.Hex.Organization',
'Elixir.Mix.Tasks.Hex.Outdated',
'Elixir.Mix.Tasks.Hex.Owner',
'Elixir.Mix.Tasks.Hex.Publish',
'Elixir.Mix.Tasks.Hex.Repo',
'Elixir.Mix.Tasks.Hex.Retire',
'Elixir.Mix.Tasks.Hex.Search',
'Elixir.Mix.Tasks.Hex.User',mix_hex_erl_tar,
mix_hex_filename,mix_hex_pb_package,mix_hex_pb_signed,
mix_hex_registry,mix_hex_tarball,mix_safe_erl_term]},
{registered,[]},
{vsn,"0.18.1"},
{applications,[kernel,stdlib,elixir,ssl,inets]},
{mod,{'Elixir.Hex',[]}}]}.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
1 change: 1 addition & 0 deletions .mix/archives/phx_new-1.3.3/phx_new-1.3.3/.elixir
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
~> 1.3 or ~> 1.4
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
15 changes: 15 additions & 0 deletions .mix/archives/phx_new-1.3.3/phx_new-1.3.3/ebin/phx_new.app
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{application,phx_new,
[{applications,[kernel,stdlib,elixir]},
{description,"phx_new"},
{modules,['Elixir.Mix.Tasks.Local.Phoenix',
'Elixir.Mix.Tasks.Local.Phx',
'Elixir.Mix.Tasks.Phoenix.New',
'Elixir.Mix.Tasks.Phx.New',
'Elixir.Mix.Tasks.Phx.New.Ecto',
'Elixir.Mix.Tasks.Phx.New.Web','Elixir.Phx.New.Ecto',
'Elixir.Phx.New.Generator','Elixir.Phx.New.Project',
'Elixir.Phx.New.Single','Elixir.Phx.New.Umbrella',
'Elixir.Phx.New.Web']},
{registered,[]},
{vsn,"1.3.3"},
{extra_applications,[]}]}.
Binary file added .mix/rebar
Binary file not shown.
Binary file added .mix/rebar3
Binary file not shown.
26 changes: 26 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
FROM elixir:1.6
MAINTAINER hex337

ARG GITHUB_TOKEN

ENV HOME=/usr/src/alex-koin

RUN apt-get update && apt-get install --yes \
postgresql-client \
vim \
git \
curl \
inotify-tools

RUN mix local.hex --force \
&& mix local.rebar --force \
&& mix archive.install --force https://github.com/phoenixframework/archives/raw/master/phx_new-1.3.3.ez

COPY ./docker-entrypoint.sh /
RUN chmod +x /docker-entrypoint.sh
ENTRYPOINT ["/docker-entrypoint.sh"]

ADD . $HOME

WORKDIR $HOME
EXPOSE 4000
53 changes: 53 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
.PHONY: assets bash build deps help iex logs migrate ps restart seed setup_db stop test up

SERVICE?=api

default: help

assets: #: install npm assets for the project
docker-compose exec $(SERVICE) bash -c "cd assets && npm install"

bash: #: Bash prompt on running container
docker-compose exec $(SERVICE) bash

build: #: Build containers
docker-compose build

deps: #: Install the dependencies
docker-compose run --rm $(SERVICE) mix deps.get

iex: #: Interactive elixir shell on container
docker-compose exec $(SERVICE) iex -S mix

logs: #: Tail the service container's logs
docker-compose logs -tf $(SERVICE)

migrate: #: Run migrations
docker-compose run --rm $(SERVICE) mix ecto.migrate

ps: #: Show running processes
docker-compose ps

restart: #: Restart the service container
docker-compose restart $(SERVICE)

seed: #: Seed the DB
docker-compose exec -T $(SERVICE) mix run priv/repo/seeds.exs

setup_db: #: Create the db table(s)
docker-compose run --rm $(SERVICE) mix ecto.create

stop: #: Stop running containers
docker-compose stop

test: #: Run tests
docker-compose exec $(SERVICE) mix test

up: #: Start containers
docker-compose up -d

down:
docker-compose down

help: #: Show help topics
@grep "#:" Makefile | grep -v "@grep" | sed "s/.*:\([A-Za-z_ -]*\):.*#\(.*\)/$$(tput setaf 3)\1$$(tput sgr0)\2/g" | sort
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# AlexKoin

To start your Phoenix server:

* Install dependencies with `mix deps.get`
* Create and migrate your database with `mix ecto.create && mix ecto.migrate`
* Start Phoenix endpoint with `mix phx.server`

Now you can visit [`localhost:4000`](http://localhost:4000) from your browser.

Ready to run in production? Please [check our deployment guides](http://www.phoenixframework.org/docs/deployment).

## Learn more

* Official website: http://www.phoenixframework.org/
* Guides: http://phoenixframework.org/docs/overview
* Docs: https://hexdocs.pm/phoenix
* Mailing list: http://groups.google.com/group/phoenix-talk
* Source: https://github.com/phoenixframework/phoenix
31 changes: 31 additions & 0 deletions config/config.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# This file is responsible for configuring your application
# and its dependencies with the aid of the Mix.Config module.
#
# This configuration file is loaded before any dependency and
# is restricted to this project.
use Mix.Config

# General application configuration
config :alex_koin,
ecto_repos: [AlexKoin.Repo]

# Configures the endpoint
config :alex_koin, AlexKoinWeb.Endpoint,
url: [host: "localhost"],
secret_key_base: "bB7leglq64+Lvhx7d7W0BY6m6rJDv0+X9NJEoaZfKMea1RTpUPWNawG4y+w/yz7+",
render_errors: [view: AlexKoinWeb.ErrorView, accepts: ~w(json)],
pubsub: [name: AlexKoin.PubSub,
adapter: Phoenix.PubSub.PG2]

# Configures Elixir's Logger
config :logger, :console,
format: "$time $metadata[$level] $message\n",
metadata: [:user_id]

# Configure Slack Bot
config :alex_koin, AlexKoin.Slack,
token: System.get_env("SLACK_TOKEN")

# Import environment specific config. This must remain at the bottom
# of this file so it overrides the configuration defined above.
import_config "#{Mix.env}.exs"
46 changes: 46 additions & 0 deletions config/dev.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
use Mix.Config

# For development, we disable any cache and enable
# debugging and code reloading.
#
# The watchers configuration can be used to run external
# watchers to your application. For example, we use it
# with brunch.io to recompile .js and .css sources.
config :alex_koin, AlexKoinWeb.Endpoint,
http: [port: 4000],
debug_errors: true,
code_reloader: true,
check_origin: false,
watchers: []

# ## SSL Support
#
# In order to use HTTPS in development, a self-signed
# certificate can be generated by running the following
# command from your terminal:
#
# openssl req -new -newkey rsa:4096 -days 365 -nodes -x509 -subj "/C=US/ST=Denial/L=Springfield/O=Dis/CN=www.example.com" -keyout priv/server.key -out priv/server.pem
#
# The `http:` config above can be replaced with:
#
# https: [port: 4000, keyfile: "priv/server.key", certfile: "priv/server.pem"],
#
# If desired, both `http:` and `https:` keys can be
# configured to run both http and https servers on
# different ports.

# Do not include metadata nor timestamps in development logs
config :logger, :console, format: "[$level] $message\n"

# Set a higher stacktrace during development. Avoid configuring such
# in production as building large stacktraces may be expensive.
config :phoenix, :stacktrace_depth, 20

# Configure your database
config :alex_koin, AlexKoin.Repo,
adapter: Ecto.Adapters.Postgres,
username: "postgres",
password: "postgres",
database: "alex_koin_dev",
hostname: "db",
pool_size: 10
64 changes: 64 additions & 0 deletions config/prod.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
use Mix.Config

# For production, we often load configuration from external
# sources, such as your system environment. For this reason,
# you won't find the :http configuration below, but set inside
# AlexKoinWeb.Endpoint.init/2 when load_from_system_env is
# true. Any dynamic configuration should be done there.
#
# Don't forget to configure the url host to something meaningful,
# Phoenix uses this information when generating URLs.
#
# Finally, we also include the path to a cache manifest
# containing the digested version of static files. This
# manifest is generated by the mix phx.digest task
# which you typically run after static files are built.
config :alex_koin, AlexKoinWeb.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

# ## 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 :alex_koin, AlexKoinWeb.Endpoint,
# ...
# url: [host: "example.com", port: 443],
# https: [:inet6,
# 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 :alex_koin, AlexKoinWeb.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 :alex_koin, AlexKoinWeb.Endpoint, server: true
#

# Finally import the config/prod.secret.exs
# which should be versioned separately.
import_config "prod.secret.exs"
19 changes: 19 additions & 0 deletions config/test.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
use Mix.Config

# We don't run a server during test. If one is required,
# you can enable the server option below.
config :alex_koin, AlexKoinWeb.Endpoint,
http: [port: 4001],
server: false

# Print only warnings and errors during test
config :logger, level: :warn

# Configure your database
config :alex_koin, AlexKoin.Repo,
adapter: Ecto.Adapters.Postgres,
username: "postgres",
password: "postgres",
database: "alex_koin_test",
hostname: "localhost",
pool: Ecto.Adapters.SQL.Sandbox
26 changes: 26 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
version: '3'

services:
api:
build:
context: .
dockerfile: ./Dockerfile
args:
- SLACK_TOKEN=${SLACK_TOKEN}
command: "mix run --no-halt"
ports:
- "4000:4000"
volumes:
- .:/usr/src/alex-koin
depends_on:
- db
environment:
SLACK_TOKEN: "${SLACK_TOKEN}"

db:
image: "postgres:9.6.3"
volumes:
- postgres-data:/var/lib/postgresql/data

volumes:
postgres-data:
Loading

0 comments on commit d1d145c

Please sign in to comment.