2 ###############################################################################
3 # reddit dev environment installer
4 # --------------------------------
5 # This script installs a reddit stack suitable for development. DO NOT run this
6 # on a system that you use for other purposes as it might delete important
7 # files, truncate your databases, and otherwise do mean things to you.
9 # By default, this script will install the reddit code in the current user's
10 # home directory and all of its dependencies (including libraries and database
11 # servers) at the system level. The installed reddit will expect to be visited
12 # on the domain "reddit.local" unless specified otherwise. Configuring name
13 # resolution for the domain is expected to be done outside the installed
14 # environment (e.g. in your host machine's /etc/hosts file) and is not
15 # something this script handles.
17 # Several configuration options (listed in the "Configuration" section below)
18 # are overridable with environment variables. e.g.
20 # sudo REDDIT_DOMAIN=example.com ./install/reddit.sh
22 ###############################################################################
27 SCRIPTDIR
="$RUNDIR/install"
29 # the canonical source of all installers
30 GITREPO
="https://raw.github.com/reddit/reddit/master/install"
35 "install_cassandra.sh"
46 for item
in ${NEEDED[*]}; do
47 if [ ! -x $SCRIPTDIR/$item ]; then
53 function important
() {
54 echo -e "\033[31m${1}\033[0m"
57 if [ "$MISSING" != "" ]; then
58 important
"It looks like you're installing without a local repo. No problem!"
59 important
"We're going to grab the scripts we need and show you where you can"
60 important
"edit the config to suit your environment."
63 pushd $SCRIPTDIR > /dev
/null
64 for item
in ${NEEDED[*]}; do
65 echo "Grabbing '${item}'..."
66 wget
-q $GITREPO/$item
74 echo "#######################################################################"
75 echo "# Base configuration:"
76 echo "#######################################################################"
77 source $SCRIPTDIR/install.cfg
81 important
"Before proceeding, make sure that these look reasonable. If not,"
82 important
"you can either edit install/install.cfg or set overrides when running"
83 important
"(they will be respected)."
85 important
"Seriously, if this is your first time installing, stop here and read"
86 important
"the script (install/reddit.sh) and that config. It's got some helpful"
87 important
"information that can prevent common issues."
89 important
"Resolving to the appropriate domain name is beyond the scope of this document,"
90 important
"but the easiest thing is probably editing /etc/hosts on the host machine."
92 read -er -n1 -p "proceed? [Y/n]" response
93 if [[ $response =~ ^
[Yy
]$ ||
$response == "" ]]; then
94 echo "Excellent. Here we go. We're going to need sudo for this one:"
95 sudo
$SCRIPTDIR/reddit.sh