~jorge/charms/precise/lamp/readme-fixes

« back to all changes in this revision

Viewing changes to hooks/db-admin-relation-changed

  • Committer: Victor Palau
  • Date: 2012-09-28 11:03:35 UTC
  • Revision ID: vtuson@gmail.com-20120928110335-yk7ffaj9azw8fb4h
part1 of changes implementing charm review feedback

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/bin/sh
2
2
 
3
 
#set -ux
4
 
 
5
3
user=`relation-get user`
6
4
password=`relation-get password`
7
5
host=`relation-get private-address`
12
10
fi
13
11
 
14
12
# Build config file to hold configuration options
15
 
 
16
13
juju-log "Building config file for $host"
17
14
cat > "config/$host" <<EOF
18
15
#!/bin/sh
23
20
server_db=${database}
24
21
EOF
25
22
#
26
 
 
 
23
#creating file pointing to last configuration 
27
24
cat > "config/mysql" <<EOF
28
25
server_ip=${host}
29
26
EOF
30
27
#
31
28
 
 
29
#building the database
32
30
juju-log "Building $database database on $host"
33
 
 
34
31
mysqladmin -h $host -u $user --password=$password create "$database"
35
32
mysql -h $host -u $user --password=$password $database < ./config/mysql_conf
36
33
 
37
 
 
 
34
#setting up configuration files to be accessible by apache process
38
35
cp ./config/* /var/webconfig
39
 
 
40
 
juju-log "Exposing apache2 service"
41
 
open-port 80/tcp
42
 
 
 
36
chown -R www-data:www-data ./config
 
37
chown -R www-data:www-data /var/webconfig
 
38
chmod 640 ./config/*
 
39
chmod 640 /var/webconfig/*