[openstack-dev] [Fuel] Building Fuel plugins with UI part
Vitaly Kramskikh
vkramskikh at mirantis.com
Mon Dec 15 14:25:33 UTC 2014
Hi,
The only thing I don't really like is that we need fuel-web code to build
plugin. But we have can do nothing with it, as typical UI plugin by design
is tightly coupled with the core. If plugin want to reuse core libraries,
utils, controls then it has to declare them as dependencies and if there
would be a build error if these files weren't found by r.js.
I created the first version of spec
<https://review.openstack.org/#/c/141761/1> where described my vision of
build process. You can comment on it there.
Some responses inline:
2014-12-15 14:48 GMT+01:00 Przemyslaw Kaminski <pkaminski at mirantis.com>:
>
>
> On 12/15/2014 02:26 PM, Anton Zemlyanov wrote:
>
> The building of the UI plugin has several things I do not like
>
> 1) I need to extract the UI part of the plugin and copy/symlink it to
> fuel-web
>
>
> This is required, the UI part should live somewhere in statics/js. This
> directory is served by nginx and symlinking/copying is I think the best
> way, far better than adding new directories to nginx configuration.
>
>
I think Anton is talking not about serving, but building the plugin. Yes,
to build the UI part of plugin you need to extract its UI part and
move/symlink it to static/plugins/<plugin_name> before you can run the
build.
> 2) I have to run grunt build on the whole fuel-web
>
>
> This shouldn't at all be necessary.
>
> Yes, it is not necessary. Actually you don't have if you add another task
or option for grunt build to not build the main project. It can be achieved
by removing these lines
<https://github.com/stackforge/fuel-web/blob/master/nailgun/Gruntfile.js#L45-L48>.
> 3) I have to copy files back to original location to pack them
>
>
> Shouldn't be necessary.
>
> 4) I cannot easily switch between development/production versions (no
> way to easily change entry point)
>
>
> Development/production versions should only differ by serving
> raw/compressed files. The compressed files should be published by the
> plugin author.
>
> On my development machine I use different ports of nginx to serve original
and compressed versions of UI. It's configuration is pretty straightforward.
>
> The only way to install plugin is `fuel plugins --install`, no matter
> development or production, so even development plugins should be packed to
> tar.gz
>
>
> The UI part should be working immediately after symlinking somewhere in
> the statics/js directory imho (and after API is aware of the new pugin but).
>
> P.
>
>
>
> Anton
>
> On Mon, Dec 15, 2014 at 3:30 PM, Przemyslaw Kaminski <
> pkaminski at mirantis.com> wrote:
>>
>> First of all, compiling of statics shouldn't be a required step. No one
>> does this during development.
>> For production-ready plugins, the compiled files should already be
>> included in the GitHub repos and installation of plugin should just be a
>> matter of downloading it. The API should then take care of informing the UI
>> what plugins are installed.
>> The npm install step is mostly one-time.
>> The grunt build step for the plugin should basically just compile the
>> staticfiles of the plugin and not the whole project. Besides with one file
>> this is not extendable -- for N plugins we would build 2^N files with all
>> possible combinations of including the plugins? :)
>>
>> P.
>>
>>
>> On 12/15/2014 11:35 AM, Anton Zemlyanov wrote:
>>
>> My experience with building Fuel plugins with UI part is following. To
>> build a ui-less plugin, it takes 3 seconds and those commands:
>>
>> git clone https://github.com/AlgoTrader/test-plugin.git
>> cd ./test-plugin
>> fpb --build ./
>>
>> When UI added, build start to look like this and takes many minutes:
>>
>> git clone https://github.com/AlgoTrader/test-plugin.git
>> git clone https://github.com/stackforge/fuel-web.git
>> cd ./fuel-web
>> git fetch https://review.openstack.org/stackforge/fuel-web
>> refs/changes/00/112600/24 && git checkout FETCH_HEAD
>> cd ..
>> mkdir -p ./fuel-web/nailgun/static/plugins/test-plugin
>> cp -R ./test-plugin/ui/* ./fuel-web/nailgun/static/plugins/test-plugin
>> cd ./fuel-web/nailgun
>> npm install && npm update
>> grunt build --static-dir=static_compressed
>> cd ../..
>> rm -rf ./test-plugin/ui
>> mkdir ./test-plugin/ui
>> cp -R ./fuel-web/nailgun/static_compressed/plugins/test-plugin/*
>> ./test-plugin/ui
>> cd ./test-plugin
>> fpb --build ./
>>
>> I think we need something not so complex and fragile
>>
>> Anton
>>
>>
>>
>>
>> _______________________________________________
>> OpenStack-dev mailing listOpenStack-dev at lists.openstack.orghttp://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>>
>>
>>
>> _______________________________________________
>> OpenStack-dev mailing list
>> OpenStack-dev at lists.openstack.org
>> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>>
>>
>
> _______________________________________________
> OpenStack-dev mailing listOpenStack-dev at lists.openstack.orghttp://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>
>
>
> _______________________________________________
> OpenStack-dev mailing list
> OpenStack-dev at lists.openstack.org
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>
>
--
Vitaly Kramskikh,
Software Engineer,
Mirantis, Inc.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20141215/fe539de8/attachment.html>
More information about the OpenStack-dev
mailing list