forked from oppia/oppia
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstart.sh
executable file
·110 lines (96 loc) · 3.48 KB
/
start.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
#!/usr/bin/env bash
# Copyright 2014 The Oppia Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS-IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
##########################################################################
# INSTRUCTIONS:
#
# This script starts up a development server running Oppia. It installs any
# missing third-party dependencies and starts up a local GAE development
# server.
#
# Run the script from the oppia root folder:
#
# bash scripts/start.sh
#
# Note that the root folder MUST be named 'oppia'.
if [ -z "$BASH_VERSION" ]
then
echo ""
echo " Please run me using bash: "
echo ""
echo " bash $0"
echo ""
return 1
fi
set -e
source $(dirname $0)/setup.sh || exit 1
source $(dirname $0)/setup_gae.sh || exit 1
set -- "${remaining_params[@]}"
echo Checking whether GAE is installed in $GOOGLE_APP_ENGINE_HOME
if [ ! -f "$GOOGLE_APP_ENGINE_HOME/appcfg.py" ]; then
echo "Installing Google App Engine (this may take a little while)..."
mkdir -p $GOOGLE_APP_ENGINE_HOME
curl --silent https://storage.googleapis.com/appengine-sdks/deprecated/1919/google_appengine_1.9.19.zip -o gae-download.zip
unzip -q gae-download.zip -d $TOOLS_DIR/google_appengine_1.9.19/
rm gae-download.zip
fi
# Install third party dependencies.
bash scripts/install_third_party.sh
# Check that there isn't a server already running.
if ( nc -vz localhost 8181 >/dev/null 2>&1 ); then
echo ""
echo " WARNING"
echo " Could not start new server. There is already an existing server"
echo " running at port 8181."
echo ""
exit 1
fi
# Launch a browser window.
if [ -f "/usr/bin/google-chrome" ]; then
echo ""
echo " INFORMATION"
echo " Setting up a local development server at localhost:8181. Opening a"
echo " Chrome browser window pointing to this server."
echo ""
(sleep 5; /usr/bin/google-chrome http://localhost:8181/ )&
elif [ -e /Applications/Google\ Chrome.app ]; then
echo ""
echo " INFORMATION"
echo " Setting up a local development server at localhost:8181. Opening a"
echo " Chrome browser window pointing to this server."
echo ""
(sleep 5; open /Applications/Google\ Chrome.app http://localhost:8181/ )&
else
echo ""
echo " INFORMATION"
echo " Setting up a local development server. You can access this server"
echo " by navigating to localhost:8181 in a browser window."
echo ""
fi
# Argument passed to dev_appserver.py to indicate whether or not to
# clear the datastore.
CLEAR_DATASTORE_ARG="--clear_datastore=true"
for arg in "$@"; do
if [ "$arg" == "--save_datastore" ]; then
CLEAR_DATASTORE_ARG=""
fi
done
# Set up a local dev instance.
# TODO(sll): do this in a new shell.
echo Starting GAE development server
# To turn emailing on, add the option '--enable_sendmail=yes' and change the relevant
# settings in feconf.py. Be careful with this -- you do not want to spam people
# accidentally!
$NODE_PATH/bin/node $NODE_MODULE_DIR/gulp/bin/gulp.js start_devserver --gae_devserver_path=$GOOGLE_APP_ENGINE_HOME/dev_appserver.py --clear_datastore=$CLEAR_DATASTORE_ARG
echo Done!