Hi Waldek,

so what you'd like to achieve is to run cpiod only on first run, then run 
the actual bootcmd on all subsequent runs.
I find such behaviour useful and would be very happy if we could do it in a 
way that would work for cloud-init
as well.

I was thinking, could we perhaps modify cpiod so that it would exit 
immediately if there was some specific file present on
the unikernel's filesystem (e.g. /cpiod-skip)? In other words, the command 
would then look like this:

   - '/tools/cpiod.so --prefix / --conditional; runscript/the_config'

When the "--conditional" flag is used and "/cpiod-skip" is present, then 
the first part ("'/tools/cpiod.so --prefix / --conditional") would return
immediately. And the bootcmd would effectively become only 
"runscript/the_config". 

All we need to do then is to make sure the file "/cpiod-skip" is uploaded 
during the "capstan package compose-remote".
Such approach would also work with cloud-init even if all commands there 
are always run.

What do you think?




Dne ponedeljek, 06. november 2017 06.23.30 UTC+1 je oseba Waldek Kozaczuk 
napisala:
>
> In last couple of weeks I have been working with MikelAngelo capstan team 
> to add a feature 'compose-remote' that allows composing and uploading files 
> to a remote OSv instance with cpiod running. 
>
> This feature is aimed to help speed-up creation of OSv AWS immutable amis 
> which right now is extremely slow if one wants to import pre-baked OSv raw 
> image as a snapshot and create an AMI of it. The new idea is that every 
> time user wanted to create final application AMI he/she would create a 
> bootstrap or 'base" AMI (cmdline=''/tools/cpiod.so --prefix /") in a 
> traditional way, start EC2 instance with running cpiod, upload extra files 
> using capstan and take a snapshot and create new AMI which I tested and is 
> much faster. This could be applied to all other cases where uploading to a 
> remote instance makes more sense. 
>
> The only remaining problem how one set new cmdline. There is a least one 
> way of achieving it. One would bake in cloud-init module in a base AMI and 
> have it set cmdline using httpserver and proper command in user data ec2 
> start. There are many downsides - it would not work in non cloud-init 
> friendly environments, cloud init is pretty heavy and complicated tool to 
> achieve something so simple and depends on httpserver. Please it does not 
> let me create immutable AMIs with preset cmdline.
>
> Here is my idea: create simple new tool - setcmdline.so that would behave 
> like so:
>
>    - set new cmdline if it is passed non-empty explicit cmdline
>    - set new cmdline from a content of file /cmdline if one present and 
>    delete it
>    - do not change cmdline otherwise
>
> Now user would use it in one of 2 ways - set cmdline of base AMI like so:
>
>    - '/tools/cpiod.so --prefix /; /tools/setcmdline.so' and have capstan 
>    upload a file /cmdline with appropriate content when uploading all other 
>    files
>    - '*/tools/cpiod.so --prefix /; /tools/setcmdline.so "**runscript 
>    /run/the_config**"'*
>
> Another alternative I toyed with would be to enhance cpiod to handle new 
> 'setcmdline' command but it seems pretty hackish and also requires 
> modification of capstan.
>
> What do you think?
> Waldek
>

-- 
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osv-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to