Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 49 lines (42 sloc) 1.475 kB
044a8ff @yaniv-aknin initial commit
yaniv-aknin authored
1 # http://stackoverflow.com/questions/59895/can-a-bash-script-tell-what-directory-its-stored-in
dfedfdf @yaniv-aknin devops: add some deployment/provisioning fixes
yaniv-aknin authored
2 root="$( cd "$( dirname -- "$0" )" && pwd )"
044a8ff @yaniv-aknin initial commit
yaniv-aknin authored
3
8825216 @yaniv-aknin models: add flask-sqlalchemy integration
yaniv-aknin authored
4 # provision directories for dev environment
5 export VAR_DIR="${root}/.venv/var"
6 mkdir -p $VAR_DIR
7
2ec04d6 @yaniv-aknin devops: enrich configuration elements, add SERVER_NAME
yaniv-aknin authored
8 # configuration
308d789 @yaniv-aknin devops: make a package, add management and configuration stubs
yaniv-aknin authored
9 export DEBUG=1
c334568 @yaniv-aknin devops: add CDN support
yaniv-aknin authored
10 export AWS_ACCESS_KEY_ID=""
11 export AWS_SECRET_ACCESS_KEY=""
2ec04d6 @yaniv-aknin devops: enrich configuration elements, add SERVER_NAME
yaniv-aknin authored
12 export SERVER_NAME='localhost:5000'
8825216 @yaniv-aknin models: add flask-sqlalchemy integration
yaniv-aknin authored
13 export DATABASE_URL="sqlite:///${VAR_DIR}/database.sqlite"
9504a85 @yaniv-aknin backend/auth: add backend authentication support
yaniv-aknin authored
14 export SECRET_KEY="development"
308d789 @yaniv-aknin devops: make a package, add management and configuration stubs
yaniv-aknin authored
15
2ec04d6 @yaniv-aknin devops: enrich configuration elements, add SERVER_NAME
yaniv-aknin authored
16 # local runcommands
308d789 @yaniv-aknin devops: make a package, add management and configuration stubs
yaniv-aknin authored
17 [ -f "${root}"/runcommands.local.sh ] && source runcommands.local.sh
18
219b1df @yaniv-aknin devops: make project Heroku deployable with gunicorn/gevent
yaniv-aknin authored
19 # functions
20 function cloud_setup() {
21 [ -z "$1" ] && { echo "usage: $0 <setup-name>"; return 1; }
22 echo "Switching this environment to use $1 resources"
23 set -a
24 source <(heroku config -s -a $1 < /dev/null)
25 set +a
26 if [ "$SECRET_KEY" = "development" ]; then
27 warning "Failed getting setup configuration or setup has invalid SECRET_KEY variable"
28 return 1
29 fi
30 source <(python << EOF
31 import urlobject
32 url = urlobject.URLObject("$DATABASE_URL")
33 def out(k, v): print("export %s=%s" % (k,v))
34 out("PGHOST", url.hostname)
35 out("PGUSER", url.username)
36 out("PGPASSWORD", url.password)
37 out("PGDATABASE", url.path[1:])
38 EOF
39 )
40 }
41
dfedfdf @yaniv-aknin devops: add some deployment/provisioning fixes
yaniv-aknin authored
42 # provisioning
43 function whence() { which $1 > /dev/null; }
44 whence coffee || echo '`coffee` missing from path; make sure CoffeeScript is installed (coffeescript.org)'
45 whence java || echo '`java` missing from path; make sure some JRE is installed'
46 unset whence
47
044a8ff @yaniv-aknin initial commit
yaniv-aknin authored
48 unset root
Something went wrong with that request. Please try again.