Skip to content

Commit

Permalink
Merge pull request #58 from totem/develop
Browse files Browse the repository at this point in the history
0.5.1 Release
  • Loading branch information
sukrit007 committed Jun 23, 2016
2 parents 9b49587 + edf5aa7 commit 20e4d5c
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 6 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ RUN apk add --no-cache --update \
gettext \
curl \
openssl \
libffi \
openssh-client \

# Etcdctl
Expand Down
3 changes: 3 additions & 0 deletions conf/appconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,3 +298,6 @@
DEFAULT_DEPLOYMENT_EXPIRY_SECONDS = 4 * 7 * 24 * 3600 # 4 weeks
DEPLOYMENT_EXPIRY_SECONDS = int(
os.getenv('DEPLOYMENT_EXPIRY_SECONDS', DEFAULT_DEPLOYMENT_EXPIRY_SECONDS))
DEFAULT_EVENT_EXPIRY_SECONDS = 365 * 24 * 3600 # 1 year
EVENT_EXPIRY_SECONDS = int(
os.getenv('EVENT_EXPIRY_SECONDS', DEFAULT_EVENT_EXPIRY_SECONDS))
2 changes: 1 addition & 1 deletion deployer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from celery.signals import setup_logging


__version__ = '0.5.0'
__version__ = '0.5.1'
__author__ = 'sukrit'

deployer.logger.init_logging()
Expand Down
10 changes: 8 additions & 2 deletions deployer/services/storage/mongo.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
import pytz
from conf.appconfig import MONGODB_URL, MONGODB_DEPLOYMENT_COLLECTION, \
MONGODB_DB, DEPLOYMENT_EXPIRY_SECONDS, MONGODB_EVENT_COLLECTION, \
DEPLOYMENT_STATE_PROMOTED, RUNNING_DEPLOYMENT_STATES, CLUSTER_NAME
DEPLOYMENT_STATE_PROMOTED, RUNNING_DEPLOYMENT_STATES, CLUSTER_NAME, \
EVENT_EXPIRY_SECONDS
from deployer.services.storage.base import AbstractStore

__author__ = 'sukrit'
Expand Down Expand Up @@ -45,7 +46,6 @@ def setup(self):
:return:
"""
idxs = self._deployments.index_information()
self._deployments.drop_indexes()
if 'created_idx' not in idxs:
self._deployments.create_index(
[('cluster', pymongo.ASCENDING),
Expand All @@ -69,6 +69,12 @@ def setup(self):

], name='app_idx')

event_idxs = self._events.index_information()
if 'expiry_idx' not in event_idxs:
self._events.create_index(
[('_expiry', pymongo.DESCENDING)], name='expiry_idx',
background=True, expireAfterSeconds=EVENT_EXPIRY_SECONDS)

@property
def _db(self):
return self.client[self.dbname]
Expand Down
4 changes: 1 addition & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ Flask==0.10.1
Flask-Cors==2.1.2
pymongo==3.2.2
gevent==1.1.1
# Uncomment below , when 2.0.13 is released See https://github.com/gliderlabs/docker-alpine/issues/158#issuecomment-205401343
# uWSGI==2.0.13
https://github.com/unbit/uwsgi/archive/uwsgi-2.0.zip#egg=uwsgi
uWSGI==2.0.13.1
python-etcd==0.3.2
future==0.15.2
pytz==2016.3
Expand Down
3 changes: 3 additions & 0 deletions tests/integration/services/storage/test_mongo.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,15 @@ def test_store_setup(self):
# When I get the index informatiom
# Note: Setup was already called
indexes = self.store._deployments.index_information()
event_indexes = self.store._events.index_information()

# Indexes are created as expected
for idx in ('created_idx', 'identity_idx', 'app_idx',
'expiry_idx'):
ok_(idx in indexes, '{} was not created'.format(idx))

ok_('expiry_idx' in event_indexes, 'Event expiry_idx was not created')

def test_get_deployment(self):

# When I get existing deployment
Expand Down

0 comments on commit 20e4d5c

Please sign in to comment.