-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy patheditor-develop.sh
executable file
·162 lines (148 loc) · 4.87 KB
/
editor-develop.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
#!/usr/bin/env bash
set -e
if [ ! -d data ]; then
mkdir data
fi
if [ ! -d data/csv ]; then
mkdir data/csv
fi
if [ ! -d data/client ]; then
mkdir data/client
fi
if [ ! -d data/archives ]; then
mkdir data/archives
fi
if [ ! -d data/client/releases ]; then
mkdir data/client/releases
fi
if [ ! -d data/client/releases/prod ]; then
mkdir data/client/releases/prod
fi
if [ ! -d data/client/releases/qa ]; then
mkdir data/client/releases/qa
fi
if [ ! -d data/client/releases/prod/apks ]; then
mkdir data/client/releases/prod/apks
fi
if [ ! -d data/client/releases/prod/dat ]; then
mkdir data/client/releases/prod/dat
fi
if [ ! -d data/client/releases/qa/dat ]; then
mkdir data/client/releases/qa/dat
fi
if [ ! -d data/client/releases/prod/pwas ]; then
mkdir data/client/releases/prod/pwas
fi
if [ ! -d data/client/releases/qa ]; then
mkdir data/client/releases/qa
fi
if [ ! -d data/client/releases/qa/apks ]; then
mkdir data/client/releases/qa/apks
fi
if [ ! -d data/client/releases/qa/pwas ]; then
mkdir data/client/releases/qa/pwas
fi
if [ ! -f data/reporting-worker-state.json ]; then
echo '{}' > data/reporting-worker-state.json
fi
if [ ! -f data/paid-worker-state.json ]; then
echo '{}' > data/paid-worker-state.json
fi
# Load config.
source ./config.defaults.sh
if [ -f "./config.sh" ]; then
source ./config.sh
else
echo "You have no config.sh. Copy config.defaults.sh to config.sh, change the passwords and try again." && exit 1;
fi
docker build -t tangerine/tangerine:local .
[ "$(docker ps | grep $T_CONTAINER_NAME)" ] && docker stop $T_CONTAINER_NAME
[ "$(docker ps -a | grep $T_CONTAINER_NAME)" ] && docker rm $T_CONTAINER_NAME
COUCHDB_OPTIONS=""
if [ "$T_COUCHDB_ENABLE" = "true" ] && [ "$T_COUCHDB_LOCAL" = "true" ]; then
if [ ! -d data/couchdb ]; then
mkdir data/couchdb
fi
if [ ! -d data/couchdb/data ]; then
mkdir data/couchdb/data
fi
if [ ! -d data/couchdb/local.d ]; then
mkdir data/couchdb/local.d
fi
if [ ! -f data/couchdb/local.d/local.ini ]; then
echo "
[chttpd]
bind_address = any
[httpd]
bind_address = any
[couch_httpd_auth]
require_valid_user = true
[chttpd]
require_valid_user = true
" > data/couchdb/local.d/local.ini
fi
[ "$(docker ps | grep $T_COUCHDB_CONTAINER_NAME)" ] && docker stop $T_COUCHDB_CONTAINER_NAME
[ "$(docker ps -a | grep $T_COUCHDB_CONTAINER_NAME)" ] && docker rm $T_COUCHDB_CONTAINER_NAME
docker run -d \
-e COUCHDB_USER=$T_COUCHDB_USER_ADMIN_NAME \
-e COUCHDB_PASSWORD=$T_COUCHDB_USER_ADMIN_PASS \
-p 5984:5984 \
-v $(pwd)/data/couchdb/data:/opt/couchdb/data \
-v $(pwd)/data/couchdb/local.d:/opt/couchdb/etc/local.d \
--name $T_COUCHDB_CONTAINER_NAME \
couchdb
COUCHDB_OPTIONS="
--link $T_COUCHDB_CONTAINER_NAME:couchdb \
-e T_COUCHDB_ENABLE=$T_COUCHDB_ENABLE \
-e T_COUCHDB_ENDPOINT=\"$T_COUCHDB_ENDPOINT\" \
-e T_COUCHDB_USER_ADMIN_NAME=$T_COUCHDB_USER_ADMIN_NAME \
-e T_COUCHDB_USER_ADMIN_PASS=$T_COUCHDB_USER_ADMIN_PASS \
"
fi
sleep 10
CMD="docker run -it --name $T_CONTAINER_NAME \
$COUCHDB_OPTIONS \
--entrypoint=\"/tangerine/entrypoint-development.sh\" \
--env \"NODE_ENV=development\" \
--env \"T_VERSION=$T_TAG\" \
--env \"T_PROTOCOL=$T_PROTOCOL\" \
--env \"T_ADMIN=$T_ADMIN\" \
--env \"T_PASS=$T_PASS\" \
--env \"T_UPLOAD_TOKEN=$T_UPLOAD_TOKEN\" \
--env \"T_USER1=$T_USER1\" \
--env \"T_USER1_PASSWORD=$T_USER1_PASSWORD\" \
--env \"T_HOST_NAME=$T_HOST_NAME\" \
--env \"T_REPLICATE=$T_REPLICATE\" \
--env \"T_PAID_ALLOWANCE=$T_PAID_ALLOWANCE\" \
--env \"T_PAID_MODE=$T_PAID_MODE\" \
--env \"T_CSV_BATCH_SIZE=$T_CSV_BATCH_SIZE\" \
--env \"T_HIDE_PROFILE=$T_HIDE_PROFILE\" \
--env \"T_MODULES=$T_MODULES\" \
--env \"T_LANG_DIRECTION=$T_LANG_DIRECTION\" \
--env \"T_LEGACY=$T_LEGACY\" \
--env \"T_SYNC_SERVER=$T_SYNC_SERVER\" \
--env \"T_REGISTRATION_REQUIRES_SERVER_USER=$T_REGISTRATION_REQUIRES_SERVER_USER\" \
--env \"T_CENTRALLY_MANAGED_USER_PROFILE=$T_CENTRALLY_MANAGED_USER_PROFILE\" \
--env \"T_CATEGORIES=$T_CATEGORIES\" \
--env \"T_ORIENTATION=$T_ORIENTATION\" \
--env \"T_JWT_ISSUER=$T_JWT_ISSUER\" \
--env \"T_JWT_EXPIRES_IN=$T_JWT_EXPIRES_IN\" \
$T_PORT_MAPPING \
-p 9229:9229 \
-p 9228:9228 \
-p 9227:9227 \
-p 9226:9226 \
-p 9225:9225 \
--volume $(pwd)/data/db:/tangerine/db/ \
--volume $(pwd)/data/groups:/tangerine/groups/ \
--volume $(pwd)/data/client/releases:/tangerine/client/releases/ \
--volume $(pwd)/data/client/content/groups:/tangerine/client/content/groups \
--volume $(pwd)/data/client/content/assets:/tangerine/client/content/assets \
--volume $(pwd)/server/index.js:/tangerine/server/index.js \
--volume $(pwd)/server/package.json:/tangerine/server/package.json \
--volume $(pwd)/server/src:/tangerine/server/src \
--volume $(pwd)/server/reporting:/tangerine/server/reporting \
--volume $(pwd)/editor/src:/tangerine/editor/src \
tangerine/tangerine:local
"
eval ${CMD}