Merge lp:~hatch/charms/precise/ghost/trunk into lp:charms/ghost
- Precise Pangolin (12.04)
- trunk
- Merge into trunk
Proposed by
Jeff Pihach
Status: | Merged | ||||
---|---|---|---|---|---|
Merged at revision: | 6 | ||||
Proposed branch: | lp:~hatch/charms/precise/ghost/trunk | ||||
Merge into: | lp:charms/ghost | ||||
Diff against target: |
456 lines (+238/-58) 8 files modified
README.md (+142/-53) assets/config.js.template (+13/-0) assets/ghost.conf (+1/-1) config.yaml (+37/-0) hooks/config-changed (+42/-1) hooks/install (+1/-1) revision (+1/-1) utils/utils.js (+1/-1) |
||||
To merge this branch: | bzr merge lp:~hatch/charms/precise/ghost/trunk | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
José Antonio Rey (community) | Approve | ||
Review Queue (community) | automated testing | Needs Fixing | |
Review via email: mp+243044@code.launchpad.net |
Commit message
Description of the change
Committing revno dce85f67e3 from https:/
To post a comment you must log in.
Revision history for this message
Review Queue (review-queue) wrote : | # |
review:
Needs Fixing
(automated testing)
Revision history for this message
José Antonio Rey (jose) wrote : | # |
Hey Jeff!
I just ran the tests on this MP, and it looks good to me. +1!
Thanks for improving the charm!
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 2014-06-22 22:53:50 +0000 | |||
3 | +++ README.md 2014-11-27 14:38:00 +0000 | |||
4 | @@ -7,23 +7,28 @@ | |||
5 | 7 | 7 | ||
6 | 8 | This Ghost charm allows you to trivially deploy a horizontally scalable, load | 8 | This Ghost charm allows you to trivially deploy a horizontally scalable, load |
7 | 9 | balanced, instance of the Ghost blogging platform locally or on a cloud | 9 | balanced, instance of the Ghost blogging platform locally or on a cloud |
9 | 10 | provider of choice. | 10 | provider of choice using Juju. |
10 | 11 | 11 | ||
12 | 12 | To deploy this charm you will need a cloud environment, a working juju | 12 | To deploy this charm you will need a cloud environment, a working Juju |
13 | 13 | installation and a successful bootstrap. If you don't have Juju installed and an | 13 | installation and a successful bootstrap. If you don't have Juju installed and an |
15 | 14 | environment set up see [Getting Started With Juju](https://juju.ubuntu.com/docs/getting-started.html). | 14 | environment set up see |
16 | 15 | [Getting Started With Juju](https://jujucharms.com/docs/getting-started). | ||
17 | 15 | 16 | ||
18 | 16 | - [Quick Start](#quick-start) | 17 | - [Quick Start](#quick-start) |
19 | 17 | - [Configuration](#configuration) | 18 | - [Configuration](#configuration) |
20 | 19 | - [Using A Load Balancer](#using-a-load-balancer) | ||
21 | 20 | - [Setting Up Email Service](#setting-up-email-service) | ||
22 | 18 | - [Connecting To Mysql](#connecting-to-mysql) | 21 | - [Connecting To Mysql](#connecting-to-mysql) |
23 | 19 | - [Horizontal Scaling](#horizontal-scaling) | 22 | - [Horizontal Scaling](#horizontal-scaling) |
26 | 20 | - [Load Balancing](#load-balancing) | 23 | - [Colocating On A Single Machine](#colocating-on-a-single-machine) |
27 | 21 | - [Wrap Up](#wrap-up) | 24 | - [Deploying And Using The GUI](#deploying-and-using-the-gui) |
28 | 22 | - [Contributing](#contributing) | 25 | - [Contributing](#contributing) |
29 | 23 | - [Bug Reports](#bug-reports) | 26 | - [Bug Reports](#bug-reports) |
30 | 24 | 27 | ||
31 | 25 | # Quick Start | 28 | # Quick Start |
32 | 26 | 29 | ||
33 | 30 | After you have a Juju cloud environment running: | ||
34 | 31 | |||
35 | 27 | $ juju deploy ghost | 32 | $ juju deploy ghost |
36 | 28 | $ juju expose ghost | 33 | $ juju expose ghost |
37 | 29 | 34 | ||
38 | @@ -32,25 +37,37 @@ | |||
39 | 32 | $ juju status ghost | 37 | $ juju status ghost |
40 | 33 | 38 | ||
41 | 34 | Visit `<your URL>:2368/ghost/signup/` to create your username and password. | 39 | Visit `<your URL>:2368/ghost/signup/` to create your username and password. |
43 | 35 | Continue setting up Ghost by following the [usage documentation](http://docs.ghost.org/usage/). | 40 | Continue setting up Ghost by following the |
44 | 41 | [usage documentation](http://docs.ghost.org/usage/). | ||
45 | 36 | 42 | ||
46 | 37 | You will want to change the URL that Ghost uses to generate links internally to | 43 | You will want to change the URL that Ghost uses to generate links internally to |
47 | 38 | the URL you will be using for your blog. | 44 | the URL you will be using for your blog. |
48 | 39 | 45 | ||
49 | 40 | $ juju set ghost url=<your url> | 46 | $ juju set ghost url=<your url> |
50 | 41 | 47 | ||
53 | 42 | If you will only be running a single instance of Ghost without any load | 48 | The ghost charm is designed to not run as a user which has access to reserved |
54 | 43 | balancing or reverse proxy then you will also want to set the listening port. | 49 | ports. This means that if you want to run your blog on port 80 or 443 you will |
55 | 50 | need to deploy and relate this charm to Apache. This has the added benefit of | ||
56 | 51 | being able to load balance between any additional Ghost units and do url | ||
57 | 52 | redirection if necessary. See | ||
58 | 53 | [Using A Load Balancer](#using-a-load-balancer) for more information. | ||
59 | 44 | 54 | ||
61 | 45 | $juju set ghost port=80 | 55 | In order to allow Ghost to send emails for things like new user validation and |
62 | 56 | password resets you will want to set up the email service. See | ||
63 | 57 | [Setting Up Email Service](#setting-up-email-service) for more information. | ||
64 | 46 | 58 | ||
65 | 47 | It's also recommended, although not required, that you use a MySQL database | 59 | It's also recommended, although not required, that you use a MySQL database |
68 | 48 | instead of the internal SQLite database. See [Connecting To MySQL](#connecting-to-mysql) | 60 | instead of the internal SQLite database. See |
69 | 49 | for more information. | 61 | [Connecting To MySQL](#connecting-to-mysql) for more information. |
70 | 62 | |||
71 | 63 | All of the instructions in this readme are provided using Juju's CLI interface. | ||
72 | 64 | Juju also has an amazing GUI which is highly recommended for beginners to Juju. | ||
73 | 65 | For information on how to deploy the GUI and use it with this charm see | ||
74 | 66 | [Deploying And Using The GUI](#deploying-and-using-the-gui) | ||
75 | 50 | 67 | ||
76 | 51 | # Configuration | 68 | # Configuration |
77 | 52 | 69 | ||
79 | 53 | To view the configuration options for this charm: | 70 | To view the configuration options for this charm open the `config.yaml` file or: |
80 | 54 | 71 | ||
81 | 55 | $ juju get ghost | 72 | $ juju get ghost |
82 | 56 | 73 | ||
83 | @@ -58,17 +75,72 @@ | |||
84 | 58 | 75 | ||
85 | 59 | $ juju set ghost <key>=<value> | 76 | $ juju set ghost <key>=<value> |
86 | 60 | 77 | ||
98 | 61 | To set the URL which ghost uses when generating links: | 78 | See the `config.yaml` file in the charm for a detailed list of all of the charms |
99 | 62 | 79 | configuration options. | |
100 | 63 | $ juju set ghost url=http://my-ghost-blog.com | 80 | |
101 | 64 | 81 | ||
102 | 65 | To set the host to be passed to node's net.Server listen(): | 82 | # Using A Load Balancer |
103 | 66 | 83 | ||
104 | 67 | $ juju set ghost host=0.0.0.0 | 84 | In order to run multiple instances of the Ghost web server and to be able to |
105 | 68 | 85 | serve your blog on a reserved port this charm supports being load balanced and | |
106 | 69 | To set the port to be passed to node's net.Server listen(): | 86 | reverse proxied by [haproxy](https://jujucharms.com/haproxy/trusty). |
107 | 70 | 87 | ||
108 | 71 | $ juju set ghost port=2368 | 88 | In order to reverse proxy and load balance this service you will need to deploy |
109 | 89 | haproxy: | ||
110 | 90 | |||
111 | 91 | $ juju deploy haproxy | ||
112 | 92 | $ juju expose haproxy | ||
113 | 93 | |||
114 | 94 | You will then need to unexpose the Ghost service: | ||
115 | 95 | |||
116 | 96 | $ juju unexpose ghost | ||
117 | 97 | |||
118 | 98 | You now need to let your haproxy instance know about Ghost so that it can | ||
119 | 99 | make the appropriate adjustments. | ||
120 | 100 | |||
121 | 101 | $ juju add-relation ghost haproxy | ||
122 | 102 | |||
123 | 103 | After a few moments of configuration your Ghost blog will now be reachable on | ||
124 | 104 | port 80 and you will be able to horizontally scale the server and have it | ||
125 | 105 | automatically load balanced. See [Horizontal Scaling](#horizontal-scaling) for | ||
126 | 106 | more information. | ||
127 | 107 | |||
128 | 108 | |||
129 | 109 | # Setting Up Email Service | ||
130 | 110 | |||
131 | 111 | Ghost needs the ability to send emails to users for things like new user | ||
132 | 112 | validation and password resets. To accomplish this Ghost supports using a | ||
133 | 113 | third party email service which it can communicate with to send these emails. | ||
134 | 114 | Ghost, and this charm, supports sending emails using Mailgun, Amazon SES, and | ||
135 | 115 | Gmail. Additional information about why Ghost needs this service and it's | ||
136 | 116 | supported platforms see [Mail configuration](http://support.ghost.org/mail/). | ||
137 | 117 | |||
138 | 118 | To specify a supported email service to use you simply need to set the | ||
139 | 119 | configuration values in the charm and they will be generated for your Ghost | ||
140 | 120 | instance. | ||
141 | 121 | |||
142 | 122 | #### Mailgun & Gmail | ||
143 | 123 | |||
144 | 124 | $ juju set ghost mailserver_username=<your username> | ||
145 | 125 | $ juju set ghost mailserver_password=<your password> | ||
146 | 126 | Then | ||
147 | 127 | $ juju set ghost mail_service=Mailgun | ||
148 | 128 | -or- | ||
149 | 129 | $ juju set ghost mail_service=Gmail | ||
150 | 130 | |||
151 | 131 | #### Amazon SES | ||
152 | 132 | |||
153 | 133 | $ juju set ghost mailserver_username=<your username> | ||
154 | 134 | $ juju set ghost mailserver_password=<your password> | ||
155 | 135 | $ juju set ghost amazon_ses_host=<your ses host> | ||
156 | 136 | Then | ||
157 | 137 | $ juju set ghost mail_service=SES | ||
158 | 138 | |||
159 | 139 | After this has been completed your Ghost server will restart and Ghost will | ||
160 | 140 | now be able to send emails using that provider. It's recommended to test this | ||
161 | 141 | before you need it by creating a new user and pointing it to an email you | ||
162 | 142 | control and ensure that you get the validation email. | ||
163 | 143 | |||
164 | 72 | 144 | ||
165 | 73 | # Connecting To MySQL | 145 | # Connecting To MySQL |
166 | 74 | 146 | ||
167 | @@ -84,14 +156,15 @@ | |||
168 | 84 | $ juju deploy mysql | 156 | $ juju deploy mysql |
169 | 85 | 157 | ||
170 | 86 | Additional details about the MySQL charm and configuration can be found in the | 158 | Additional details about the MySQL charm and configuration can be found in the |
172 | 87 | [MySQL charm details](http://manage.jujucharms.com/charms/precise/mysql) page. | 159 | [MySQL charm details](https://jujucharms.com/mysql/precise/) page. |
173 | 88 | 160 | ||
174 | 89 | You'll then need to relate the Ghost blog service to the MySQL service. | 161 | You'll then need to relate the Ghost blog service to the MySQL service. |
175 | 90 | 162 | ||
176 | 91 | $ juju add-relation ghost mysql | 163 | $ juju add-relation ghost mysql |
177 | 92 | 164 | ||
180 | 93 | The charm will handle all settings necessary to use the MySQL database instead | 165 | The charm will then handle setting up all configuration options necessary to use |
181 | 94 | of the internal SQLite database. | 166 | the MySQL database instead of the internal SQLite database. |
182 | 167 | |||
183 | 95 | 168 | ||
184 | 96 | # Horizontal Scaling | 169 | # Horizontal Scaling |
185 | 97 | 170 | ||
186 | @@ -101,36 +174,52 @@ | |||
187 | 101 | 174 | ||
188 | 102 | $ juju add-unit -n 1 ghost | 175 | $ juju add-unit -n 1 ghost |
189 | 103 | 176 | ||
215 | 104 | Now that you have more than one unit you will need to load balance between | 177 | Now that you have more than one unit you will need to ensure your posts are not |
216 | 105 | them. See [Load Balancing](#load-balancing) for more information. | 178 | stored locally on a single unit and you will need to be able to load balance |
217 | 106 | 179 | between the multiple instances. See | |
218 | 107 | # Load Balancing | 180 | [Using A Load Balancer](#using-a-load-balancer) and |
219 | 108 | 181 | [Connecting To MySQL](#connecting-to-mysql) for more information. | |
220 | 109 | This charm supports being load balanced and reverse proxied by [haproxy](http://manage.jujucharms.com/charms/precise/haproxy) | 182 | |
221 | 110 | or [apache2](http://manage.jujucharms.com/charms/precise/apache2). | 183 | |
222 | 111 | 184 | # Colocating On A Single Machine | |
223 | 112 | In order to load balance this service you will need to deploy one of the | 185 | |
224 | 113 | aforementioned charms: | 186 | By default, every time you deploy a service or create a new unit Juju will |
225 | 114 | 187 | create a new instance on your cloud provider. This may be undesired due to | |
226 | 115 | $ juju deploy haproxy | 188 | hardware availability or budgeting. Juju also provides you an easy to use method |
227 | 116 | 189 | to deploy all of these services to a smaller number of machines using the | |
228 | 117 | You will then need to unexpose the Ghost service: | 190 | following syntax: |
229 | 118 | 191 | ||
230 | 119 | $ juju unexpose ghost | 192 | $ juju deploy --to=<machine number> <service name> |
231 | 120 | 193 | ||
232 | 121 | And change the port at which it listens from 80: | 194 | ex) |
233 | 122 | 195 | ||
234 | 123 | $ juju set ghost port=2368 | 196 | $ juju deploy --to=1 ghost |
235 | 124 | 197 | ||
236 | 125 | You now need to let your haproxy instance know about Ghost so that it can | 198 | Colocating can have unintended consequences if the multiple service were not |
237 | 126 | make the appropriate adjustments. | 199 | designed to be deployed to the same machine. To get around this you're able to |
238 | 127 | 200 | create LXC and KVM containers to deploy to. This gets into advanced Juju usage | |
239 | 128 | $ juju add-relation ghost haproxy | 201 | and more information can be found in the Juju documentation on |
240 | 202 | [Deploying Charms](https://jujucharms.com/docs/charms-deploying#deploying-to-specific-machines-and-containers) | ||
241 | 203 | |||
242 | 204 | # Deploying And Using The GUI | ||
243 | 205 | |||
244 | 206 | Juju has a powerful graphical user interface which you can use to interact with | ||
245 | 207 | your environment without having to use the CLI. In order to use the GUI in | ||
246 | 208 | your environment you will need to deploy it: | ||
247 | 209 | |||
248 | 210 | $ juju deploy juju-gui | ||
249 | 211 | |||
250 | 212 | Every command in this readme can be done using the GUI instead of the CLI. See | ||
251 | 213 | [Juju GUI](https://jujucharms.com/juju-gui/trusty) for detailed information on | ||
252 | 214 | the Juju GUI charm and how to use the GUI. | ||
253 | 215 | |||
254 | 129 | 216 | ||
255 | 130 | # Contributing | 217 | # Contributing |
256 | 131 | 218 | ||
257 | 132 | This charm wouldn't be where it is today without great contributions from | 219 | This charm wouldn't be where it is today without great contributions from |
259 | 133 | others. Pull requests are accepted in the [ghost-charm repository](https://github.com/hatched/ghost-charm) | 220 | others. Pull requests are accepted in the |
260 | 221 | [ghost-charm repository](https://github.com/hatched/ghost-charm) | ||
261 | 222 | |||
262 | 134 | 223 | ||
263 | 135 | # Bug Reports | 224 | # Bug Reports |
264 | 136 | 225 | ||
265 | @@ -141,6 +230,6 @@ | |||
266 | 141 | If you have found a bug with the ghost-charm itself they can be filed in the | 230 | If you have found a bug with the ghost-charm itself they can be filed in the |
267 | 142 | [ghost-charm repository](https://github.com/hatched/ghost-charm). Please include | 231 | [ghost-charm repository](https://github.com/hatched/ghost-charm). Please include |
268 | 143 | exact steps to reproduce the issue and be as detailed as possible, including | 232 | exact steps to reproduce the issue and be as detailed as possible, including |
270 | 144 | what version of Ubuntu you're running, the version of this charm you have | 233 | what version of Ubuntu you're running on, the version of this charm you have |
271 | 145 | deployed, the cloud your environment is running on, any other charms deployed to | 234 | deployed, the cloud your environment is running on, any other charms deployed to |
272 | 146 | the environment. | 235 | the environment. |
273 | 147 | 236 | ||
274 | === removed file 'assets/Ghost-0.4.2.zip' | |||
275 | 148 | Binary files assets/Ghost-0.4.2.zip 2014-06-22 22:53:50 +0000 and assets/Ghost-0.4.2.zip 1970-01-01 00:00:00 +0000 differ | 237 | Binary files assets/Ghost-0.4.2.zip 2014-06-22 22:53:50 +0000 and assets/Ghost-0.4.2.zip 1970-01-01 00:00:00 +0000 differ |
276 | === added file 'assets/Ghost-0.5.5.zip' | |||
277 | 149 | Binary files assets/Ghost-0.5.5.zip 1970-01-01 00:00:00 +0000 and assets/Ghost-0.5.5.zip 2014-11-27 14:38:00 +0000 differ | 238 | Binary files assets/Ghost-0.5.5.zip 1970-01-01 00:00:00 +0000 and assets/Ghost-0.5.5.zip 2014-11-27 14:38:00 +0000 differ |
278 | === modified file 'assets/config.js.template' | |||
279 | --- assets/config.js.template 2014-06-22 22:53:50 +0000 | |||
280 | +++ assets/config.js.template 2014-11-27 14:38:00 +0000 | |||
281 | @@ -7,6 +7,19 @@ | |||
282 | 7 | server: { | 7 | server: { |
283 | 8 | host: '{{host}}', | 8 | host: '{{host}}', |
284 | 9 | port: '{{port}}' | 9 | port: '{{port}}' |
285 | 10 | }, | ||
286 | 11 | mail: { | ||
287 | 12 | {{from_address}} | ||
288 | 13 | {{amazon_ses_host}} | ||
289 | 14 | transport: 'SMTP', | ||
290 | 15 | options: { | ||
291 | 16 | service: '{{mail_service}}', | ||
292 | 17 | {{amazon_ses_port}} | ||
293 | 18 | auth: { | ||
294 | 19 | user: '{{mailserver_username}}', | ||
295 | 20 | pass: '{{mailserver_password}}' | ||
296 | 21 | } | ||
297 | 22 | } | ||
298 | 10 | } | 23 | } |
299 | 11 | } | 24 | } |
300 | 12 | }; | 25 | }; |
301 | 13 | 26 | ||
302 | === modified file 'assets/ghost.conf' | |||
303 | --- assets/ghost.conf 2014-06-22 22:53:50 +0000 | |||
304 | +++ assets/ghost.conf 2014-11-27 14:38:00 +0000 | |||
305 | @@ -1,6 +1,6 @@ | |||
306 | 1 | #/etc/init/ghost.conf | 1 | #/etc/init/ghost.conf |
307 | 2 | description "Ghost Blog" | 2 | description "Ghost Blog" |
309 | 3 | author "Jeff Pihach <jeff.pihach@canonical.com>" | 3 | author "Jeff Pihach <jpihach@gmail.com>" |
310 | 4 | 4 | ||
311 | 5 | setuid ubuntu | 5 | setuid ubuntu |
312 | 6 | 6 | ||
313 | 7 | 7 | ||
314 | === modified file 'config.yaml' | |||
315 | --- config.yaml 2014-05-22 05:51:19 +0000 | |||
316 | +++ config.yaml 2014-11-27 14:38:00 +0000 | |||
317 | @@ -11,3 +11,40 @@ | |||
318 | 11 | description: Port to be passed to node's net.Server listen(). | 11 | description: Port to be passed to node's net.Server listen(). |
319 | 12 | type: int | 12 | type: int |
320 | 13 | default: 2368 | 13 | default: 2368 |
321 | 14 | mail_service: | ||
322 | 15 | description: | | ||
323 | 16 | Pick one of the supported email services to allow Ghost to send emails | ||
324 | 17 | for things like password recovery and new user acceptance. Valid options | ||
325 | 18 | will require the corresponding username and password fields filled out | ||
326 | 19 | below. The supported values are 'Mailgun', 'SES', and 'Gmail'. | ||
327 | 20 | An empty value will remove the configuration from Ghost. | ||
328 | 21 | type: string | ||
329 | 22 | default: '' | ||
330 | 23 | mailserver_username: | ||
331 | 24 | description: | | ||
332 | 25 | Username for the mail service chosen above. Information on where to find | ||
333 | 26 | these credentials can be found here: http://support.ghost.org/mail/ . | ||
334 | 27 | type: string | ||
335 | 28 | default: '' | ||
336 | 29 | mailserver_password: | ||
337 | 30 | description: | | ||
338 | 31 | Password for the mail service chosen above. Information on where to find | ||
339 | 32 | these credentials can be found here: http://support.ghost.org/mail/ . | ||
340 | 33 | type: string | ||
341 | 34 | default: '' | ||
342 | 35 | amazon_ses_host: | ||
343 | 36 | description: | | ||
344 | 37 | The host value for your Amazon SES account. This is only necessary if | ||
345 | 38 | you chose this option in the mail_service field above. | ||
346 | 39 | type: string | ||
347 | 40 | default: '' | ||
348 | 41 | from_address: | ||
349 | 42 | description: | | ||
350 | 43 | By default the ‘from’ address for mail sent from Ghost will be set to | ||
351 | 44 | "Blog Title <ghost@your-ghost-blog.com>" where 'Blog Title' is the title | ||
352 | 45 | you have set in settings, and 'your-ghost-blog.com' is the value from | ||
353 | 46 | the host configuration value above. You can override this value here. | ||
354 | 47 | Supported formats are 'myemail@example.com' or | ||
355 | 48 | 'Custom Name <myemail@example.com'. | ||
356 | 49 | type: string | ||
357 | 50 | default: '' | ||
358 | 14 | 51 | ||
359 | === modified file 'hooks/config-changed' | |||
360 | --- hooks/config-changed 2014-06-22 22:53:50 +0000 | |||
361 | +++ hooks/config-changed 2014-11-27 14:38:00 +0000 | |||
362 | @@ -16,7 +16,7 @@ | |||
363 | 16 | function updateConfig(error, config) { | 16 | function updateConfig(error, config) { |
364 | 17 | try { | 17 | try { |
365 | 18 | exec('juju-log "Closing old port..."'); | 18 | exec('juju-log "Closing old port..."'); |
367 | 19 | oldConfig = require('/var/www/ghost/config.js'); | 19 | var oldConfig = require('/var/www/ghost/config.js'); |
368 | 20 | exec('close-port ' + oldConfig.production.server.port + '/TCP', | 20 | exec('close-port ' + oldConfig.production.server.port + '/TCP', |
369 | 21 | function() { | 21 | function() { |
370 | 22 | exec('juju-log "Old port closed."'); | 22 | exec('juju-log "Old port closed."'); |
371 | @@ -26,6 +26,7 @@ | |||
372 | 26 | exec('juju-log "config.js does not exist yet; port not closed"'); | 26 | exec('juju-log "config.js does not exist yet; port not closed"'); |
373 | 27 | } | 27 | } |
374 | 28 | config = JSON.parse(config); | 28 | config = JSON.parse(config); |
375 | 29 | config = buildEmailConfig(config); | ||
376 | 29 | utils.renderTemplate( | 30 | utils.renderTemplate( |
377 | 30 | config, 'config.js.template', '/var/www/ghost/config.js'); | 31 | config, 'config.js.template', '/var/www/ghost/config.js'); |
378 | 31 | exec('chown -R ubuntu:ubuntu /var/www/ghost'); | 32 | exec('chown -R ubuntu:ubuntu /var/www/ghost'); |
379 | @@ -38,4 +39,44 @@ | |||
380 | 38 | dbutils.configureSqlite(); | 39 | dbutils.configureSqlite(); |
381 | 39 | } | 40 | } |
382 | 40 | 41 | ||
383 | 42 | /* | ||
384 | 43 | Generates the appropriate configuration object for the email provider. | ||
385 | 44 | |||
386 | 45 | @method buildEmailConfig | ||
387 | 46 | @param {Object} config The configuration field values. | ||
388 | 47 | @return {Object} A modified configuration object containing the correct email | ||
389 | 48 | configuration options. | ||
390 | 49 | */ | ||
391 | 50 | function buildEmailConfig(config) { | ||
392 | 51 | // Setting this here to nothing because it'll be set as the real value later | ||
393 | 52 | // on if needed. | ||
394 | 53 | config.amazon_ses_port = ''; | ||
395 | 54 | // If we don't have a valid service name or it's an empty value then return | ||
396 | 55 | // with the currently modified values. | ||
397 | 56 | var valid_services = ['Mailgun', 'SES', 'Gmail']; | ||
398 | 57 | if (config.mail_service === '' || | ||
399 | 58 | valid_services.indexOf(config.mail_service) < 0) { | ||
400 | 59 | // If the mail_service field is empty or unset then we want to disable | ||
401 | 60 | // the email server by leaving the provider field in the config blank. | ||
402 | 61 | exec( | ||
403 | 62 | 'juju-log "The provided value `' + config.mail_service + '`' + | ||
404 | 63 | ' is not a valid configuration option for the `mail_service`.' + | ||
405 | 64 | ' See the configuration details for more information. Skipping' + | ||
406 | 65 | ' email provider'); | ||
407 | 66 | config.mail_service = ''; | ||
408 | 67 | return config; | ||
409 | 68 | } | ||
410 | 69 | // The remaining options require the entire key/value pair to be written | ||
411 | 70 | // into the template. | ||
412 | 71 | if (config.from_address !== '') { | ||
413 | 72 | config.from_address = 'from: ' + config.from_address + ','; | ||
414 | 73 | } | ||
415 | 74 | if (config.mail_service === 'SES') { | ||
416 | 75 | config.amazon_ses_host = 'host: ' + config.amazon_ses_host + ','; | ||
417 | 76 | config.amazon_ses_port = 'port: 465,'; | ||
418 | 77 | } | ||
419 | 78 | |||
420 | 79 | return config; | ||
421 | 80 | } | ||
422 | 81 | |||
423 | 41 | exec('config-get --all --format=json', updateConfig); | 82 | exec('config-get --all --format=json', updateConfig); |
424 | 42 | 83 | ||
425 | === modified file 'hooks/install' | |||
426 | --- hooks/install 2014-06-22 22:53:50 +0000 | |||
427 | +++ hooks/install 2014-11-27 14:38:00 +0000 | |||
428 | @@ -17,7 +17,7 @@ | |||
429 | 17 | chmod 644 /etc/init/ghost.conf | 17 | chmod 644 /etc/init/ghost.conf |
430 | 18 | # Unzip and move to it's proper location | 18 | # Unzip and move to it's proper location |
431 | 19 | mkdir -p /var/www/ghost | 19 | mkdir -p /var/www/ghost |
433 | 20 | unzip -uo assets/Ghost-0.4.2.zip -d /var/www/ghost | 20 | unzip -uo assets/Ghost-0.5.5.zip -d /var/www/ghost |
434 | 21 | 21 | ||
435 | 22 | cd /var/www/ghost | 22 | cd /var/www/ghost |
436 | 23 | npm install --production | 23 | npm install --production |
437 | 24 | 24 | ||
438 | === modified file 'revision' | |||
439 | --- revision 2014-06-22 22:53:50 +0000 | |||
440 | +++ revision 2014-11-27 14:38:00 +0000 | |||
441 | @@ -1,1 +1,1 @@ | |||
443 | 1 | 5 | 1 | 7 |
444 | 2 | 2 | ||
445 | === modified file 'utils/utils.js' | |||
446 | --- utils/utils.js 2013-11-26 03:43:17 +0000 | |||
447 | +++ utils/utils.js 2014-11-27 14:38:00 +0000 | |||
448 | @@ -7,7 +7,7 @@ | |||
449 | 7 | @method renderTemplateData | 7 | @method renderTemplateData |
450 | 8 | @param {Object} data Config data | 8 | @param {Object} data Config data |
451 | 9 | @param {String} template The template filename | 9 | @param {String} template The template filename |
453 | 10 | @param {String} filepath Path to render the template out to | 10 | @param {String} filepath Path to render the template out to |
454 | 11 | */ | 11 | */ |
455 | 12 | function renderTemplate(data, template, filepath) { | 12 | function renderTemplate(data, template, filepath) { |
456 | 13 | var fileData = fs.readFileSync(path.join('assets', template), 'utf8'); | 13 | var fileData = fs.readFileSync(path.join('assets', template), 'utf8'); |
This items has failed automated testing! Results available here http:// reports. vapour. ws/charm- tests/charm- bundle- test-10463- results