Skip to content
This repository has been archived by the owner on Feb 28, 2018. It is now read-only.

Commit

Permalink
Merge pull request #163 from lipemorais/master
Browse files Browse the repository at this point in the history
[WIP] Make Docker great again
  • Loading branch information
cuducos committed May 17, 2017
2 parents 9adda29 + f2a6f31 commit c224085
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 20 deletions.
1 change: 0 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ COPY requirements.txt /requirements.txt
RUN python -m pip install -U pip
RUN python -m pip install -r requirements.txt
RUN apt-get update && apt-get install -y postgresql postgresql-contrib
COPY .env /code/.env
COPY manage.py /code/manage.py
COPY jarbas /code/jarbas
WORKDIR /code
Expand Down
9 changes: 3 additions & 6 deletions Dockerfile-elm
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
FROM node:6.9.1

RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
RUN sudo apt-get update
RUN sudo apt-get install yarn

RUN npm install yarn
RUN ln -s /node_modules/yarn/bin/yarn.js /usr/bin/yarn
WORKDIR /code

COPY yarn.lock yarn.lock
Expand All @@ -14,4 +11,4 @@ COPY gulpfile.js gulpfile.js
RUN yarn install --pure-lockfile

COPY jarbas jarbas
CMD yarn assets
CMD ["yarn", "assets"]
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
run.jarbas:
docker-compose up -d --build
docker-compose up -d
docker-compose run --rm jarbas python manage.py ceapdatasets
docker-compose run --rm jarbas python manage.py migrate

Expand Down
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,8 @@ cp contrib/.env.sample .env

### Using Docker

If you have [Docker](https://docs.docker.com/engine/installation/) (with [Docker Compose](https://docs.docker.com/compose/install/)) and make, just run:
#### Requirements
[Docker](https://docs.docker.com/engine/installation/) (with [Docker Compose](https://docs.docker.com/compose/install/)), just run:

```console
make run.devel
Expand All @@ -145,7 +146,7 @@ make run.devel
or

```console
docker-compose up -d --build
docker-compose up -d
docker-compose run --rm jarbas python manage.py migrate
docker-compose run --rm jarbas python manage.py ceapdatasets
docker-compose run --rm jarbas python manage.py collectstatic --no-input
Expand All @@ -167,6 +168,10 @@ docker-compose run --rm jarbas python manage.py irregularities contrib/sample-da

You can get the datasets running [Rosie](https://github.com/datasciencebr/rosie) or directly with the [toolbox](https://github.com/datasciencebr/rosie).

To add a fresh new reimbursements.xz brewed by [Rosie](https://github.com/datasciencebr/rosie) or from [toolbox](https://github.com/datasciencebr/rosie), you just need to have this file inside project folder and give the path at the end of the command, as bellow:
```
docker-compose run --rm jarbas python manage.py reimbursements PATH_TO_YOUR_FRESH_NEW_REIMBURSEMENTS.xz
```

### Local install

Expand Down Expand Up @@ -215,6 +220,8 @@ Copy `contrib/.env.sample` as `.env` in the project's root folder and adjust you
* `GOOGLE_ANALYTICS` (_str_) Google Analytics tracking code (e.g. `UA-123456-7`)
* `GOOGLE_STREET_VIEW_API_KEY` (_str_) Google Street View Image API key

To use GOOGLE_STREET_VIEW_API_KEY just export it in a local environment variable, so when you run Jarbas it will get from the local environment variable.

#### Migrations

Once you're done with requirements, dependencies and settings, create the basic database structure:
Expand Down
24 changes: 14 additions & 10 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
version: '2'
services:
jarbas:
build:
context: .
dockerfile: Dockerfile
image: datasciencebr/jarbas-backend
volumes:
- "staticfiles:/code/staticfiles"
- "assets:/code/staticfiles"
- "./:/code"
- ".env:/code/.env"
environment:
- SECRET_KEY=lets-rock
- DATABASE_URL=postgres://jarbas:mysecretpassword@db/jarbas
- CACHE_BACKEND=django.core.cache.backends.memcached.MemcachedCache
- CACHE_LOCATION=cache:11211
- DEBUG=True
- ALLOWED_HOSTS=localhost,127.0.0.1
- AMAZON_S3_BUCKET=serenata-de-amor-data
- AMAZON_S3_REGION=s3-sa-east-1
- AMAZON_S3_CEAPTRANSLATION_DATE=2016-08-08
- GOOGLE_STREET_VIEW_API_KEY

depends_on:
- elm
- db
Expand All @@ -24,18 +29,15 @@ services:
- apps

elm:
build:
context: .
dockerfile: Dockerfile-elm
image: datasciencebr/jarbas-frontend
volumes:
- "./:/code"
- "/code/node_modules"
- "assets:/code/jarbas/frontend/static"
command: [yarn, watch]

nginx:
build:
context: .
dockerfile: Dockerfile-nginx
image: datasciencebr/jarbas-server
volumes:
- "assets:/opt/jarbas/staticfiles"
ports:
Expand All @@ -51,6 +53,8 @@ services:
- POSTGRES_PASSWORD=mysecretpassword
- POSTGRES_USER=jarbas
- POSTGRES_DB=jarbas
ports:
- "5432:5432"
networks:
- backend
volumes:
Expand Down

0 comments on commit c224085

Please sign in to comment.