Document the new resource feature #1122

Merged
merged 7 commits into from Jun 6, 2016

Conversation

Projects
None yet
3 participants
Contributor

mbruzek commented May 25, 2016

The Juju 2.0 resource feature needs some developer documentation on how to attach resources and how to use this in the charm.

I did not implement this feature, but I did my best at documenting how I understand it works. It could really use a review by the juju-core developers who introduced this feature.

Also it probably needs some work to get up to @evilnick 's standards.

Contributor

mbruzek commented May 25, 2016

This PR addresses 1/2 of issue #935

Contributor

mbruzek commented May 25, 2016

@kat-co , @natefinch , please review this material.

+other locations, some charms may be deployed network restricted environments
+that do not allow access to all areas of the Internet.
+
+Starting with version 2 of Juju, users can upload resources to the controller
@natefinch

natefinch May 31, 2016

Contributor

or Juju charm store (which will be downloaded to the controller as-needed when requested by an installed unit).

(oops, I see this is addressed below)

@evilnick

evilnick Jun 6, 2016

Member

s/2/2.0

src/en/developer-resources.md
+ filename: software.zip
+ description: "One line description that is useful when operators need to push it."
+```
+The `filename` is the name of the resource after it has been retrieved. Juju
@natefinch

natefinch May 31, 2016

Contributor

"The filename field contains the name of the file that will be created on the unit after the resource has been retrieved from the juju controller."

src/en/developer-resources.md
+
+Resources can be uploaded to a local Juju controller, where only charms from
+that controller can access the resources, or the Juju Charm Store where access
+is controlled by permissions.
@natefinch

natefinch May 31, 2016

Contributor

controlled by the permissions assigned to the charm to which the resources are attached.

Contributor

natefinch commented May 31, 2016

There should be a section explaining that when you use juju attach, it fires the charm_upgrade hook, so charm authors will need to handle that appropriately.

+resource. Note that the resource may get updated on the controller for the
+service at any time, meaning the cached copy *may* be out of date at any time
+after `resource-get` is called. Consequently, the command should be run at
+every point where it is critical for the resource be up to date.
@natefinch

natefinch May 31, 2016

Contributor

This is only sort of true. If the resource updates, then the charm will get a charm-upgrade hook firing. You can safely choose to ignore it during charm-update, if you also do resource-get before you need to use the resource. Note that resource-get won't download anything if you already have the most up-to-date version of the resource, so it's safe to just always call resource-get first, since it'll just be a quick API call unless you're out of date.

@mbruzek

mbruzek May 31, 2016

Contributor

it'll just be a quick API call unless you're out of date

@natefinch my testing of this feature found this not to be true. I uploaded a resource once, yet every time I called resource-get the debug session hung for a long time presumably fetching the new resource. I checked the hash sum before and after they were always the same but any time I called that method it seemed to me to fetch the whole thing.

Contributor

natefinch commented May 31, 2016

mostly LGTM with a few suggested tweaks.

Contributor

mbruzek commented Jun 6, 2016

I addressed the comments form @natefinch. Some of it was information that I didn't have when writing this documentation. If everything looks OK can I get a review from someone the docs team on the use of "proper" English (or lack-there-of)?

+
+Many applications require binary resources in order to be installed. While it is
+possible for a charm to download the software from the package repositories, or
+other locations, some charms may be deployed network restricted environments
@evilnick

evilnick Jun 6, 2016

Member

... deployed in network restricted...

+Starting with version 2 of Juju, users can upload resources to the controller
+or the Juju Charm Store that charms can download. This is useful for Juju
+models in restrictive network environments and when you want to control the
+versions of software that is deployed.
@evilnick

evilnick Jun 6, 2016

Member

are deployed

Member

evilnick commented Jun 6, 2016

Forget about my comments - there are a few too many twiddly bits to be reworded. Will just merge and fix instead 😄

Thanks for this work 🍰

@evilnick evilnick merged commit 77ddd30 into juju:master Jun 6, 2016

Contributor

mbruzek commented Jun 6, 2016

@evilnick I will fix these now. stand by.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment