-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathsetup.sh
executable file
·70 lines (62 loc) · 1.75 KB
/
setup.sh
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
#!/usr/bin/env bash
# Set up a local development mongo/mongo-connector/elasticsearch environment.
set -e
case "$(docker-compose version)" in
*docker-compose\ version\ 1*)
# docker-compose exec sometimes breaks in v1
echo "Requires docker-compose version 2 or greater."
exit 1
;;
esac
echo "*****************"
echo "STARTING DATABASE SERVICES"
echo "*****************"
docker-compose up -d mm-mongo mm-elastic
echo "DONE."
echo ""
echo "*****************"
echo "SETTING UP MONGO"
echo "*****************"
sleep 5
echo "Add dev user to database to bypass authentication"
docker-compose exec mm-mongo mongo matchminer --eval 'db.user.replaceOne({
"_id": ObjectId("577cf6ef2b9920002cef0337")
}, {
"_id": ObjectId("577cf6ef2b9920002cef0337"),
"last_name" : "Doe",
"teams" : [
ObjectId("5a8ede8f4e0cce002dd5913c")
],
"_updated" : ISODate("2018-02-22T10:15:27.000-05:00"),
"first_name" : "John",
"roles" : [
"user",
"cti",
"oncologist",
"admin"
],
"title" : "",
"email" : "[email protected]",
"_created" : ISODate("2018-02-22T10:15:27.000-05:00"),
"user_name" : "du123",
"token" : "fb4d6830-d3aa-481b-bcd6-270d69790e11",
"oncore_token" : "5f3c2421-271c-41ba-ac14-899f214d49b9"
}, { "upsert": true })'
echo ""
echo "*****************"
echo "SETTING UP ELASTICSEARCH"
echo "*****************"
# naively wait for elasticsearch to start up
sleep 20
# run script to configure indexes, synonyms, etc.
docker-compose build mm-api
echo "Setup elasticsearch settings, mappings"
docker-compose run --rm mm-api python pymm_run.py reset-elasticsearch
echo "DONE."
echo ""
echo "*****************"
echo "STARTING API"
echo "*****************"
docker-compose build mm-api
docker-compose up mm-api
echo "Go to: http://localhost:5000"