2 # The contents of this file are subject to the Common Public Attribution
3 # License Version 1.0. (the "License"); you may not use this file except in
4 # compliance with the License. You may obtain a copy of the License at
5 # http://code.reddit.com/LICENSE. The License is based on the Mozilla Public
6 # License Version 1.1, but Sections 14 and 15 have been added to cover use of
7 # software over a computer network and provide for limited attribution for the
8 # Original Developer. In addition, Exhibit A has been modified to be consistent
11 # Software distributed under the License is distributed on an "AS IS" basis,
12 # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
13 # the specific language governing rights and limitations under the License.
15 # The Original Code is reddit.
17 # The Original Developer is the Initial Developer. The Initial Developer of
18 # the Original Code is reddit Inc.
20 # All portions of the code written by reddit are Copyright (c) 2006-2015 reddit
21 # Inc. All Rights Reserved.
22 ###############################################################################
24 ###############################################################################
25 # reddit travis environment installer
26 # -----------------------------------
27 # This script installs a reddit stack suitable for running on travis-ci.
28 # As such, this is a minimal build to allow for running "nosetests"
30 ###############################################################################
34 source $RUNDIR/install.cfg
36 # who is running me (expects "travis" or "vagrant")
37 ENVIRONMENT
=${1:-travis}
39 # the root directory to base the install in. must exist already
40 REDDIT_CODE
=${2:-$REDDIT_SRC/reddit}
42 if [ ! -e $REDDIT_CODE ]; then
43 echo "Couldn't find source $REDDIT_CODE. Aborting"
47 ###############################################################################
49 ###############################################################################
50 if [[ $EUID -ne 0 ]]; then
51 echo "ERROR: Must be run with root privileges."
55 if [[ "amd64" != $
(dpkg
--print-architecture) ]]; then
57 ERROR: This host is running the $(dpkg --print-architecture) architecture!
59 Because of the pre-built dependencies in our PPA, and some extra picky things
60 like ID generation in liveupdate, installing reddit is only supported on amd64
66 # seriously! these checks are here for a reason. the packages from the
67 # reddit ppa aren't built for anything but trusty (14.04) right now, so
68 # if you try and use this install script on another release you're gonna
70 source /etc
/lsb-release
71 if [ "$DISTRIB_ID" != "Ubuntu" -o "$DISTRIB_RELEASE" != "14.04" ]; then
72 echo "ERROR: Only Ubuntu 14.04 is supported."
76 ###############################################################################
77 # Install prerequisites
78 ###############################################################################
79 $RUNDIR/install_apt.sh
81 $RUNDIR/install_cassandra.sh
82 $RUNDIR/install_zookeeper.sh
84 ###############################################################################
85 # Install and configure the reddit code
86 ###############################################################################
88 [ -x "$(which pip)" ] || easy_install pip
89 pip
install -U pip wheel setuptools coverage
91 sudo python setup.py build
92 python setup.py develop
94 ln -sf example.ini
test.ini
97 ###############################################################################
98 # Install services (for local testing only!)
99 # NB: this is otherwise handled in the .travis.yml in before_script
100 ###############################################################################
101 if [ "$ENVIRONMENT" == "vagrant" ]; then
102 # install services (cassandra, postgres, etc.)
103 $RUNDIR/install_services.sh
104 # travis doesn't have mcrouter as a possible service, so we need to
105 # be able to test without that running
106 service mcrouter stop
107 # Configure PostgreSQL
108 $RUNDIR/setup_postgres.sh
109 # Configure Cassandra
110 $RUNDIR/setup_cassandra.sh
112 $RUNDIR/setup_rabbitmq.sh
115 ###############################################################################
117 ###############################################################################
120 Congratulations! A base version of reddit is now installed. To run the