Charm review for Openbook

Bug #1411402 reported by Michael Garza
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Juju Charms Collection
Fix Released
Undecided
Michael Garza

Bug Description

Review charm for recommendation by charmers group.

Related branches

Revision history for this message
Review Queue (review-queue) wrote : Automated Test Results: Charm review for Openbook

This items has failed automated testing! Results available here http://reports.vapour.ws/charm-tests/charm-bundle-test-10947-results

Revision history for this message
Michael Garza (miqe) wrote :

The automated Azure test was unable to ssh to the juju box and is not an issue with the charm.

Revision history for this message
Jorge Castro (jorge) wrote :

We had some guys looking at reviewing this and did an initial first pass, sorry for the lack of response, I've asked them to post asap.

Revision history for this message
Kevin W Monroe (kwmonroe) wrote :

Hi Michael - first up, thanks for the submission! I look forward to seeing Openbook in the Charm Store!

You're right that the Azure failure doesn't seem indicative of a charm problem -- probably just a network hiccup. That said, I don't see any tests included in your charm. For Trusty and beyond, tests are required per the Charm Store Policy [1]. Everything else LGTM, but we'll need to add some tests to get this to "recommended" status in the store (which is where we want you to be).

So you've got a couple options. I created a basic test and linked it as a related branch to this bug if you'd like to take a look:

http://bazaar.launchpad.net/~kwmonroe/charms/trusty/openbook/1411402/revision/8

It deploys openbook/mariadb/tomcat, relates stuff, and verifies the openbook url is accessible. If this looks ok to you, feel free to merge it into your branch and tweak as you see fit.

Of course you're welcome to expand this and/or create your own tests (you know better than I what a successful Openbook install looks like). If you decide to create tests from scratch, I suggest taking a look at charm-tools [2] if you haven't already. You can run "charm add tests" in your charm dir and get a helpful chunk of boilerplate created for you in a ./tests subdir. This auto-generated stuff uses the amulet harness [3] and is what I used in my branch.

The easiest way to test your tests is to use bundletester [4]. That's what we use during our automated testing and it's pretty easy. WARNING: it will clobber your current Juju environment and redeploy units according to your tests, so only do this in an environment that you don't need to preserve. Once you pip install it, here's how you'd run it from your charm dir (the -v and -l DEBUG just give you more output):

$ bundletester -v -l DEBUG # did you read my WARNING above? read my WARNING above if you're gonna use this.

Regardless of how you choose to do your tests, thanks again for the submission. It's a really well-documented charm and I think would make a great addition to the Charm Store. Let us know if you have any questions/concerns, and whenever you drop tests in, we'll be happy to do a re-review.

Thanks!

Refs:
[1] https://juju.ubuntu.com/docs/authors-charm-policy.html
[2] https://juju.ubuntu.com/docs/tools-charm-tools.html
[3] https://juju.ubuntu.com/docs/tools-amulet.html
[4] https://github.com/juju-solutions/bundletester

Revision history for this message
Michael Garza (miqe) wrote : Re: [Bug 1411402] Charm review for Openbook
Download full text (3.2 KiB)

Hello Kevin,

Sorry for the long delay. I appreciate you taking the time to write up the sample test. I went ahead and merged the changes into our branch. When time permits we will look into adding more thorough tests.

Thanks again.

> On Jan 23, 2015, at 12:40 AM, Kevin W Monroe <email address hidden> wrote:
>
> Hi Michael - first up, thanks for the submission! I look forward to
> seeing Openbook in the Charm Store!
>
> You're right that the Azure failure doesn't seem indicative of a charm
> problem -- probably just a network hiccup. That said, I don't see any
> tests included in your charm. For Trusty and beyond, tests are required
> per the Charm Store Policy [1]. Everything else LGTM, but we'll need to
> add some tests to get this to "recommended" status in the store (which
> is where we want you to be).
>
> So you've got a couple options. I created a basic test and linked it as
> a related branch to this bug if you'd like to take a look:
>
> http://bazaar.launchpad.net/~kwmonroe/charms/trusty/openbook/1411402/revision/8
>
> It deploys openbook/mariadb/tomcat, relates stuff, and verifies the
> openbook url is accessible. If this looks ok to you, feel free to merge
> it into your branch and tweak as you see fit.
>
> Of course you're welcome to expand this and/or create your own tests
> (you know better than I what a successful Openbook install looks like).
> If you decide to create tests from scratch, I suggest taking a look at
> charm-tools [2] if you haven't already. You can run "charm add tests"
> in your charm dir and get a helpful chunk of boilerplate created for you
> in a ./tests subdir. This auto-generated stuff uses the amulet harness
> [3] and is what I used in my branch.
>
> The easiest way to test your tests is to use bundletester [4]. That's
> what we use during our automated testing and it's pretty easy. WARNING:
> it will clobber your current Juju environment and redeploy units
> according to your tests, so only do this in an environment that you
> don't need to preserve. Once you pip install it, here's how you'd run
> it from your charm dir (the -v and -l DEBUG just give you more output):
>
> $ bundletester -v -l DEBUG # did you read my WARNING above? read my
> WARNING above if you're gonna use this.
>
> Regardless of how you choose to do your tests, thanks again for the
> submission. It's a really well-documented charm and I think would make
> a great addition to the Charm Store. Let us know if you have any
> questions/concerns, and whenever you drop tests in, we'll be happy to do
> a re-review.
>
> Thanks!
>
> Refs:
> [1] https://juju.ubuntu.com/docs/authors-charm-policy.html
> [2] https://juju.ubuntu.com/docs/tools-charm-tools.html
> [3] https://juju.ubuntu.com/docs/tools-amulet.html
> [4] https://github.com/juju-solutions/bundletester
>
> ** Branch linked: lp:~kwmonroe/charms/trusty/openbook/1411402
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1411402
>
> Title:
> Charm review for Openbook
>
> Status in Juju Charms:
> New
>
> Bug description:
> Review charm for recommendation by charmers group.
>
...

Read more...

Revision history for this message
Matt Bruzek (mbruzek) wrote :
Download full text (8.8 KiB)

# Charm Review Talligent

Thank you for the submission of the Openbook charm! I am excited to see another Java web application using the tomcat charm.

I took a look at the charm and there were a few things that need to be fixed before the openbook charm is ready for the recommended section of the charm store.

## charm proof

When I ran charm-proof it raised an informational message.

I: Categories are being deprecated in favor of tags. Please rename the "categories" field to "tags".

According to this page: https://juju.ubuntu.com/docs/authors-charm-metadata.html

I would recommend editing metadata.yaml and changing “categories” to “tags” with the value of monitoring. This tags field can also be multiple values if you feel others fit as well.

## README.md

The readme markdown renders to HTML well! There is a minor spacing issue with the juju commands. With a blank line between paragraphs, only four spaces is needed to make the juju commands a formatted block.

Being new to Talligent I didn't know much about Openbook, and used the readme as my guide. The readme is the opportunity to describe to a new user the product and how to use it. The readme included instructions on how to deploy Openbook, but I could not find any information on where to go to use the Openbook product. Since this is a web application that kind of information should be included in the readme. Here is an example:

“After the openbook charm is deployed and related you can go to the Openbook web page at: http://IP_ADDRESS:PORT/Openbook/ Where IP_ADDRESS is the public address, and PORT is the configured port number of the tomcat container and can be found by typing `juju status tomcat`.

I was not clear to me what the Administrator or Customer login ids were to log into the web site, so I stopped here. Some more information in the readme would be very helpful to customers using Openbook.

## config.yaml

You have 2 configuration options in here that look good.

## copyright

The copyright file in the charm is for the charm code only, and is not for the Talligent Openbook code. The charm store policy is to have an open source license for the charm code. https://juju.ubuntu.com/docs/authors-charm-policy.html

Please select an open source license and use that in the charm.

## hooks/install

This code looks great! It is well written and easy to read, making use of our best practices.

## hooks/config-changed

I spotted a problem in this hook related to the way you are handling the openbook.properties file. The config-changed hook is called anytime a configuration option changes (for example after a deploy). The properties file is extracted each time, edited and put back in the charm at /usr/share/tomcat7/.Openbook/ directory but those changes are never saved to the /var/lib/tomcat7/webapps/ directory! And the war file is never expanded again. The WAR file in two places /usr/share/tomcat7/Openbook/ and /var/lib/tomcat7/webapps/ directory (don't forget the WAR is expanded in /var/lib/tomcat7/webapps/ too).

So when I changed the license-key value (juju set openbook license-key=”notvalid”) after a deploy, it never got updated on the system. This should...

Read more...

Changed in charms:
status: New → In Progress
assignee: nobody → Michael Garza (miqe)
Revision history for this message
Michael Garza (miqe) wrote :

## charm proof

I ran charm-proof as well but the latest version on Mac OS X is 1.3.3 (homebrew) which complains of the opposite. I changed it and ran the tool on an Ubuntu box with no errors.

## README.md

Changed to 4 spaces.

I added the small paragraph that you wrote and also referred the user to the getting started guide. This will help them setup the software after the application is running.

## copyright

Changed to a open source license.

## hooks/config-changed

This hook will now clean up the directories also and only deploy the war if it had already been previously deployed.

## hooks/db-admin-relation-changed

Same thing here, before starting Tomcat clean up and redeploy war.

## tests

Although the test is simple, it is a good test because the application will not start if the properties are incorrectly set.

Changed in charms:
status: In Progress → Fix Committed
Revision history for this message
Matt Bruzek (mbruzek) wrote :

Hi Mike,

Thank you for the fast turn around on this code. I tried the latest branch and I got an error in the config-changed hook when I tried to change the application-context-root after a deployment.

Here is the tail of the /var/log/juju/unit-openbook-0.log file:

2015-02-05 22:56:31 INFO unit.openbook/0.config-changed logger.go:40 + DEPLOY=false
2015-02-05 22:56:31 INFO unit.openbook/0.config-changed logger.go:40 + [[ -f /var/lib/tomcat7/webapps/Openbook.war ]]
2015-02-05 22:56:31 INFO unit.openbook/0.config-changed logger.go:40 + rm /var/lib/tomcat7/webapps/Openbook.war
2015-02-05 22:56:31 INFO unit.openbook/0.config-changed logger.go:40 + false=true
2015-02-05 22:56:31 INFO unit.openbook/0.config-changed logger.go:40 /var/lib/juju/agents/unit-openbook-0/charm/hooks/config-changed: line 33: false=true: command not found
2015-02-05 22:56:31 INFO juju.worker.uniter.context context.go:304 handling reboot
2015-02-05 22:56:31 ERROR juju.worker.uniter uniter.go:608 hook "config-changed" failed: exit status 127

Looking at the config-changed code, it looks like you are using a '$' in front of the DEPLOY variable when you are trying to set it false, remove that and the set would be successful.

Changed in charms:
status: Fix Committed → In Progress
Revision history for this message
Michael Garza (miqe) wrote :

Hello Matt,

Im sorry for the silly mistake. Ive updated the code.

Thanks.

> On Feb 5, 2015, at 5:08 PM, Matt Bruzek <email address hidden> wrote:
>
> Hi Mike,
>
> Thank you for the fast turn around on this code. I tried the latest
> branch and I got an error in the config-changed hook when I tried to
> change the application-context-root after a deployment.
>
> Here is the tail of the /var/log/juju/unit-openbook-0.log file:
>
> 2015-02-05 22:56:31 INFO unit.openbook/0.config-changed logger.go:40 + DEPLOY=false
> 2015-02-05 22:56:31 INFO unit.openbook/0.config-changed logger.go:40 + [[ -f /var/lib/tomcat7/webapps/Openbook.war ]]
> 2015-02-05 22:56:31 INFO unit.openbook/0.config-changed logger.go:40 + rm /var/lib/tomcat7/webapps/Openbook.war
> 2015-02-05 22:56:31 INFO unit.openbook/0.config-changed logger.go:40 + false=true
> 2015-02-05 22:56:31 INFO unit.openbook/0.config-changed logger.go:40 /var/lib/juju/agents/unit-openbook-0/charm/hooks/config-changed: line 33: false=true: command not found
> 2015-02-05 22:56:31 INFO juju.worker.uniter.context context.go:304 handling reboot
> 2015-02-05 22:56:31 ERROR juju.worker.uniter uniter.go:608 hook "config-changed" failed: exit status 127
>
> Looking at the config-changed code, it looks like you are using a '$' in
> front of the DEPLOY variable when you are trying to set it false, remove
> that and the set would be successful.
>
>
> ** Changed in: charms
> Status: Fix Committed => In Progress
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1411402
>
> Title:
> Charm review for Openbook
>
> Status in Juju Charms:
> In Progress
>
> Bug description:
> Review charm for recommendation by charmers group.
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/charms/+bug/1411402/+subscriptions

Changed in charms:
status: In Progress → Fix Committed
Revision history for this message
Matt Bruzek (mbruzek) wrote :

#Review

Michael,

Thank you for the quick turn around. The new code fixes the config-changed problem with the last review.

I deployed this charm today and tried changing both of the configuration options. The `license-key` option seems to be working. However changing the `application-context-root` option does not seem to change where the webapp is actually hosted. I ran the following command:

    juju set openbook application-context-root=Openbook2

I then tried to go to http://IP:PORT/Openbook2 and found nothing there. The webapp was still found at the original url: http://IP:PORT/Openbook

Looking at the code, the config-changed hook changes the `APPLICATION_CONTEXT_ROOT` variable in the openbook.properties file, but never relocates the war file or the directory to the new directory (in this example the webapp should have been in /var/lib/tomcat7/webapps/Openbook2 directory).

As the charm author you can define the configuration values that are important to your users. If the context root is not something that users will normally change you can remove that configuration option. If you think that is a useful option then the code should handle moving the code to a different context root.

Please let me know if you have any questions. Thanks again for sticking with the review process. Let me know when you are ready for another review.

Revision history for this message
Michael Garza (miqe) wrote :

Hello Matt,

We decided to remove the context root option out of the charm configuration as it would normally never be changed. The changes have been pushed and is ready for review whenever you are.

Thank you for your feedback it is greatly appreciated!

> On Feb 10, 2015, at 4:47 PM, Matt Bruzek <email address hidden> wrote:
>
> #Review
>
> Michael,
>
> Thank you for the quick turn around. The new code fixes the config-
> changed problem with the last review.
>
> I deployed this charm today and tried changing both of the configuration
> options. The `license-key` option seems to be working. However
> changing the `application-context-root` option does not seem to change
> where the webapp is actually hosted. I ran the following command:
>
> juju set openbook application-context-root=Openbook2
>
> I then tried to go to http://IP:PORT/Openbook2 and found nothing there.
> The webapp was still found at the original url: http://IP:PORT/Openbook
>
> Looking at the code, the config-changed hook changes the
> `APPLICATION_CONTEXT_ROOT` variable in the openbook.properties file, but
> never relocates the war file or the directory to the new directory (in
> this example the webapp should have been in
> /var/lib/tomcat7/webapps/Openbook2 directory).
>
> As the charm author you can define the configuration values that are
> important to your users. If the context root is not something that
> users will normally change you can remove that configuration option. If
> you think that is a useful option then the code should handle moving the
> code to a different context root.
>
> Please let me know if you have any questions. Thanks again for sticking
> with the review process. Let me know when you are ready for another
> review.
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1411402
>
> Title:
> Charm review for Openbook
>
> Status in Juju Charms:
> Fix Committed
>
> Bug description:
> Review charm for recommendation by charmers group.
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/charms/+bug/1411402/+subscriptions

Revision history for this message
Matt Bruzek (mbruzek) wrote :

Dear Mike,

I took another look at the latest charm code that you gave me. It looks great and I pushed it to the recommended section of our charm store! Congratulations! Thank you for working with us in the review process.

Anyone can now deploy openbook charm with the following command:

juju deploy openbook

(Of course they will need to deploy the supporting services, I just wanted to point out the new namespace.)

The charm is available on the web site at:

https://jujucharms.com/openbook/trusty

The bug tracker for the openbook charm is here:

https://bugs.launchpad.net/charms/+source/openbook

Thanks again for submitting this code for the charm

Changed in charms:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.