Running Sunstone with Passenger in Apache

Hello,

I have configured my OpenNebula 5.10 with Apache+Passenger. By the moment, I can login in Sunstone interface with no problems and create and run an instance. If I click on the “VNC” button, I can see my console. But if I click on the “Open in a new window” from my VNC session (middle button)

imagen

I get an “Internal Server Error”, so I can’t connect to my VNC session if I “deattach” tab.

Logs from that error are:

App 39050 stderr: 2020-02-18 12:59:36 - NoMethodError - undefined method `[]' for nil:NilClass:
App 39050 stderr:       /usr/lib/one/sunstone/sunstone-server.rb:619:in `block in <top (required)>'
App 39050 stderr:       /usr/share/one/gems/gems/sinatra-1.4.8/lib/sinatra/base.rb:1611:in `call'
App 39050 stderr:       /usr/share/one/gems/gems/sinatra-1.4.8/lib/sinatra/base.rb:1611:in `block in compile!'
App 39050 stderr:       /usr/share/one/gems/gems/sinatra-1.4.8/lib/sinatra/base.rb:975:in `[]'
App 39050 stderr:       /usr/share/one/gems/gems/sinatra-1.4.8/lib/sinatra/base.rb:975:in `block (3 levels) in route!'
App 39050 stderr:       /usr/share/one/gems/gems/sinatra-1.4.8/lib/sinatra/base.rb:994:in `route_eval'
App 39050 stderr:       /usr/share/one/gems/gems/sinatra-1.4.8/lib/sinatra/base.rb:975:in `block (2 levels) in route!'
App 39050 stderr:       /usr/share/one/gems/gems/sinatra-1.4.8/lib/sinatra/base.rb:1015:in `block in process_route'
App 39050 stderr:       /usr/share/one/gems/gems/sinatra-1.4.8/lib/sinatra/base.rb:1013:in `catch'
App 39050 stderr:       /usr/share/one/gems/gems/sinatra-1.4.8/lib/sinatra/base.rb:1013:in `process_route'
App 39050 stderr:       /usr/share/one/gems/gems/sinatra-1.4.8/lib/sinatra/base.rb:973:in `block in route!'
App 39050 stderr:       /usr/share/one/gems/gems/sinatra-1.4.8/lib/sinatra/base.rb:972:in `each'
App 39050 stderr:       /usr/share/one/gems/gems/sinatra-1.4.8/lib/sinatra/base.rb:972:in `route!'
App 39050 stderr:       /usr/share/one/gems/gems/sinatra-1.4.8/lib/sinatra/base.rb:1085:in `block in dispatch!'
App 39050 stderr:       /usr/share/one/gems/gems/sinatra-1.4.8/lib/sinatra/base.rb:1067:in `block in invoke'
App 39050 stderr:       /usr/share/one/gems/gems/sinatra-1.4.8/lib/sinatra/base.rb:1067:in `catch'
App 39050 stderr:       /usr/share/one/gems/gems/sinatra-1.4.8/lib/sinatra/base.rb:1067:in `invoke'
App 39050 stderr:       /usr/share/one/gems/gems/sinatra-1.4.8/lib/sinatra/base.rb:1082:in `dispatch!'
App 39050 stderr:       /usr/share/one/gems/gems/sinatra-1.4.8/lib/sinatra/base.rb:907:in `block in call!'
App 39050 stderr:       /usr/share/one/gems/gems/sinatra-1.4.8/lib/sinatra/base.rb:1067:in `block in invoke'
App 39050 stderr:       /usr/share/one/gems/gems/sinatra-1.4.8/lib/sinatra/base.rb:1067:in `catch'
App 39050 stderr:       /usr/share/one/gems/gems/sinatra-1.4.8/lib/sinatra/base.rb:1067:in `invoke'
App 39050 stderr:       /usr/share/one/gems/gems/sinatra-1.4.8/lib/sinatra/base.rb:907:in `call!'
App 39050 stderr:       /usr/share/one/gems/gems/sinatra-1.4.8/lib/sinatra/base.rb:895:in `call'
App 39050 stderr:       /usr/share/one/gems/gems/rack-1.6.11/lib/rack/commonlogger.rb:33:in `call'
App 39050 stderr:       /usr/share/one/gems/gems/sinatra-1.4.8/lib/sinatra/base.rb:219:in `call'
App 39050 stderr:       /usr/share/one/gems/gems/rack-1.6.11/lib/rack/deflater.rb:35:in `call'
App 39050 stderr:       /usr/share/one/gems/gems/rack-1.6.11/lib/rack/session/abstract/id.rb:225:in `context'
App 39050 stderr:       /usr/share/one/gems/gems/rack-1.6.11/lib/rack/session/abstract/id.rb:220:in `call'
App 39050 stderr:       /usr/share/one/gems/gems/rack-protection-1.5.5/lib/rack/protection/xss_header.rb:18:in `call'
App 39050 stderr:       /usr/share/one/gems/gems/rack-protection-1.5.5/lib/rack/protection/path_traversal.rb:16:in `call'
App 39050 stderr:       /usr/share/one/gems/gems/rack-protection-1.5.5/lib/rack/protection/json_csrf.rb:18:in `call'
App 39050 stderr:       /usr/share/one/gems/gems/rack-protection-1.5.5/lib/rack/protection/base.rb:49:in `call'
App 39050 stderr:       /usr/share/one/gems/gems/rack-protection-1.5.5/lib/rack/protection/base.rb:49:in `call'
App 39050 stderr:       /usr/share/one/gems/gems/rack-protection-1.5.5/lib/rack/protection/frame_options.rb:31:in `call'
App 39050 stderr:       /usr/share/one/gems/gems/rack-1.6.11/lib/rack/nulllogger.rb:9:in `call'
App 39050 stderr:       /usr/share/one/gems/gems/rack-1.6.11/lib/rack/head.rb:13:in `call'
App 39050 stderr:       /usr/share/one/gems/gems/rack-1.6.11/lib/rack/methodoverride.rb:22:in `call'
App 39050 stderr:       /usr/share/one/gems/gems/sinatra-1.4.8/lib/sinatra/base.rb:182:in `call'
App 39050 stderr:       /usr/share/one/gems/gems/sinatra-1.4.8/lib/sinatra/base.rb:2013:in `call'
App 39050 stderr:       /usr/share/one/gems/gems/sinatra-1.4.8/lib/sinatra/base.rb:1487:in `block in call'
App 39050 stderr:       /usr/share/one/gems/gems/sinatra-1.4.8/lib/sinatra/base.rb:1787:in `synchronize'
App 39050 stderr:       /usr/share/one/gems/gems/sinatra-1.4.8/lib/sinatra/base.rb:1487:in `call'
App 39050 stderr:       /usr/share/passenger/phusion_passenger/rack/thread_handler_extension.rb:74:in `process_request'
App 39050 stderr:       /usr/share/passenger/phusion_passenger/request_handler/thread_handler.rb:141:in `accept_and_process_next_request'
App 39050 stderr:       /usr/share/passenger/phusion_passenger/request_handler/thread_handler.rb:109:in `main_loop'

I’m supposing (of course) that if I want Apache+Passenger, daemon “opennebula-sunstone” NEEDS to me stopped, doesn’t it???

My /etc/httpd/conf.d/passenger.conf is:

<IfModule mod_passenger.c>
   PassengerRoot /usr/share/passenger//phusion_passenger/locations.ini
   PassengerRuby /usr/bin/ruby
</IfModule>    

<VirtualHost *:8443>
ServerName sunstone-server
PassengerUser oneadmin
# For OpenNebula >= 5.10, variables configuring dedicated directory
# with shipped Ruby gems must be set if these gems weren’t explicitly
# disabled (by removing specified directory symlink).
SetEnv GEM_PATH /usr/share/one/gems/
SetEnv GEM_HOME /usr/share/one/gems/
# !!! Be sure to point DocumentRoot to ‘public’!
DocumentRoot /usr/lib/one/sunstone/public
<Directory /usr/lib/one/sunstone/public>
# This relaxes Apache security settings.
AllowOverride all
# MultiViews must be turned off.
Options -MultiViews
# Uncomment this if you’re on Apache >= 2.4:
Require all granted
# Comment this if you’re on OpenNebula < 5.6.0:
Options FollowSymLinks

System process tree is:

oneadmin 50993  0.0  0.0 268836 19608 ?        S    10:30   0:00 python /usr/share/one/websockify/run --target-config=/var/lib/one/sunstone_vnc_tokens 8080
oneadmin 54290  0.0  0.0 273192 16048 ?        S    13:02   0:00  \_ python /usr/share/one/websockify/run --target-config=/var/lib/one/sunstone_vnc_tokens 8080
root      4650  0.0  0.0 230508  6284 ?        Ss   10:50   0:00 /usr/sbin/httpd -DFOREGROUND
root      4671  0.0  0.0 217280  1992 ?        Ssl  10:50   0:00  \_ PassengerWatchdog
root      4674  0.2  0.0 1106568 4156 ?        Sl   10:50   0:16  |   \_ PassengerHelperAgent
nobody    4680  0.0  0.0 224980  4428 ?        Sl   10:50   0:00  |   \_ PassengerLoggingAgent
apache    4690  0.0  0.0 234752  4584 ?        S    10:50   0:00  \_ /usr/sbin/httpd -DFOREGROUND
apache    4691  0.0  0.0 234752  4584 ?        S    10:50   0:00  \_ /usr/sbin/httpd -DFOREGROUND
apache    4692  0.0  0.0 234752  4584 ?        S    10:50   0:00  \_ /usr/sbin/httpd -DFOREGROUND
apache   12515  0.0  0.0 234752  4588 ?        S    10:51   0:00  \_ /usr/sbin/httpd -DFOREGROUND
apache   13725  0.0  0.0 234752  4568 ?        S    10:51   0:00  \_ /usr/sbin/httpd -DFOREGROUND
apache   13729  0.0  0.0 234752  4588 ?        S    10:51   0:00  \_ /usr/sbin/httpd -DFOREGROUND
apache   16236  0.0  0.0 234752  4692 ?        S    10:51   0:00  \_ /usr/sbin/httpd -DFOREGROUND
apache   16268  0.0  0.0 234752  4588 ?        S    10:51   0:00  \_ /usr/sbin/httpd -DFOREGROUND
apache   31252  0.0  0.0 234752  4688 ?        S    10:56   0:00  \_ /usr/sbin/httpd -DFOREGROUND
apache   39089  0.0  0.0 234752  4584 ?        S    12:24   0:00  \_ /usr/sbin/httpd -DFOREGROUND
oneadmin  4727  0.9  0.0 2103220 45540 ?       Ssl  10:50   1:14 /usr/bin/oned -f
oneadmin  4730  0.8  0.0 450208 74244 ?        SNl  10:50   1:10  \_ ruby /usr/lib/one/mads/one_hm.rb -p 2101 -l 2102 -b 127.0.0.1
oneadmin  4768  0.0  0.0 624808 29872 ?        SNl  10:50   0:00  \_ ruby /usr/lib/one/mads/one_vmm_exec.rb -t 15 -r 0 kvm
oneadmin  4785  0.0  0.0 354512 25708 ?        SNl  10:50   0:00  \_ ruby /usr/lib/one/mads/one_vmm_exec.rb -t 15 -r 0 lxd
oneadmin  4803  0.0  0.0 354516 25708 ?        SNl  10:50   0:00  \_ ruby /usr/lib/one/mads/one_vmm_exec.rb -l deploy,shutdown,reboot,cancel,save,restore,migrate,poll,pre,post,clean,snapshotcreate,snapshotre
oneadmin  4821  0.0  0.0 536604  4544 ?        Sl   10:50   0:00  \_ /usr/lib/one/mads/collectd -p 4124 -f 5 -t 50 -i 60
oneadmin  4882  0.0  0.0 271960  8316 ?        SNl  10:50   0:00  \_ ruby /usr/lib/one/mads/one_im_exec.rb -r 3 -t 15 -w 90 kvm
oneadmin  4896  0.0  0.0 271932  8216 ?        SNl  10:50   0:00  \_ ruby /usr/lib/one/mads/one_im_exec.rb -r 3 -t 15 -w 90 lxd
oneadmin  4909  0.0  0.0 271896  8220 ?        SNl  10:50   0:00  \_ ruby /usr/lib/one/mads/one_im_exec.rb -l -c -t 15 -r 0 vcenter
oneadmin  4922  0.0  0.0 542332  8740 ?        SNl  10:50   0:00  \_ ruby /usr/lib/one/mads/one_tm.rb -t 15 -d dummy,lvm,shared,fs_lvm,qcow2,ssh,ceph,dev,vcenter,iscsi_libvirt
oneadmin  4942  0.0  0.0 1154704 15280 ?       SNl  10:50   0:00  \_ ruby /usr/lib/one/mads/one_datastore.rb -t 15 -d dummy,fs,lvm,ceph,dev,iscsi_libvirt,vcenter -s shared,ssh,ceph,fs_lvm,qcow2,vcenter
oneadmin  4958  0.0  0.0 962372 28720 ?        SNl  10:50   0:00  \_ ruby /usr/lib/one/mads/one_market.rb -t 15 -m http,s3,one,linuxcontainers
oneadmin  4974  0.0  0.0 206440 10376 ?        SNl  10:50   0:00  \_ ruby /usr/lib/one/mads/one_ipam.rb -t 1 -i dummy
oneadmin  4986  0.0  0.0 1708368 28300 ?       SNl  10:50   0:00  \_ ruby /usr/lib/one/mads/one_auth_mad.rb --authn ssh,x509,ldap,server_cipher,server_x509
oneadmin 39171  0.0  0.0 407356 65796 ?        Sl   12:24   0:00 Passenger RackApp: /usr/lib/one/sunstone
o

Could someone help me?

Thanks.

Hi,

I have solved my own question. Problem was in VirtualHost parameter “ServerName”. After modifying that by “ServerName localhost”, VNC connection in a new tab opens correctly.

Bye!