Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100755 92 lines (79 sloc) 2.75 kb
deabd9b we now have an install script :D
Justine Tunney authored
1 #!/bin/bash
2 #
3 # OccupyWallSt Setup Script
4 #
5 # This script makes it painless to deploy the website into happy
6 # little self-contained virtualenvs.
7 #
3e6d420 fix install script again
Justine Tunney authored
8 # PROTIP: export PIP_DOWNLOAD_CACHE=~/.pip/cache
9 #
deabd9b we now have an install script :D
Justine Tunney authored
10
11 [ -z $DEST ] && DEST='.'
12 [ -z $PROJ ] && PROJ='ows'
13 [ -z $DB ] && DB=$PROJ
308e41d use 'occupywallst.dev' instead of 'dev.occupywallst.org'
Justine Tunney authored
14 [ -z $DOMAIN ] && DOMAIN='occupywallst.dev'
deabd9b we now have an install script :D
Justine Tunney authored
15 [ -z $RECAPTCHA_PUB ] && RECAPTCHA_PUB='6Lf32MkSAAAAAMKMBKBqwtjdh2TeYUwVthzgPLRC'
16 [ -z $RECAPTCHA_PRIV ] && RECAPTCHA_PRIV='6Lf32MkSAAAAAJPNhPJ7moPueeJSfvjfecyG6x1u'
17 [ -z $REPO ] && REPO=$(git remote -v 2>/dev/null | grep ^origin | awk '{print $2}' | grep /occupywallst\.git$ | head -n 1)
18 [ -z $REPO ] && REPO='git://github.com/jart/occupywallst.git'
19
20 function pg_db_exists {
21 psql -Al | grep ^$1\| >/dev/null
22 return $?
23 }
24
3e6d420 fix install script again
Justine Tunney authored
25 if [ $VIRTUAL_ENV ]; then
26 echo "you're already inside a virtualenv" >&2
27 exit 1
28 fi
29
3817a5b add south migrate to install script
Justine Tunney authored
30 if [ -d $DEST/$PROJ ]; then
31 echo "target $DEST/$PROJ already exists" >&2
32 exit 1
33 fi
34
3416f2e further fix installation script/instructions
Justine Tunney authored
35 if pg_db_exists $DB; then
3817a5b add south migrate to install script
Justine Tunney authored
36 echo "database $DB already exists" >&2
3416f2e further fix installation script/instructions
Justine Tunney authored
37 exit 1
38 fi
39
deabd9b we now have an install script :D
Justine Tunney authored
40 if ! pg_db_exists template_postgis; then
41 echo 'Creating template_postgis database...'
42 createdb template_postgis || exit 1
43 createlang plpgsql template_postgis
44 for SQL in $(ls /usr/share/postgresql/*/contrib/{postgis-*,}/{spatial_ref_sys,postgis}.sql 2>/dev/null); do
45 psql -q -d template_postgis -f $SQL
46 done
47 fi
48
49 # create a virtualenv for our project
3e6d420 fix install script again
Justine Tunney authored
50 cd $DEST || exit 1
51 virtualenv $PROJ || exit 1
52 cd $PROJ || exit 1
53 source bin/activate || exit 1
54 easy_install pip || exit 1
55 git clone $REPO occupywallst || exit 1
56 pip install -e occupywallst || exit 1
57 cd occupywallst || exit 1
deabd9b we now have an install script :D
Justine Tunney authored
58
59 # these settings override what's in settings.py *only* for our local install
60 cat >occupywallst/settings_local.py <<EOF
61 OWS_SITE_NAME = "$DOMAIN"
62 OWS_CANONICAL_URL = "http://$DOMAIN"
3a64f64 install script cookie domain should allow subdomains
Justine Tunney authored
63 SESSION_COOKIE_DOMAIN = ".$DOMAIN"
64 CSRF_COOKIE_DOMAIN = ".$DOMAIN"
deabd9b we now have an install script :D
Justine Tunney authored
65 SECRET_KEY = "$(head -c 51 /dev/urandom | base64)"
66 RECAPTCHA_PUBLIC_KEY = "$RECAPTCHA_PUB"
67 RECAPTCHA_PRIVATE_KEY = "$RECAPTCHA_PRIV"
68 DATABASES = {
69 "default": {
70 "ENGINE": "django.contrib.gis.db.backends.postgis",
71 "NAME": "$DB",
72 },
73 }
74 EOF
75
76 # ask postgres to create our new postgis database
77 createdb $DB
78 createlang plpgsql $DB
79 pg_dump template_postgis | psql -q $DB
80
3817a5b add south migrate to install script
Justine Tunney authored
81 # ask django and south to create the database
deabd9b we now have an install script :D
Justine Tunney authored
82 occupywallst-dev syncdb --noinput
3817a5b add south migrate to install script
Justine Tunney authored
83 occupywallst-dev migrate occupywallst
deabd9b we now have an install script :D
Justine Tunney authored
84
85 # load some starting data so the website actually looks normal
86 occupywallst-dev loaddata verbiage
87 occupywallst-dev loaddata example_data
88
89 # install dependencies for node.js javascript sub-project
90 cd chat
91 npm install -d
Something went wrong with that request. Please try again.