Merge lp:~kwmonroe/charms/trusty/suitecrm/updates into lp:~joe/charms/trusty/suitecrm/trunk

Proposed by Kevin W Monroe
Status: Merged
Merged at revision: 4
Proposed branch: lp:~kwmonroe/charms/trusty/suitecrm/updates
Merge into: lp:~joe/charms/trusty/suitecrm/trunk
Diff against target: 185 lines (+86/-27)
6 files modified
README.md (+27/-14)
hooks/database-relation-changed (+2/-12)
revision (+0/-1)
tests/00-setup (+5/-0)
tests/100-deploy-suitecrm (+42/-0)
tests/tests.yaml (+10/-0)
To merge this branch: bzr merge lp:~kwmonroe/charms/trusty/suitecrm/updates
Reviewer Review Type Date Requested Status
Joe Liau Approve
Review via email: mp+268270@code.launchpad.net

Description of the change

Proposed changes to address comments from the new charm bug:

https://bugs.launchpad.net/charms/+bug/1479471

To post a comment you must log in.
Revision history for this message
Joe Liau (joe) wrote :

Thank you.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'README.md'
2--- README.md 2015-07-29 05:44:12 +0000
3+++ README.md 2015-08-17 18:54:42 +0000
4@@ -1,38 +1,51 @@
5 # Foreward
6
7 Based heavily on the SugarCRM charm by Matthew Bruzek and Tim Van Steenburgh
8-Source: https://jujucharms.com/u/cabs-team/sugarcrm/trusty/16
9+([source](https://jujucharms.com/u/cabs-team/sugarcrm/trusty)).
10
11 # Overview
12
13 SuiteCRM is an open source alternative to Salesforce, Dynamics and SugarCRM.
14
15-This charm will deploy the CRM software and connect it to a running MySQL database. This charm will install the SuiteCRM files in /var/www/html/suitecrm/
16+This charm will deploy the CRM software and connect it to a running MySQL
17+database. This charm will install the SuiteCRM files in `/var/www/html/suitecrm`.
18
19
20 # Installation
21
22-To deploy this charm you will need at a minimum: a cloud environment, working Juju installation and a successful bootstrap. Once bootstrapped, deploy the MySQL charm and then this SuiteCRM charm:
23+To deploy this charm, you will need at a minimum: a cloud environment, working
24+Juju installation, and a successful bootstrap. Once bootstrapped, deploy the
25+MySQL charm and then this SuiteCRM charm:
26+
27 juju deploy mysql
28 juju deploy suitecrm
29+
30 Add a relation between the two of them:
31+
32 juju add-relation suitecrm:database mysql:db
33+
34 And finally expose the SuiteCRM service:
35+
36 juju expose suitecrm
37
38
39 # Configuration
40
41-Default login
42-
43-user: Admin
44-pass: thisisaTEST!
45-
46-For SuiteCRM notifications to work add to crontab:
47-* * * * * cd /var/www/html/suitecrm; php -f cron.php > /dev/null 2>&1
48+Default login:
49+
50+* user: Admin
51+* pass: thisisaTEST!
52+
53+We suggest you change this default password immediately after deployment for
54+security purposes.
55+
56+For SuiteCRM notifications to work, add the following to crontab on each of
57+your `suitecrm` units:
58+
59+ * * * * * cd /var/www/html/suitecrm; php -f cron.php > /dev/null 2>&1
60+
61
62 # Contact Information
63-E-mail: Joe Liau <joe@ubuntuvancouver.org>
64-Source: https://github.com/salesagility/SuiteCRM
65-
66-
67+
68+* E-mail: Joe Liau <joe@ubuntuvancouver.org>
69+* Source: https://github.com/salesagility/SuiteCRM
70
71=== modified file 'hooks/cache-relation-changed' (properties changed: -x to +x)
72=== modified file 'hooks/cache-relation-departed' (properties changed: -x to +x)
73=== modified file 'hooks/config-changed' (properties changed: -x to +x)
74=== modified file 'hooks/database-relation-broken' (properties changed: -x to +x)
75=== modified file 'hooks/database-relation-changed' (properties changed: -x to +x)
76--- hooks/database-relation-changed 2015-07-29 03:31:14 +0000
77+++ hooks/database-relation-changed 2015-08-17 18:54:42 +0000
78@@ -33,20 +33,10 @@
79
80 database_file=${CHARM_DIR}/files/suite.sql
81 if [ -s ${database_file} ]; then
82- # Grab the number of this unit.
83- number=${JUJU_UNIT_NAME##*/}
84- # Sleep for unit number seconds to avoid two units entering at same time.
85- sleep ${number}
86 table_name="juju"
87
88- # Build a query to check if the table exists inside the database.
89- table_query="select count(*) from information_schema.tables where table_schema='${db_name}' and table_name='${table_name}';"
90- # Use the -N to skip column names, and -s to print results tab separated.
91- table_count=`mysql -N -s --user=${db_user} --password=${db_pass} -h ${db_host} ${db_name} -e "${table_query}"`
92- if [ ${table_count} == 0 ]; then
93- create_table="create table ${table_name} (dbloaded int DEFAULT 1) engine InnoDB;"
94-
95- mysql --user=${db_user} --password=${db_pass} -h ${db_host} ${db_name} -e "${create_table}"
96+ create_table="create table ${table_name} (dbloaded int DEFAULT 1) engine InnoDB;"
97+ if mysql --user=${db_user} --password=${db_pass} -h ${db_host} ${db_name} -e "${create_table}"; then
98 juju-log "The table ${table_name} did not exist, load the mysql data."
99 # Ask MySQL to load the database file.
100
101
102=== modified file 'hooks/install' (properties changed: -x to +x)
103=== modified file 'hooks/start' (properties changed: -x to +x)
104=== modified file 'hooks/stop' (properties changed: -x to +x)
105=== modified file 'hooks/upgrade-charm' (properties changed: -x to +x)
106=== modified file 'hooks/website-relation-joined' (properties changed: -x to +x)
107=== removed file 'revision'
108--- revision 2015-07-29 03:18:18 +0000
109+++ revision 1970-01-01 00:00:00 +0000
110@@ -1,1 +0,0 @@
111-0
112\ No newline at end of file
113
114=== added directory 'tests'
115=== added file 'tests/00-setup'
116--- tests/00-setup 1970-01-01 00:00:00 +0000
117+++ tests/00-setup 2015-08-17 18:54:42 +0000
118@@ -0,0 +1,5 @@
119+#!/bin/bash
120+
121+sudo add-apt-repository ppa:juju/stable -y
122+sudo apt-get update
123+sudo apt-get install amulet python3-requests -y
124
125=== added file 'tests/100-deploy-suitecrm'
126--- tests/100-deploy-suitecrm 1970-01-01 00:00:00 +0000
127+++ tests/100-deploy-suitecrm 2015-08-17 18:54:42 +0000
128@@ -0,0 +1,42 @@
129+#!/usr/bin/env python3
130+
131+import amulet
132+import requests
133+import unittest
134+
135+
136+class TestDeployment(unittest.TestCase):
137+ @classmethod
138+ def setUpClass(cls):
139+ cls.deployment = amulet.Deployment(series='trusty')
140+
141+ cls.deployment.add('suitecrm', charm='cs:~joe/trusty/suitecrm')
142+ cls.deployment.add('mysql', charm='cs:trusty/mysql')
143+ cls.deployment.relate('suitecrm:database', 'mysql:db')
144+
145+ # we know memcached fails on lxc (local provider), so we don't
146+ # include that. If you want to test with memcached deployed in your
147+ # environment, uncomment the following:
148+ # cls.deployment.add('memcached')
149+ # cls.deployment.relate('suitecrm:cache', 'memcached:cache')
150+
151+ cls.deployment.expose('suitecrm')
152+
153+ try:
154+ cls.deployment.setup(timeout=900)
155+ cls.deployment.sentry.wait()
156+ except amulet.helpers.TimeoutError:
157+ amulet.raise_status(amulet.SKIP, msg="Environment wasn't stood up in time")
158+ except:
159+ raise
160+
161+ def test_deployment(self):
162+ unit = self.deployment.sentry.unit['suitecrm/0']
163+
164+ # check our suitecrm url
165+ page = requests.get('http://%s' % unit.info['public-address'])
166+ page.raise_for_status() # Make sure it's not 5XX error
167+
168+
169+if __name__ == '__main__':
170+ unittest.main()
171
172=== added file 'tests/tests.yaml'
173--- tests/tests.yaml 1970-01-01 00:00:00 +0000
174+++ tests/tests.yaml 2015-08-17 18:54:42 +0000
175@@ -0,0 +1,10 @@
176+# Driver for bundletester: https://github.com/juju-solutions/bundletester
177+#
178+# It may be useful to alter the defaults during manual testing. For example,
179+# set 'reset: false' to reuse existing charms instead of redeploying them.
180+
181+# Allow bootstrap of current env, default: true
182+bootstrap: true
183+
184+# Use juju-deployer to reset env between test, default: true
185+reset: false

Subscribers

People subscribed via source and target branches

to all changes: