ClusterLabs / pcs-web-ui

Web interface for pcs
GNU General Public License v2.0
11 stars 5 forks source link

How to build cockpit plugin locally? #53

Open HuangShumin opened 11 months ago

HuangShumin commented 11 months ago

I found this project requires to Nexus repo for packaging.

idevat commented 11 months ago

Hi @HuangShumin,

you can run

BUILD_FOR_COCKPIT=true make build

to build pcs-web-ui for cockpit. It creates build/ directory and you need to copy it to cockpit plugin directory by e.g.:

cp -r build/. /usr/share/cockpit/ha-cluster

Keep in mind that pcs-web-ui in cockpit requires pcsd running locally.

Nexus is not required.

HuangShumin commented 10 months ago

No luck. After I built for cockpit in RHEL8.8 and copied to /usr/share/cockpit/ha-cluster, I saw nothing in the ha-cluster menu of cockpit page.

idevat commented 10 months ago

Hi @HuangShumin,

unix socket communication support in pcsd is required to be possible to run pcs-web-ui from cockpit. This feature appeared first time in pcs version 0.11.4. In RHEL8, there is pcs based on pcs-0.10 branch, see https://github.com/ClusterLabs/pcs/blob/main/README.md#pcs-versions

HuangShumin commented 10 months ago

Clear. Thank you for this information

HuangShumin commented 10 months ago

I tried on Alma Linux 9.3 this time with these outpt

[root@node1 pcs-web-ui-0.1.18]# BUILD_FOR_COCKPIT=true make build
./packages/app/.bin/check-assumptions.sh
Starting build

Node modules prepared: /root/pcs-web-ui-0.1.18/packages/app/node_modules.
Build dir prepared: /root/pcs-web-ui-0.1.18/build.
Going to build assets.
node:internal/modules/cjs/loader:1031
  throw err;
  ^

Error: Cannot find module 'webpack'
Require stack:
- /root/pcs-web-ui-0.1.18/packages/app/.bin/build.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1028:15)
    at Function.Module._load (node:internal/modules/cjs/loader:873:27)
    at Module.require (node:internal/modules/cjs/loader:1100:19)
    at require (node:internal/modules/cjs/helpers:119:18)
    at Object.<anonymous> (/root/pcs-web-ui-0.1.18/packages/app/.bin/build.js:18:17)
    at Module._compile (node:internal/modules/cjs/loader:1198:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1252:10)
    at Module.load (node:internal/modules/cjs/loader:1076:32)
    at Function.Module._load (node:internal/modules/cjs/loader:911:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ '/root/pcs-web-ui-0.1.18/packages/app/.bin/build.js' ]
}
Assets compiled.
ls: cannot access '/root/pcs-web-ui-0.1.18/build/static/css/main.*.css': No such file or directory
ls: cannot access '/root/pcs-web-ui-0.1.18/build/static/js/main.*.js': No such file or directory
Compiled assets injected to html page.
Adapting for usage inside cockpit.
Adapted for environment
Prefixed asset paths: '.'.

Environment adapter minimized
Marks prepared
rm: cannot remove '/root/pcs-web-ui-0.1.18/packages/app/node_modules': No such file or directory

/root/pcs-web-ui-0.1.18/build/static/js/adapter.js: 1200

[root@node1 pcs-web-ui-0.1.18]# ls -R build/
build/:
index.html  manifest.json  manifest_test_marks.json  static

build/static:
js  media

build/static/js:
adapter.js

build/static/media:
favicon.png
idevat commented 10 months ago

Hi @HuangShumin,

sorry for the delay, I was sick.

Unfortunately, a nexus proxy has indeed slipped into package-lock.json. This is now fixed in the branch main with a commit https://github.com/ClusterLabs/pcs-web-ui/commit/b3203ed73cc91c27236927e5c38d87f891157fb8.

HuangShumin commented 10 months ago

thanks for update. sincerely I wish you good health. I will try this commit.