Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mgr/dashboard: remove node/npm system installation #20898

Merged
merged 1 commit into from Mar 19, 2018

Conversation

tspmelo
Copy link
Contributor

@tspmelo tspmelo commented Mar 14, 2018

Node and npm are now being installed in a virtualenv, removing the need of
having it installed in the system or as a node dependency.

Now, if you want to use npm, you just need to activate the virtualenv created
on 'build/src/pybind/mgr/dashboard/node-env', and then you can execute
the same commands as you did before.

Signed-off-by: Tiago Melo <tmelo@suse.com>

message(FATAL_ERROR "WITH_MGR_DASHBOARD_V2_FRONTEND set, but npm not found")
endif()

set(mgr-dashboard_v2-nodeenv ${CMAKE_SOURCE_DIR}/build/dashboard_nodeenv)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should use CMAKE_BINARY_DIR instead of hardwiring it to ${CMAKE_SOURCE_DIR}/build. also i'd suggest remove the prefix of mgr-dashboard_v2-, and install the nodeenv in current binary, i.e.

set(mgr-dashboard_v2-nodeenv ${CMAKE_CURRENT_BINARY_DIR}/node-env)

COMMAND ${CMAKE_SOURCE_DIR}/src/tools/setup-virtualenv.sh ${mgr-dashboard_v2-nodeenv}
COMMAND ${mgr-dashboard_v2-nodeenv}/bin/pip install nodeenv
COMMAND ${mgr-dashboard_v2-nodeenv}/bin/nodeenv -p -n 8.10.0
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/build
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto.

@tspmelo
Copy link
Contributor Author

tspmelo commented Mar 14, 2018

Implemented @tchaikov's suggestions and updated node-env path in HACKING.rst.


.. note::
After you are finished with it, you can simply run ``deactivate`` and exit the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this scares me =)
might want to put something like

Once you finish it

@tspmelo tspmelo force-pushed the wip-nodejs-improvement branch 2 times, most recently from 5faf2b2 to e6743f6 Compare March 15, 2018 10:54
@tspmelo
Copy link
Contributor Author

tspmelo commented Mar 15, 2018

updated HACKING.rst and fixed run-frontend-unittests.sh.

@jcsp
Copy link
Contributor

jcsp commented Mar 15, 2018

It would be nice to skip using nodeenv if running on a distro that has recent enough node/npm (Fedora 27 has it, probably also latest opensuse has it?). I get that it is more complicated to have both the native path and the nodeenv path though.

@rjfd
Copy link
Contributor

rjfd commented Mar 16, 2018

@tspmelo I tested the frontend build plus frontend unit tests in tumbleweed, ubuntu 16.04, 18.04, and CentOS 7 docker containers and everything worked good!

But before merging this code as it is, we could take this opportunity to move the frontend build artifacts from the source tree into the build directory, what do you think?

Node and npm are now being installed in a virtualenv, removing the need of
having it installed in the system or as a node dependency.

Now, if you want to use npm, you just need to activate the virtualenv created
on 'build/src/pybind/mgr/dashboard/node-env', and then you can execute the
same commands as you did before.

Signed-off-by: Tiago Melo <tmelo@suse.com>
@tspmelo
Copy link
Contributor Author

tspmelo commented Mar 16, 2018

Rebased the branch.

@jcsp are you talking about implementing this on install-deps.sh or just during make?
I think it would be possible and easier to add this to the make files.

@LenzGr LenzGr changed the title mgr/dashboard_v2: remove node/npm system installation mgr/dashboard: remove node/npm system installation Mar 16, 2018
@rjfd
Copy link
Contributor

rjfd commented Mar 16, 2018

But before merging this code as it is, we could take this opportunity to move the frontend build artifacts from the source tree into the build directory, what do you think?

@tspmelo second thought, moving the location of the frontend files requires changes to the backend code. That should be done in a different PR. Therefore, this PR LGTM

Copy link
Contributor

@rjfd rjfd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@smithfarm
Copy link
Contributor

@tspmelo Thanks, this makes the whole make-dist experience much smoother.

@rjfd rjfd removed the needs-qa label Mar 19, 2018
@rjfd
Copy link
Contributor

rjfd commented Mar 19, 2018

@tspmelo builds in shaman were successful

@rjfd rjfd merged commit 3e9c2ec into ceph:master Mar 19, 2018
@tspmelo tspmelo deleted the wip-nodejs-improvement branch May 2, 2018 15:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants