Skip to content

Commit

Permalink
Merge 311f6f2 into e6ff63e
Browse files Browse the repository at this point in the history
  • Loading branch information
Douglas Paz committed Aug 24, 2018
2 parents e6ff63e + 311f6f2 commit 1d12cc1
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 75 deletions.
3 changes: 0 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,8 @@ env:
global:
- SECRET_KEY=SK
- SUPPORTED_LANGUAGES="en|pt"
- DOCKER_IMAGE_NAME=ilha/bothub
script:
- flake8
- travis_wait coverage run manage.py test
after_success:
- coveralls
- export TAG=`if [ "$TRAVIS_BRANCH" == "master" ]; then echo "latest"; else echo $TRAVIS_BRANCH ; fi`
- '[[ $TRAVIS_EVENT_TYPE == "push" && $TRAVIS_BRANCH == "master" || $TRAVIS_EVENT_TYPE == "push" && $TRAVIS_BRANCH == "develop" ]] && docker login -u $DOCKER_HUB_USER -p $DOCKER_HUB_PASS && docker-compose -f docker/docker-compose.yml build && docker push $DOCKER_IMAGE_NAME:$TAG'
8 changes: 2 additions & 6 deletions docker/Dockerfile → Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ FROM python:3.6-alpine3.7
ENV WORKDIR /home/app
WORKDIR $WORKDIR

RUN apk update && apk upgrade
RUN apk add alpine-sdk postgresql-dev nodejs nginx
RUN apk update && apk add alpine-sdk postgresql-dev

RUN pip install pipenv
RUN pip install gunicorn
Expand All @@ -16,9 +15,6 @@ COPY Pipfile.lock Pipfile.lock
RUN pipenv install --system

COPY . .
COPY ./docker/bothub-nginx.conf /etc/nginx/conf.d/default.conf
COPY ./docker/entrypoint.sh ./entrypoint.sh

RUN chmod +x ./entrypoint.sh
EXPOSE 80
ENTRYPOINT $WORKDIR/entrypoint.sh
ENTRYPOINT [ "./entrypoint.sh" ]
9 changes: 0 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,3 @@ You can set environment variables in your OS, write on ```.env``` file or pass v
| BOTHUB_NLP_BASE_URL | ```string``` | ```http://localhost:2657/``` | The bothub-blp production application URL. Used to proxy requests.
| CHECK_ACCESSIBLE_API_URL | ```string``` | ```http://localhost/api/repositories/``` | URL used by ```bothub.health.check.check_accessible_api``` to make a HTTP request. The response status code must be 200.
| SEND_EMAILS | ```boolean``` | ```True``` | Send emails flag.

### Docker Environment Variables

| Variable | Type | Default | Description |
|--|--|--|--|
| BUILD_WEBAPP | ```boolean``` | ```true``` | Build webapp application in entrypoint.
| WEBAPP_REPO | ```string``` | ```https://github.com/Ilhasoft/bothub-webapp``` | bothub-webapp git repository URL. It will clone and run ```npm install && npm run build``` command on the entrypoint. This build is served by Nginx.
| WEBAPP_BRANCH | ```string``` | ```master``` | Specify the branch of the bothub-webapp Git repository.
| API_BASE_URL | ```string``` | Not defined | The bothub production application URL. Used by ```bothub-webapp``` application.
1 change: 0 additions & 1 deletion bothub/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@
# cors headers

CORS_ORIGIN_ALLOW_ALL = True
CORS_URLS_REGEX = r'^/api/.*$'


# mail
Expand Down
1 change: 1 addition & 0 deletions bothub/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@


urlpatterns = [
path('', include(bothub_api_routers.urls)),
path('api/', include(bothub_api_routers.urls)),
path('docs/', include_docs_urls(title='API Documentation')),
path('admin/', admin.site.urls),
Expand Down
8 changes: 2 additions & 6 deletions docker/docker-compose.yml → docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ services:
bothub:
image: ${DOCKER_IMAGE_NAME:-ilha/bothub}:${TAG:-latest}
build:
context: ..
dockerfile: docker/Dockerfile
context: .
dockerfile: Dockerfile
ports:
- 80:80
environment:
Expand All @@ -36,10 +36,6 @@ services:
- CSRF_COOKIE_SECURE=${CSRF_COOKIE_SECURE:-false}
- BOTHUB_WEBAPP_BASE_URL=${BOTHUB_WEBAPP_BASE_URL:-http://localhost/}
- BOTHUB_NLP_BASE_URL=${BOTHUB_NLP_BASE_URL:-http://localhost:2657/}
- BUILD_WEBAPP=${BUILD_WEBAPP:-true}
- WEBAPP_REPO=${WEBAPP_REPO:-https://github.com/Ilhasoft/bothub-webapp}
- WEBAPP_BRANCH=${WEBAPP_BRANCH:-master}
- API_BASE_URL=${API_BASE_URL:-/api}
- CHECK_ACCESSIBLE_API_URL=${CHECK_ACCESSIBLE_API_URL}
- SEND_EMAILS=${SEND_EMAILS:-true}
- SUPPORTED_LANGUAGES=${SUPPORTED_LANGUAGES:-en|pt}
31 changes: 0 additions & 31 deletions docker/bothub-nginx.conf

This file was deleted.

17 changes: 0 additions & 17 deletions docker/entrypoint.sh

This file was deleted.

6 changes: 6 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh
cd $WORKDIR
python manage.py migrate
python manage.py collectstatic --noinput

gunicorn bothub.wsgi -c gunicorn.conf.py
3 changes: 1 addition & 2 deletions docker/gunicorn.conf.py → gunicorn.conf.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import multiprocessing

bind = 'unix:/tmp/bothub.sock'
bind = '0.0.0.0:80'
workers = multiprocessing.cpu_count() * 2 + 1
raw_env = ['DJANGO_SETTINGS_MODULE=bothub.settings']
daemon = True

0 comments on commit 1d12cc1

Please sign in to comment.