forked from 18F/fbopen
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinitial-dev-setup.sh
More file actions
executable file
·76 lines (61 loc) · 1.86 KB
/
initial-dev-setup.sh
File metadata and controls
executable file
·76 lines (61 loc) · 1.86 KB
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
72
73
74
75
# http://stackoverflow.com/a/3931779/94154
command_exists () {
type "$1" &> /dev/null ;
}
ES_VERSION=1.2.1
FBOPEN_ROOT=`pwd`
echo "Initial setup"
./setup.sh
# wget and ES
echo "Checking if wget is installed."
if command_exists wget ; then
echo "wget is already installed."
else
echo "wget is not already installed. Installing via brew..."
brew install wget
fi
# install ES if it doesn't already exist
if [ -d ../elasticsearch-$ES_VERSION.zip ]; then
echo "Elasticsearch is already installed."
else
echo "Installing Elasticsearch"
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-$ES_VERSION.zip -P ../
unzip ../elasticsearch-$ES_VERSION.zip -d ../
rm -rf ../elasticsearch-$ES_VERSION.zip
fi
# use custom config
cp elasticsearch/elasticsearch__dev.yml elasticsearch-$ES_VERSION/config/elasticsearch.yml
# install mapper-attachments
elasticsearch-$ES_VERSION/bin/plugin -install elasticsearch/elasticsearch-mapper-attachments/2.0.0
echo "Starting Elasticsearch"
osascript<<EOF
tell application "System Events"
tell process "Terminal" to keystroke "t" using command down
end
tell application "Terminal"
activate
do script with command "fbopen/elasticsearch-$ES_VERSION/bin/elasticsearch" in window 1
end tell
EOF
# init index with mappings and settings
curl -XPUT localhost:9200/fbopen0 --data-binary @elasticsearch/init.json
# API
echo "Creating api/config.js from sample."
cp api/config-sample_dev.js api/config.js
if command_exists node ; then
echo
else
echo "It looks like node.js is not installed. Please install it."
exit 1
fi
npm install api/
sudo mkdir -p /var/log/fbopen/api.log
# Loaders
## bids.state.gov
npm install loaders/bids.state.gov/
## common
npm install loaders/common/
# problems:
cd loaders/bids.state.gov
FBOPEN_ROOT=$FBOPEN_ROOT FBOPEN_URI=localhost:9200 FBOPEN_INDEX=fbopen ./bids-nightly.sh
cd ../..