Sunstone not loading on 5.6-beta1

I’m building 5.6-beta1 from sources, using the build scripts from the one/packages repo. I was doing this with 5.4.x and it was fine.
But with 5.6-beta1, sunstone daemon fails to start because it can’t find /usr/lib/one/sunstone/public/dist/main-dist.js:

Jul 10 08:27:57 node01.in.noisy.linuxed.net ruby[27633]: :session_expire_time=>3600}
Jul 10 08:27:57 node01.in.noisy.linuxed.net ruby[27633]: --------------------------------------
Jul 10 08:27:58 node01.in.noisy.linuxed.net ruby[27633]: /usr/lib/one/ruby/OpenNebulaAddons.rb:29:in `initialize': No such file or directory - /usr/lib/one/sunstone/public/dist/main-dist.js (Errno::ENOENT)
Jul 10 08:27:58 node01.in.noisy.linuxed.net ruby[27633]: from /usr/lib/one/ruby/OpenNebulaAddons.rb:29:in `new'
Jul 10 08:27:58 node01.in.noisy.linuxed.net ruby[27633]: from /usr/lib/one/ruby/OpenNebulaAddons.rb:29:in `initialize'
Jul 10 08:27:58 node01.in.noisy.linuxed.net ruby[27633]: from /usr/lib/one/sunstone/sunstone-server.rb:198:in `new'
Jul 10 08:27:58 node01.in.noisy.linuxed.net ruby[27633]: from /usr/lib/one/sunstone/sunstone-server.rb:198:in `<main>'
Jul 10 08:27:58 node01.in.noisy.linuxed.net systemd[1]: opennebula-sunstone.service: main process exited, code=exited, status=1/FAILURE
Jul 10 08:27:58 node01.in.noisy.linuxed.net systemd[1]: Unit opennebula-sunstone.service entered failed state.
Jul 10 08:27:58 node01.in.noisy.linuxed.net systemd[1]: opennebula-sunstone.service failed.

If I add a symlink from main-dist.js to main.js in the same directory sunstone starts. I can then access the login page, but when I log in, the dashboard endlessly loads. Can’t use sunstone. Firefox debug tools don’t show any error. I can see that main.js (and not main-dist.js) is used.

Do you have any idea ?

Best regards,
Edouard


Versions of the related components and OS (frontend, hypervisors, VMs):

CentOS 7, RPM build from sources, tag 5.6-beta1

Steps to reproduce:

  • Install RPM
  • run install_gems
  • start opennebula & opennebula-sunstone services

Current results:
Fails to start sunstone because main-dist.js is missing

Expected results:
Sunstone service should start. And sunstone UI should work.

I’ve found this https://github.com/OpenNebula/one/issues/2238 but the symlink helps only for starting sunstone. UI is not working.

I’ve just tried with 5.5.90 and this is the same. Bizarrely 5.5.90 seems more recent than 5.6-beta1. Is that correct ?

Hello @madko,

From sources you must run install.sh because this script generate the symbolic link to $VAR_LOCATION/sunstone/main.js.

Regarding the Sunstone’s error, do you use Apache or nginx?

Ok I will try to use the install.sh before or during the build of the RPMs. The /usr/lib/one/sunstone/public/dist/main.js is here but empty. But even with the right content, I’m still stuck on a loading page after loging in.

I’m using nginx.

Thanks for your help

The sunstone-server process generate the main.js file in /var/lib/one/sunstone/ when it starts.

main.js (/usr/lib/one/sunstone/public/dist) being a symbolic link now, nginx may not be configured to follow them. Try this:

http {
    disable_symlinks off;
}

and make sure that nginx user is in the oneadmin group.

Any news about your problem?

Well, I’ve just tried without nginx to be sure it’s not part of the problem. Direct access on sunstone via port 9869 does the same. I can log in, than just the loading gif on a blank page.

I think all of this might be related to issue 2238, and since 5.5.90 tag in the git seems to be anterior to the fix, I’m stuck. So I’m waiting for the next tag.

I still have to take a look on this install.sh. Is it relevant when you are building the RPM ? I can see it in the spec file https://github.com/OpenNebula/packages/blob/master/templates/centos7/centos7.spec.tpl

If I do this:
cat /usr/lib/one/sunstone/public/app/main.js > /var/lib/one/sunstone/main.js

I’ve got an error in firefox:

ReferenceError: require is not defined[Learn More] main.js:17:1
	<anonymous> http://one.lan/dist/main.js:17:1

I think I will try to build from master.

So I’ve tried the 5.5.90 RPMs from official repo and it works. So I guess something has changed in the way to build everything since 5.4.x. Any idea ?

ReferenceError: require is not defined[Learn More] main.js:17:1
	<anonymous> http://one.lan/dist/main.js:17:1 

it seems that requireJS is not installed, but now in 5.6.*, if you install from source, the new sunstone scons install all the dependencies … it’s strange because I can’t reproduce it.

Hi @madko,

Did you fix the endless landing blank page issue?

I tried to build RPMs from source(tag 5.6.2 of one repo) following the instruction of the packages repo(tag 5.6.2), and encountered the same issue as you did:

  • missing file /usr/lib/one/sunstone/public/dist/main-dist.js
  • the content of /var/lib/one/sunstone/main.js is empty.

If you fix the issue, would you like to share some advice?

Thanks in advance.

Sadly I still have the same issue… I’d like to build 5.6.2 too

Hi @skyairmj, @madko,

You should replace the procedure for building sunstone following the guide in src/sunstone/public/README.md (well slightly modified though). The packages procedure should be changed to:

# sunstone
cd  src/sunstone/public
./build.sh -d
export PATH=$PATH:$PWD/node_modules/.bin
./build.sh
rm -rf node_modules/
cd ../../../../

Then continue with creating the source tar, etc…

Hope this helps.

Best Regards,
Anton Todorov

[edit] Added cleanup of node_modules

1 Like

Thank you this is working fine now :smile:

Thank @atodorov_storpool :smile: