-
Notifications
You must be signed in to change notification settings - Fork 16
/
Makefile
71 lines (51 loc) · 2.04 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
.SILENT:
all: install_deps test
filename=mongotor-`python -c 'import mongotor;print mongotor.version'`.tar.gz
export PYTHONPATH:= ${PWD}
MONGOD=mongod
MONGO_DATA=`pwd`/data
mongo-start-node1:
${MONGOD} --port=27027 --dbpath=${MONGO_DATA}/db/node1 --replSet=mongotor --logpath=${MONGO_DATA}/log/node1.log --fork --smallfiles --oplogSize 30 --nojournal
mongo-start-node2:
${MONGOD} --port=27028 --dbpath=${MONGO_DATA}/db/node2 --replSet=mongotor --logpath=${MONGO_DATA}/log/node2.log --fork --smallfiles --oplogSize 30 --nojournal
mongo-start-arbiter:
${MONGOD} --port=27029 --dbpath=${MONGO_DATA}/db/arbiter --replSet=mongotor --logpath=${MONGO_DATA}/log/arbiter.log --fork --smallfiles --oplogSize 30 --nojournal
mongo-restart: mongo-kill mongo-start
mongo-start:
mkdir -p ${MONGO_DATA}/db/node1 ${MONGO_DATA}/db/node2 ${MONGO_DATA}/db/arbiter ${MONGO_DATA}/log
echo "starting mongo instance"
make mongo-start-node1
make mongo-start-node2
make mongo-start-arbiter
echo 'Waiting 10s for `mongod`s to start'
sleep 10
mongo-kill-node1:
ps -eo pid,args | grep 27027 | grep ${MONGO_DATA} | grep -v grep | awk '{print $$1}' | xargs kill 2> /dev/null | true
mongo-kill-node2:
ps -eo pid,args | grep 27028 | grep ${MONGO_DATA} | grep -v grep | awk '{print $$1}' | xargs kill 2> /dev/null | true
mongo-kill-arbiter:
ps -eo pid,args | grep 27029 | grep ${MONGO_DATA} | grep -v grep | awk '{print $$1}' | xargs kill 2> /dev/null | true
mongo-kill:
echo "killing mongo instance"
make mongo-kill-node1
make mongo-kill-node2
make mongo-kill-arbiter
echo 'Waiting 1s for `mongod`s to stop'
sleep 1
mongo-config:
mongo localhost:27027 < config-replicaset.js
echo 'Waiting 40s to let replicaset elect a primary'
sleep 40
install_deps:
pip install -r requirements-dev.txt
test: clean
nosetests
clean:
echo "Cleaning up build and *.pyc files..."
find . -name '*.pyc' -exec rm -rf {} \;
release: clean test publish
printf "Exporting to $(filename)... "
tar czf $(filename) mongotor setup.py README.md
echo "DONE!"
publish:
python setup.py sdist register upload