~mark-mims/charms/precise/summit/trunk

« back to all changes in this revision

Viewing changes to lib/config-summit.sh

  • Committer: Mark Mims
  • Date: 2012-03-08 19:36:04 UTC
  • Revision ID: mark.mims@canonical.com-20120308193604-1sntzjkixbz8ijns
basic summit extras

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
 
 
3
generate_ssh_keys() {
 
4
  #MMM this goes away when bzr+ssh: changes to http:
 
5
  local user=$1
 
6
  local home=$2
 
7
  if [ ! -f $home/.ssh/id_rsa ]; then
 
8
    su -l $user -c "ssh-keygen -q -N '' -t rsa -b 2048 -f $home/.ssh/id_rsa"
 
9
  fi
 
10
}
 
11
 
 
12
pip_install() {
 
13
  local requirements=$1
 
14
  pip install -r $requirements
 
15
}
 
16
 
 
17
 
 
18
#MMM idempotency?
 
19
configure_summit() {
 
20
  local project_dir=$1
 
21
 
 
22
  generate_ssh_keys ubuntu /home/ubuntu
 
23
 
 
24
  pip_install "$project_dir/requirements.txt"
 
25
 
 
26
  # db should be here for the rest of this
 
27
 
 
28
  # template local_settings.py
 
29
  cp local_settings.py.sample local_settings.py
 
30
 
 
31
  ./manage.py init-summit
 
32
  ./manage.py pullapps
 
33
 
 
34
  ./manage.py syncdb
 
35
  ./manage.py migrate
 
36
 
 
37
}
 
38
 
 
39
run_summit() {
 
40
  local project_dir=$1
 
41
 
 
42
  # template a real upstart job here
 
43
  ./manage.py runserver
 
44
 
 
45
}
 
46