Skip to content

Commit

Permalink
Merge pull request #52 from CaptainFact/staging
Browse files Browse the repository at this point in the history
Release 0.9
  • Loading branch information
Betree authored Nov 24, 2018
2 parents 35404bf + 6a4c222 commit 18b78d7
Show file tree
Hide file tree
Showing 241 changed files with 2,299 additions and 2,361 deletions.
9 changes: 7 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,19 @@
.travis.yml

# Elixir
.elixir_ls
_build
.elixir_ls
deps
apps/*/test

# Project-specific
rel/docker
resources
dev
priv

# Docker
.dockerignore
Dockerfile

# Secrets
apps/*/priv/secrets/*
Expand Down
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ env:
CF_API_GRAPHQL_IMAGE: captainfact/graphql-api:$TRAVIS_BRANCH
CF_API_ATOM_FEED: captainfact/atom-feed:$TRAVIS_BRANCH
CF_API_OPENGRAPH_IMAGE: captainfact/opengraph:$TRAVIS_BRANCH
CF_API_JOBS_IMAGE: captainfact/jobs:$TRAVIS_BRANCH

# ---- Jobs ----

Expand Down Expand Up @@ -40,13 +41,15 @@ jobs:
script:
- set -e
- # ---- Build ----
- docker build --build-arg APP=captain_fact -t ${CF_API_REST_IMAGE} .
- docker build --build-arg APP=cf_rest_api -t ${CF_API_REST_IMAGE} .
- docker build --build-arg APP=cf_graphql -t ${CF_API_GRAPHQL_IMAGE} .
- docker build --build-arg APP=cf_atom_feed -t ${CF_API_ATOM_FEED} .
- docker build --build-arg APP=cf_opengraph -t ${CF_API_OPENGRAPH_IMAGE} .
- docker build --build-arg APP=cf_jobs -t ${CF_API_JOBS_IMAGE} .
- # ---- Push release ----
- docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD";
- docker push $CF_API_REST_IMAGE
- docker push $CF_API_GRAPHQL_IMAGE
- docker push $CF_API_ATOM_FEED
- docker push $CF_API_OPENGRAPH_IMAGE
- docker push $CF_API_JOBS_IMAGE
15 changes: 10 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,28 @@ RUN apk add bash imagemagick curl gcc make libc-dev libgcc && rm -rf /var/cache/
ENV HOME=/opt/app/ SHELL=/bin/bash MIX_ENV=prod
WORKDIR /opt/build

ARG APP

# Cache dependencies
COPY mix.exs mix.lock ./
COPY apps/captain_fact/mix.exs ./apps/captain_fact/
COPY apps/cf/mix.exs ./apps/cf/
COPY apps/cf_atom_feed/mix.exs ./apps/cf_atom_feed/
COPY apps/cf_graphql/mix.exs ./apps/cf_graphql/
COPY apps/cf_jobs/mix.exs ./apps/cf_jobs/
COPY apps/cf_opengraph/mix.exs ./apps/cf_opengraph/
COPY apps/cf_utils/mix.exs ./apps/cf_utils/
COPY apps/cf_rest_api/mix.exs ./apps/cf_rest_api/
COPY apps/db/mix.exs ./apps/db/
RUN HEX_HTTP_CONCURRENCY=4 HEX_HTTP_TIMEOUT=180 mix deps.get

# Build dependencies
COPY . .
RUN mix deps.compile

# Build app
ARG APP
RUN mix release --name ${APP} --env=$MIX_ENV

# Copy app to workdir and remove build files
WORKDIR /opt/app
RUN cp -R /opt/build/_build/$MIX_ENV/rel/${APP}/* /opt/app/
RUN mv /opt/build/_build/$MIX_ENV/rel/${APP}/* /opt/app/
RUN rm -rf /opt/build
RUN ln -s /opt/app/bin/${APP} bin/entrypoint

Expand Down
39 changes: 19 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,13 @@ docker installed, you can use the pre-seed postgres docker image:

### Start API services

* Without Docker (recommended if you want to make changes in the API)
- Without Docker (recommended if you want to make changes in the API)

- `mix deps.get`
- `mix ecto.migrate`
- `iex -S mix`

* With Docker
- With Docker
- Download project's dependencies with `./dev/get_dependencies.sh`
- Migrate your database with `./dev/db_migrate.sh`
- Start server with `./dev/start_server.sh`
Expand All @@ -59,28 +60,26 @@ This application is organized as an [umbrella project](https://elixir-lang.org/g
```
.
├── apps
│   ├── captain_fact => A monolith containing REST API, jobs and core functions
│   │   ├── lib
│   │   │   ├── captain_fact => Core functions + jobs
│   │   │   └── captain_fact_web => REST API
│ │ └── priv/secrets => dev secrets for this app
│   ├── cf_graphql => GraphQL API
│ │ └── priv/secrets => dev secrets for this app
│   ├── cf_atom_feed => Atom feed
│   └── db => DB repository and schemas
│   ├── cf => Core functions as a library. **Not deployed**
│   ├── cf_atom_feed => Atom feed.
│   ├── cf_graphql => GraphQL API (public).
│   ├── cf_jobs => Jobs.
│   ├── cf_opengraph => An app that generate opengraph tags.
│   ├── cf_rest_api => REST/WS API (private).
│   └── db => DB repository and schemas **Not deployed**
│   ├── lib
│   │   ├── db
│   │   ├── db_schema => Contains all the schemas (Video, Speaker, Comment...etc)
│   │   ├── db_type => Special types (SpeakerPicture...etc)
│   │   └── db_utils => Some utils functions
│   └── priv
│      ├── repo/migrations => All DB migrations files
│ └── secrets => dev secrets for DB (db username, password...etc)
├── README.md => You're reading it right now. Are you ?
│      └── repo/migrations => All DB migrations files
├── README.md => You're reading it right now. Are you?
├── rel => Release configs & tools
│   ├── commands => Commands that will be available to run on the release (seed DB...etc)
│   ├── config.exs => Releases configuration
│   └── docker => Docker-specific files & configs
│   ├── hooks => Some hooks for automatically run commands when release run.
│   ├── runtime_config => Runtime configurations for all apps.
│   └── config.exs => Releases configuration.
```

## Styling
Expand All @@ -93,10 +92,10 @@ Avoid lines longer than 80 characters, **never** go beyond 110 characters.

## Linked projects

* [Community discussions and documentation](https://github.com/CaptainFact/captain-fact/)
* [Frontend](https://github.com/CaptainFact/captain-fact-frontend)
* [Extension](https://github.com/CaptainFact/captain-fact-extension)
* [Overlay injector](https://github.com/CaptainFact/captain-fact-overlay-injector)
- [Community discussions and documentation](https://github.com/CaptainFact/captain-fact/)
- [Frontend](https://github.com/CaptainFact/captain-fact-frontend)
- [Extension](https://github.com/CaptainFact/captain-fact-extension)
- [Overlay injector](https://github.com/CaptainFact/captain-fact-overlay-injector)

# Feature requests

Expand Down
71 changes: 0 additions & 71 deletions apps/captain_fact/config/config.exs

This file was deleted.

50 changes: 0 additions & 50 deletions apps/captain_fact/config/dev.exs

This file was deleted.

21 changes: 0 additions & 21 deletions apps/captain_fact/config/prod.exs

This file was deleted.

36 changes: 0 additions & 36 deletions apps/captain_fact/config/test.exs

This file was deleted.

55 changes: 0 additions & 55 deletions apps/captain_fact/lib/application.ex

This file was deleted.

Loading

0 comments on commit 18b78d7

Please sign in to comment.