Re: Charm layers & Windows

2016-04-16 Thread Andrew Wilkins
On Sun, Apr 17, 2016 at 12:17 AM Marco Ceppi 
wrote:

> If it's acceptable to do so, I'll propose changes to charmhelpers and
>> charms.reactive at some point. It would be nice to be able to have a core
>> set of Python helpers that work on all platforms.
>>
>
> I think instead it'd be better to break some of the charm
> helpers.core.hookenv methods to a simpler, streamlined, charms.juju or
> charms.hooktools where it is _just_ the juju hook-tools and nothing more.
> It's something we've talked about these last few months in ecosystems/juju
> list but haven't quite had the time to flesh out.
>

This SGTM as long as what's split out is enough for charms.reactive. There
should be no false impressions of full compatibility then, but enough to
provide a nice experience, and familiarity for those charming software for
other operating systems.

So what I would imagine is:
 - a core set of platform-independent helpers, say charms.juju
(charms.core?)
 - charms.reactive, which depends on charms.juju/core/whatever, also
platform-independent
 - the "basic" layer, which knows how to bootstrap the above on Ubuntu,
CentOS, and Windows
 - all the rest of the charmhelpers in separate package(s), which may be
platform-specific

Cheers,
Andrew
-- 
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju


Re: Charm layers & Windows

2016-04-16 Thread Marco Ceppi
On Sat, Apr 16, 2016, 2:12 AM Andrew Wilkins 
wrote:

> On Tue, Apr 5, 2016 at 7:30 AM Andrew Wilkins <
> andrew.wilk...@canonical.com> wrote:
>
>> On Mon, Apr 4, 2016 at 10:42 PM Marco Ceppi 
>> wrote:
>>
>>> There are two things that need to be done. The first, we need the
>>> reactive framework to be ported to powershell - that way we can have charms
>>> written in powershell and compiled as such. I know the cloud base folks
>>> poked at that a bit in Gent during the Summit but I haven't heard much from
>>> there.
>>>
>>> The second, is two base layers. The first is a powershell base layer so
>>> you get the awesome powerhshell helpers cloudbase has created (like the
>>> python charm helpers). That way native power shell layers can be written.
>>> The second is to create a python-windows base layer, this would be the
>>> basic layer and then the necessary methods to install Python on the windows
>>> machine so that python layers work properly.
>>>
>>> Some of this we can pilot ourselves, (mostly the python-windows layer) -
>>> some of the team is sprinting so I'll add that as a stretch goal. The
>>> powershell native features we'll need help and I admit I've done a terrible
>>> job keeping up with the cloudbase folks who have been invaluable as a
>>> windows + juju resource thus far.
>>>
>>
>> Thanks, Marco. FWIW, I had imagined an MVP just as Stuart described: add
>> the Windows bootstrap scripts (install.ps1|bat|cmd, etc.), which should
>> just need to install Python and then defer to the reactive framework. Going
>> full Powershell support sounds ideal, but not what I'm after.
>>
>
> Brief update: I managed to get a Hello World reactive charm running on a
> Windows VM in Azure.
>
> My charm:
>  - includes the Python 3.5.1 web installer. It's reasonably small (just
> under 1MiB).
>  - has a short PowerShell hook script (install.ps1) that installs Python
> and PyYAML; and then defers to the standard Python hook (install.py)
>
> To enable private cloud deployments, it would probably make more sense for
> the charm to require Python as a resource. I just did what I did for
> expedience.
>
> I had to make a handful of changes to the basic layer, charm-helpers, and
> charms.reactive.
> In the basic layer, there are some Ubuntu assumptions that I had to
> remove: it wants to apt-get install stuff. Also, I changed it to use
> "python -m pip", rather than the pip command directly, which I didn't have
> available.
>
> I had to make three classes of changes to charm-helpers and
> charms.reactive:
>  - refer to hook tools as (e.g.) status-set.exe, rather than status-set
>  - don't require unix-specific Python modules, like "pwd" and "grp"
>  - run Python hooks with python(.exe), rather than assuming
> shebang/executable
>
> If it's acceptable to do so, I'll propose changes to charmhelpers and
> charms.reactive at some point. It would be nice to be able to have a core
> set of Python helpers that work on all platforms.
>

I think instead it'd be better to break some of the charm
helpers.core.hookenv methods to a simpler, streamlined, charms.juju or
charms.hooktools where it is _just_ the juju hook-tools and nothing more.
It's something we've talked about these last few months in ecosystems/juju
list but haven't quite had the time to flesh out.


> And just to be clear: I'm not suggesting that all all of charmhelpers
> should be OS neutral; but at least the core bits for interacting with Juju,
> and for writing reactive charms.
>
> Cheers,
> Andrew
>
> Cheers,
>> Andrew
>>
>>
>>> Marco
>>>
>>> On Mon, Apr 4, 2016 at 7:46 AM Rick Harding 
>>> wrote:
>>>
 I know that Gabriel and some of the CloudBase folks seemed interested
 in layers and possibly some tooling with powershell. I'm not sure how far
 that went but I thought they were experimenting during the charmer's
 summit. That would help with a charm build on windows, but not for some
 common code between both operating systems.

 An interesting thing is how much setup and how ootb the Ubuntu on
 Windows needs. If it's working out of the box, it might be an interesting
 move for us and our tools that Windows users could get a Linux experience.
 I guess that it won't be ideal though as I'm not sure what the server side
 plans around that work is.

 On Mon, Apr 4, 2016 at 3:18 AM Andrew Wilkins <
 andrew.wilk...@canonical.com> wrote:

> Hi,
>
> I would like to write a charm that should be mostly identical on
> Windows and Linux, so I think it would make sense to have common code in
> the form of a layer.
>
> Is anyone working on getting "charm build", layers, and friends to
> work with Windows workloads? If not, I may look into it myself.
>
> Cheers,
> Andrew
> --
> Juju mailing list
> Juju@lists.ubuntu.com
> Modify settings or unsubscribe at:
> https://lists.ubuntu.com/mailman/listinfo/juju
>
 --
 Juju mailing list
 Juju@lists

Re: Charm layers & Windows

2016-04-16 Thread Andrew Wilkins
On Tue, Apr 5, 2016 at 7:30 AM Andrew Wilkins 
wrote:

> On Mon, Apr 4, 2016 at 10:42 PM Marco Ceppi 
> wrote:
>
>> There are two things that need to be done. The first, we need the
>> reactive framework to be ported to powershell - that way we can have charms
>> written in powershell and compiled as such. I know the cloud base folks
>> poked at that a bit in Gent during the Summit but I haven't heard much from
>> there.
>>
>> The second, is two base layers. The first is a powershell base layer so
>> you get the awesome powerhshell helpers cloudbase has created (like the
>> python charm helpers). That way native power shell layers can be written.
>> The second is to create a python-windows base layer, this would be the
>> basic layer and then the necessary methods to install Python on the windows
>> machine so that python layers work properly.
>>
>> Some of this we can pilot ourselves, (mostly the python-windows layer) -
>> some of the team is sprinting so I'll add that as a stretch goal. The
>> powershell native features we'll need help and I admit I've done a terrible
>> job keeping up with the cloudbase folks who have been invaluable as a
>> windows + juju resource thus far.
>>
>
> Thanks, Marco. FWIW, I had imagined an MVP just as Stuart described: add
> the Windows bootstrap scripts (install.ps1|bat|cmd, etc.), which should
> just need to install Python and then defer to the reactive framework. Going
> full Powershell support sounds ideal, but not what I'm after.
>

Brief update: I managed to get a Hello World reactive charm running on a
Windows VM in Azure.

My charm:
 - includes the Python 3.5.1 web installer. It's reasonably small (just
under 1MiB).
 - has a short PowerShell hook script (install.ps1) that installs Python
and PyYAML; and then defers to the standard Python hook (install.py)

To enable private cloud deployments, it would probably make more sense for
the charm to require Python as a resource. I just did what I did for
expedience.

I had to make a handful of changes to the basic layer, charm-helpers, and
charms.reactive.
In the basic layer, there are some Ubuntu assumptions that I had to remove:
it wants to apt-get install stuff. Also, I changed it to use "python -m
pip", rather than the pip command directly, which I didn't have available.

I had to make three classes of changes to charm-helpers and charms.reactive:
 - refer to hook tools as (e.g.) status-set.exe, rather than status-set
 - don't require unix-specific Python modules, like "pwd" and "grp"
 - run Python hooks with python(.exe), rather than assuming
shebang/executable

If it's acceptable to do so, I'll propose changes to charmhelpers and
charms.reactive at some point. It would be nice to be able to have a core
set of Python helpers that work on all platforms.

And just to be clear: I'm not suggesting that all all of charmhelpers
should be OS neutral; but at least the core bits for interacting with Juju,
and for writing reactive charms.

Cheers,
Andrew

Cheers,
> Andrew
>
>
>> Marco
>>
>> On Mon, Apr 4, 2016 at 7:46 AM Rick Harding 
>> wrote:
>>
>>> I know that Gabriel and some of the CloudBase folks seemed interested in
>>> layers and possibly some tooling with powershell. I'm not sure how far that
>>> went but I thought they were experimenting during the charmer's summit.
>>> That would help with a charm build on windows, but not for some common code
>>> between both operating systems.
>>>
>>> An interesting thing is how much setup and how ootb the Ubuntu on
>>> Windows needs. If it's working out of the box, it might be an interesting
>>> move for us and our tools that Windows users could get a Linux experience.
>>> I guess that it won't be ideal though as I'm not sure what the server side
>>> plans around that work is.
>>>
>>> On Mon, Apr 4, 2016 at 3:18 AM Andrew Wilkins <
>>> andrew.wilk...@canonical.com> wrote:
>>>
 Hi,

 I would like to write a charm that should be mostly identical on
 Windows and Linux, so I think it would make sense to have common code in
 the form of a layer.

 Is anyone working on getting "charm build", layers, and friends to work
 with Windows workloads? If not, I may look into it myself.

 Cheers,
 Andrew
 --
 Juju mailing list
 Juju@lists.ubuntu.com
 Modify settings or unsubscribe at:
 https://lists.ubuntu.com/mailman/listinfo/juju

>>> --
>>> Juju mailing list
>>> Juju@lists.ubuntu.com
>>> Modify settings or unsubscribe at:
>>> https://lists.ubuntu.com/mailman/listinfo/juju
>>>
>>
-- 
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju


Re: Charm layers & Windows

2016-04-04 Thread Andrew Wilkins
On Mon, Apr 4, 2016 at 10:42 PM Marco Ceppi 
wrote:

> There are two things that need to be done. The first, we need the reactive
> framework to be ported to powershell - that way we can have charms written
> in powershell and compiled as such. I know the cloud base folks poked at
> that a bit in Gent during the Summit but I haven't heard much from there.
>
> The second, is two base layers. The first is a powershell base layer so
> you get the awesome powerhshell helpers cloudbase has created (like the
> python charm helpers). That way native power shell layers can be written.
> The second is to create a python-windows base layer, this would be the
> basic layer and then the necessary methods to install Python on the windows
> machine so that python layers work properly.
>
> Some of this we can pilot ourselves, (mostly the python-windows layer) -
> some of the team is sprinting so I'll add that as a stretch goal. The
> powershell native features we'll need help and I admit I've done a terrible
> job keeping up with the cloudbase folks who have been invaluable as a
> windows + juju resource thus far.
>

Thanks, Marco. FWIW, I had imagined an MVP just as Stuart described: add
the Windows bootstrap scripts (install.ps1|bat|cmd, etc.), which should
just need to install Python and then defer to the reactive framework. Going
full Powershell support sounds ideal, but not what I'm after.

Cheers,
Andrew


> Marco
>
> On Mon, Apr 4, 2016 at 7:46 AM Rick Harding 
> wrote:
>
>> I know that Gabriel and some of the CloudBase folks seemed interested in
>> layers and possibly some tooling with powershell. I'm not sure how far that
>> went but I thought they were experimenting during the charmer's summit.
>> That would help with a charm build on windows, but not for some common code
>> between both operating systems.
>>
>> An interesting thing is how much setup and how ootb the Ubuntu on Windows
>> needs. If it's working out of the box, it might be an interesting move for
>> us and our tools that Windows users could get a Linux experience. I guess
>> that it won't be ideal though as I'm not sure what the server side plans
>> around that work is.
>>
>> On Mon, Apr 4, 2016 at 3:18 AM Andrew Wilkins <
>> andrew.wilk...@canonical.com> wrote:
>>
>>> Hi,
>>>
>>> I would like to write a charm that should be mostly identical on Windows
>>> and Linux, so I think it would make sense to have common code in the form
>>> of a layer.
>>>
>>> Is anyone working on getting "charm build", layers, and friends to work
>>> with Windows workloads? If not, I may look into it myself.
>>>
>>> Cheers,
>>> Andrew
>>> --
>>> Juju mailing list
>>> Juju@lists.ubuntu.com
>>> Modify settings or unsubscribe at:
>>> https://lists.ubuntu.com/mailman/listinfo/juju
>>>
>> --
>> Juju mailing list
>> Juju@lists.ubuntu.com
>> Modify settings or unsubscribe at:
>> https://lists.ubuntu.com/mailman/listinfo/juju
>>
>
-- 
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju


Re: Charm layers & Windows

2016-04-04 Thread Marco Ceppi
There are two things that need to be done. The first, we need the reactive
framework to be ported to powershell - that way we can have charms written
in powershell and compiled as such. I know the cloud base folks poked at
that a bit in Gent during the Summit but I haven't heard much from there.

The second, is two base layers. The first is a powershell base layer so you
get the awesome powerhshell helpers cloudbase has created (like the python
charm helpers). That way native power shell layers can be written. The
second is to create a python-windows base layer, this would be the basic
layer and then the necessary methods to install Python on the windows
machine so that python layers work properly.

Some of this we can pilot ourselves, (mostly the python-windows layer) -
some of the team is sprinting so I'll add that as a stretch goal. The
powershell native features we'll need help and I admit I've done a terrible
job keeping up with the cloudbase folks who have been invaluable as a
windows + juju resource thus far.

Marco

On Mon, Apr 4, 2016 at 7:46 AM Rick Harding 
wrote:

> I know that Gabriel and some of the CloudBase folks seemed interested in
> layers and possibly some tooling with powershell. I'm not sure how far that
> went but I thought they were experimenting during the charmer's summit.
> That would help with a charm build on windows, but not for some common code
> between both operating systems.
>
> An interesting thing is how much setup and how ootb the Ubuntu on Windows
> needs. If it's working out of the box, it might be an interesting move for
> us and our tools that Windows users could get a Linux experience. I guess
> that it won't be ideal though as I'm not sure what the server side plans
> around that work is.
>
> On Mon, Apr 4, 2016 at 3:18 AM Andrew Wilkins <
> andrew.wilk...@canonical.com> wrote:
>
>> Hi,
>>
>> I would like to write a charm that should be mostly identical on Windows
>> and Linux, so I think it would make sense to have common code in the form
>> of a layer.
>>
>> Is anyone working on getting "charm build", layers, and friends to work
>> with Windows workloads? If not, I may look into it myself.
>>
>> Cheers,
>> Andrew
>> --
>> Juju mailing list
>> Juju@lists.ubuntu.com
>> Modify settings or unsubscribe at:
>> https://lists.ubuntu.com/mailman/listinfo/juju
>>
> --
> Juju mailing list
> Juju@lists.ubuntu.com
> Modify settings or unsubscribe at:
> https://lists.ubuntu.com/mailman/listinfo/juju
>
-- 
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju


Re: Charm layers & Windows

2016-04-04 Thread Nate Finch
BTW, I don't believe this is true.  I didn't work on series in metadata,
but I skimmed the code and didn't see anything doing checks for OS
consistency across the stated series.  I just tried it with a charm labeled
as trusty & win10 in the metadata.yaml and it worked fine deploying to
trusty.

On Mon, Apr 4, 2016 at 9:48 AM Stuart Bishop 
wrote:

>
> You will need two root layers for the two charms, one for Ubuntu and
> one for Windows, since you can't list both Windows and Ubuntu releases
> as supported series in the same metadata.yaml.
>
>
-- 
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju


Re: Charm layers & Windows

2016-04-04 Thread Nate Finch
At least... according to the core code, but it occurs to me I may well be
mistaken about what's allowed by the charm authoring tools and/or
charmstore.

On Mon, Apr 4, 2016 at 10:16 AM Nate Finch  wrote:

> BTW, I don't believe this is true.  I didn't work on series in metadata,
> but I skimmed the code and didn't see anything doing checks for OS
> consistency across the stated series.  I just tried it with a charm labeled
> as trusty & win10 in the metadata.yaml and it worked fine deploying to
> trusty.
>
> On Mon, Apr 4, 2016 at 9:48 AM Stuart Bishop 
> wrote:
>
>>
>> You will need two root layers for the two charms, one for Ubuntu and
>> one for Windows, since you can't list both Windows and Ubuntu releases
>> as supported series in the same metadata.yaml.
>>
>>
-- 
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju


Re: Charm layers & Windows

2016-04-04 Thread Stuart Bishop
On 4 April 2016 at 14:17, Andrew Wilkins  wrote:
> Hi,
>
> I would like to write a charm that should be mostly identical on Windows and
> Linux, so I think it would make sense to have common code in the form of a
> layer.
>
> Is anyone working on getting "charm build", layers, and friends to work with
> Windows workloads? If not, I may look into it myself.

I think you could do it right now if you added explicit powershell
hook stubs that a) ensure Python is installed on the path and b) kick
off the Python hooks. https://github.com/juju/charm-tools/issues/98 is
about having 'charm build' generate the required hook stubs from
layer.yaml instead of embedding them, which will help here in the
future.

You will need two root layers for the two charms, one for Ubuntu and
one for Windows, since you can't list both Windows and Ubuntu releases
as supported series in the same metadata.yaml.

A source of potential problems is charmhelpers as it is not tested
under Windows and there are likely linuxisms burried in there.
charms.reactive doesn't need much of it though, so it is likely to be
fine. I haven't seen anything obviously platform dependent apart from
the obvious stuff like wrappers around apt. There might be some linux
specific imports at the top level that need to be moved to import on
demand (import apt, import distro_info etc).

-- 
Stuart Bishop 

-- 
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju


Re: Charm layers & Windows

2016-04-04 Thread Nate Finch
>From what I've read, there's no server-side story to Ubuntu on Windows.
It's purely desktop, and in fact, only installs on desktop versions of
Windows 10.  That could help with tooling for charm authors, but obviously
the charm code itself still needs to run on vanilla Windows.

The main tricky part I see is that the charm code for Windows expects hooks
to be .exe, .ps1, .cmd, or .bat.  You can't have a hook with no extension
on Windows, and on Linux we expect it to be a command with no extension.
That being said, there's nothing that says you can't have both an
'install.ps1' hook file for Windows and an 'install' hook file for Linux in
the same charm.  The code will do the right thing and use the right hook
for each OS.

On Mon, Apr 4, 2016 at 7:46 AM Rick Harding 
wrote:

> I know that Gabriel and some of the CloudBase folks seemed interested in
> layers and possibly some tooling with powershell. I'm not sure how far that
> went but I thought they were experimenting during the charmer's summit.
> That would help with a charm build on windows, but not for some common code
> between both operating systems.
>
> An interesting thing is how much setup and how ootb the Ubuntu on Windows
> needs. If it's working out of the box, it might be an interesting move for
> us and our tools that Windows users could get a Linux experience. I guess
> that it won't be ideal though as I'm not sure what the server side plans
> around that work is.
>
> On Mon, Apr 4, 2016 at 3:18 AM Andrew Wilkins <
> andrew.wilk...@canonical.com> wrote:
>
>> Hi,
>>
>> I would like to write a charm that should be mostly identical on Windows
>> and Linux, so I think it would make sense to have common code in the form
>> of a layer.
>>
>> Is anyone working on getting "charm build", layers, and friends to work
>> with Windows workloads? If not, I may look into it myself.
>>
>> Cheers,
>> Andrew
>> --
>> Juju mailing list
>> Juju@lists.ubuntu.com
>> Modify settings or unsubscribe at:
>> https://lists.ubuntu.com/mailman/listinfo/juju
>>
> --
> Juju mailing list
> Juju@lists.ubuntu.com
> Modify settings or unsubscribe at:
> https://lists.ubuntu.com/mailman/listinfo/juju
>
-- 
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju


Re: Charm layers & Windows

2016-04-04 Thread Rick Harding
I know that Gabriel and some of the CloudBase folks seemed interested in
layers and possibly some tooling with powershell. I'm not sure how far that
went but I thought they were experimenting during the charmer's summit.
That would help with a charm build on windows, but not for some common code
between both operating systems.

An interesting thing is how much setup and how ootb the Ubuntu on Windows
needs. If it's working out of the box, it might be an interesting move for
us and our tools that Windows users could get a Linux experience. I guess
that it won't be ideal though as I'm not sure what the server side plans
around that work is.

On Mon, Apr 4, 2016 at 3:18 AM Andrew Wilkins 
wrote:

> Hi,
>
> I would like to write a charm that should be mostly identical on Windows
> and Linux, so I think it would make sense to have common code in the form
> of a layer.
>
> Is anyone working on getting "charm build", layers, and friends to work
> with Windows workloads? If not, I may look into it myself.
>
> Cheers,
> Andrew
> --
> Juju mailing list
> Juju@lists.ubuntu.com
> Modify settings or unsubscribe at:
> https://lists.ubuntu.com/mailman/listinfo/juju
>
-- 
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju


Charm layers & Windows

2016-04-04 Thread Andrew Wilkins
Hi,

I would like to write a charm that should be mostly identical on Windows
and Linux, so I think it would make sense to have common code in the form
of a layer.

Is anyone working on getting "charm build", layers, and friends to work
with Windows workloads? If not, I may look into it myself.

Cheers,
Andrew
-- 
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju