forked from arachnys/cabot
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Externalise requirements to pip format - Add entry-point script - Update Travis-CI configuration - Fix test data
- Loading branch information
Showing
9 changed files
with
164 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,21 @@ | ||
language: python | ||
|
||
python: | ||
- "2.7" | ||
|
||
sudo: required | ||
services: | ||
- redis-server | ||
- docker | ||
|
||
env: | ||
COMPOSE_VERSION: 1.8.0 | ||
|
||
# install deps | ||
install: | ||
- sudo apt-get update | ||
- sudo apt-get install -y python-software-properties | ||
- sudo apt-get install gcc python-dev git python-pip libpq-dev npm rubygems | ||
- | ||
- sudo npm install -g coffee-script [email protected] --registry http://registry.npmjs.org/ | ||
- gem install foreman | ||
- | ||
- sudo pip install virtualenv | ||
- sudo virtualenv venv | ||
- sudo ./venv/bin/pip install --upgrade setuptools | ||
- CABOT_PLUGINS_ENABLED=cabot_alert_hipchat,cabot_alert_twilio,cabot_alert_email | ||
- sudo ./venv/bin/pip install --timeout=30 --exists-action=w -e . --no-use-wheel | ||
before_install: | ||
- curl -L https://github.com/docker/compose/releases/download/${COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose | ||
- chmod +x docker-compose | ||
- sudo mv docker-compose /usr/local/bin | ||
|
||
# setup databases | ||
before_script: | ||
- cp conf/development.env.example conf/development.env | ||
- cp conf/production.env.example conf/production.env | ||
- . venv/bin/activate | ||
- foreman run python manage.py syncdb --migrate --noinput | ||
- docker-compose build | ||
- docker-compose up -d | ||
- sleep 20 | ||
|
||
# tests | ||
script: | ||
- foreman run python manage.py test cabot | ||
- docker-compose run web python manage.py test cabot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
FROM python:2.7 | ||
|
||
ENV PYTHONUNBUFFERED 1 | ||
|
||
RUN mkdir /code | ||
|
||
WORKDIR /code | ||
|
||
RUN apt-get update && apt-get install -y \ | ||
python-dev \ | ||
libsasl2-dev \ | ||
libldap2-dev \ | ||
libpq-dev \ | ||
npm | ||
|
||
RUN npm install -g \ | ||
--registry http://registry.npmjs.org/ \ | ||
coffee-script \ | ||
[email protected] | ||
|
||
RUN ln -s `which nodejs` /usr/bin/node | ||
|
||
RUN pip install --upgrade pip | ||
|
||
COPY requirements.txt ./ | ||
RUN pip install --no-cache-dir -r requirements.txt | ||
|
||
COPY requirements-plugins.txt ./ | ||
RUN pip install --no-cache-dir -r requirements-plugins.txt | ||
|
||
RUN pip install ipdb | ||
|
||
ADD . /code/ | ||
|
||
ENTRYPOINT ["./docker-entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
# Plugins to be loaded at launch | ||
CABOT_PLUGINS_ENABLED=cabot_alert_hipchat==1.7.0,cabot_alert_twilio==1.6.1,cabot_alert_email==1.3.1 | ||
CABOT_PLUGINS_ENABLED=cabot_alert_hipchat==1.7.0,cabot_alert_twilio==1.1.4,cabot_alert_email==1.3.1 | ||
|
||
DEBUG=t | ||
DATABASE_URL=sqlite:///dev.db | ||
DATABASE_URL=postgres://postgres@db:5432/postgres | ||
DJANGO_SETTINGS_MODULE=cabot.settings | ||
HIPCHAT_URL=https://api.hipchat.com/v1/rooms/message | ||
LOG_FILE=/dev/null | ||
|
@@ -22,7 +22,7 @@ [email protected] | |
CALENDAR_ICAL_URL=http://www.google.com/calendar/ical/example.ics | ||
|
||
# Django settings | ||
CELERY_BROKER_URL=redis://localhost:6379/1 | ||
CELERY_BROKER_URL=redis://redis:6379/1 | ||
DJANGO_SECRET_KEY=2FL6ORhHwr5eX34pP9mMugnIOd3jzVuT45f7w430Mt5PnEwbcJgma0q8zUXNZ68A | ||
|
||
# Hostname of your Graphite server instance | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
version: '2' | ||
services: | ||
web: | ||
env_file: | ||
- conf/development.env | ||
build: . | ||
image: cabot:web | ||
command: python manage.py runserver 0.0.0.0:5001 | ||
ports: | ||
- "5001:5001" | ||
volumes: | ||
- .:/code | ||
links: | ||
- redis | ||
- db | ||
|
||
worker: | ||
env_file: | ||
- conf/development.env | ||
image: cabot:web | ||
command: python manage.py celery worker -B -A cabot --loglevel=DEBUG --concurrency=16 -Ofair | ||
volumes: | ||
- .:/code | ||
links: | ||
- redis | ||
- db | ||
|
||
redis: | ||
image: redis | ||
|
||
db: | ||
image: postgres |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
# first check if we're passing flags, if so | ||
# prepend with sentry | ||
if [ "${1:0:1}" = '-' ]; then | ||
set -- python manage.py "$@" | ||
fi | ||
|
||
case "$1" in | ||
"web") | ||
set -- gunicorn cabot.wsgi:application --config gunicorn.conf | ||
;; | ||
"beatworker") | ||
set -- celery worker -B -A cabot --loglevel=INFO --concurrency=16 -Ofair | ||
;; | ||
"worker") | ||
set -- celery worker -A cabot --loglevel=INFO --concurrency=16 -Ofair | ||
;; | ||
esac | ||
|
||
exec "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
cabot_alert_email==1.3.1 | ||
cabot_alert_hipchat==1.7.0 | ||
cabot_alert_twilio==1.1.4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
Django==1.6.11 | ||
Markdown==2.5 | ||
PyJWT==0.1.2 | ||
South==1.0 | ||
amqp>=1.4.9 | ||
anyjson==0.3.3 | ||
argparse==1.2.1 | ||
celery[redis]==3.1.23 | ||
dj-database-url==0.2.2 | ||
django-appconf==0.6 | ||
django-celery==3.1.17 | ||
django-compressor==1.4 | ||
django-filter==0.7 | ||
django-jsonify==0.2.1 | ||
django-mptt==0.6.0 | ||
django-polymorphic==0.5.6 | ||
django-redis==1.4.5 | ||
django-smtp-ssl==1.0 | ||
djangorestframework==2.4.2 | ||
gunicorn==18.0 | ||
gevent==1.0.1 | ||
httplib2==0.7.7 | ||
icalendar==3.2 | ||
mock==1.0.1 | ||
psycogreen==1.0 | ||
psycopg2==2.5.1 | ||
pytz==2014.10 | ||
requests==2.7.0 | ||
twilio==3.4.1 | ||
wsgiref==0.1.2 | ||
python-dateutil==2.1 | ||
django-auth-ldap==1.2.6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,14 @@ | ||
#!/usr/bin/env python | ||
import os | ||
from setuptools import setup, find_packages | ||
from os import environ as env | ||
|
||
requirements_file = os.path.join(os.path.dirname(__file__), 'requirements.txt') | ||
with open(requirements_file) as f: | ||
requirements = [line.rstrip('\n') | ||
for line in f | ||
if line and not line.startswith('#')] | ||
|
||
# pull in active plugins | ||
plugins = env['CABOT_PLUGINS_ENABLED'].split(',') if 'CABOT_PLUGINS_ENABLED' in env else ["cabot_alert_hipchat", "cabot_alert_twilio", "cabot_alert_email"] | ||
|
||
|
@@ -15,46 +22,7 @@ | |
author_email='[email protected]', | ||
url='http://cabotapp.com', | ||
license='MIT', | ||
install_requires=[ | ||
'Django==1.6.8', | ||
'Markdown==2.5', | ||
'PyJWT==0.1.2', | ||
'South==1.0', | ||
'amqp==1.4.9', | ||
'anyjson==0.3.3', | ||
'argparse==1.2.1', | ||
'billiard==3.3.0.23', | ||
'celery==3.1.23', | ||
'distribute==0.7.3', | ||
'dj-database-url==0.2.2', | ||
'django-appconf==0.6', | ||
'django-celery==3.1.1', | ||
'django-celery-with-redis==3.0', | ||
'django-compressor==1.4', | ||
'django-filter==0.7', | ||
'django-jsonify==0.2.1', | ||
'django-polymorphic==0.5.6', | ||
'django-redis==1.4.5', | ||
'django-smtp-ssl==1.0', | ||
'djangorestframework==2.4.2', | ||
'gunicorn==18.0', | ||
'gevent==1.0.1', | ||
'hiredis==0.1.1', | ||
'httplib2==0.7.7', | ||
'icalendar==3.2', | ||
'kombu==3.0.34', | ||
'mock==1.0.1', | ||
'psycogreen==1.0', | ||
'psycopg2==2.5.1', | ||
'pytz==2014.10', | ||
'redis==2.9.0', | ||
'requests==2.9.1', | ||
'six==1.5.1', | ||
'twilio==3.4.1', | ||
'wsgiref==0.1.2', | ||
'python-dateutil==2.1', | ||
'django-auth-ldap==1.2.6', | ||
] + plugins, | ||
install_requires=requirements + plugins, | ||
packages=find_packages(), | ||
include_package_data=True, | ||
zip_safe=False, | ||
|