cloudfoundry-incubator / admin-ui

Need new main contributor - An application for viewing Cloud Foundry metrics and operations data.
Apache License 2.0
71 stars 44 forks source link

ERR /home/vcap/app/lib/admin.rb:6:in `require_relative': /home/vcap/app/lib/admin/config.rb:95: syntax error, unexpected '.' (SyntaxError) #162

Closed harshalk91 closed 7 years ago

harshalk91 commented 7 years ago

I am not able to deploy admin-ui. I am using CF Release 230 and using branch cf-release-pre-v245 Following my configuration file:

ubuntu@bosh:~/admin-ui$ cat config/default.yml
---
bind_address: 0.0.0.0
ccdb_uri: postgres://ccadmin:CCDB_PASSWORD@192.168.1.x:5524/ccdb
cloud_controller_discovery_interval: 300
cloud_controller_ssl_verify_none: true
cloud_controller_uri: https://api.xxx.xxx.openstack.xxx.com
component_connection_retries: 2
data_file: data/data.json
db_uri: sqlite://data/store.db
doppler_data_file: data/doppler_data.json
doppler_reconnect_delay: 300
doppler_rollup_interval: 30
event_days: 7
log_file: admin_ui.log
log_file_page_size: 51200
log_file_sftp_keys: [ ]
log_files: ['/var/vcap/sys/log/cloud_controller_ng/*.log', 'admin_ui.log']
mbus: nats://NATS_USER:NATS_PASSWORD@192.168.1.xx:4222
monitored_components: [NATS, CloudController, DEA, HealthManager, Router, -Provisioner, ALL]
nats_discovery_interval: 30
nats_discovery_timeout: 10
port: 8070
receiver_emails: [ ]
sender_email:
  server: localhost
  account: vcap@localhost
stats_file: data/stats.json
stats_refresh_schedules: [ '0 5 * * *' ]
stats_retries: 5
stats_retry_interval: 300
uaa_client:
  id: admin
  secret: c1oudc0w
uaadb_uri: postgres://uaaadmin:UAADB_PASSWORD@192.168.1.xx:5524/uaadb
uaa_groups_admin: [ admin_ui.admin ]
uaa_groups_user: [ admin_ui.user ]
varz_discovery_interval: 30

Here is my deployment manifest:

ubuntu@bosh:~/admin-ui$ cat manifest.yml
---
applications:
- name: admin-ui-100
  memory: 512M
  instances: 1
  command: ~/bin/admin -c ~/config/default.yml

And here are application logs:

2017-02-02T12:23:40.74+0000 [API/0]      OUT App instance exited with guid df8de51b-67dd-4300-b878-5e330f2e9a97 payload: {"cc_partition"=>"default", "droplet"=>"df8de51b-67dd-4300-b878-5e330f2e9a97", "version"=>"ce958aa9-ee38-4092-84e5-61cf8c03ebdb", "instance"=>"9ef9ebc2786e46799ca087923ca9e12a", "index"=>0, "reason"=>"CRASHED", "exit_status"=>1, "exit_description"=>"failed to accept connections within health check timeout", "crash_timestamp"=>1486038220}
2017-02-02T12:23:41.36+0000 [DEA/0]      OUT Removing crash for app with id df8de51b-67dd-4300-b878-5e330f2e9a97
2017-02-02T12:23:41.36+0000 [DEA/0]      OUT Stopping app instance (index 0) with guid df8de51b-67dd-4300-b878-5e330f2e9a97
2017-02-02T12:23:41.36+0000 [DEA/0]      OUT Stopped app instance (index 0) with guid df8de51b-67dd-4300-b878-5e330f2e9a97
2017-02-02T12:24:01.49+0000 [DEA/0]      OUT Starting app instance (index 0) with guid df8de51b-67dd-4300-b878-5e330f2e9a97
2017-02-02T12:24:04.32+0000 [App/0]      ERR /home/vcap/app/lib/admin.rb:6:in `require_relative': /home/vcap/app/lib/admin/config.rb:95: syntax error, unexpected '.' (SyntaxError)
2017-02-02T12:24:04.32+0000 [App/0]      ERR         schema[:stats_refresh_schedules]&.each do |spec|
2017-02-02T12:24:04.32+0000 [App/0]      ERR                                           ^
2017-02-02T12:24:04.32+0000 [App/0]      ERR /home/vcap/app/lib/admin/config.rb:232: syntax error, unexpected '.'
2017-02-02T12:24:04.32+0000 [App/0]      ERR       @config[:sender_email][:authtype]&.to_sym
2017-02-02T12:24:04.32+0000 [App/0]      ERR                                          ^
2017-02-02T12:24:04.32+0000 [App/0]      ERR    from /home/vcap/app/lib/admin.rb:6:in `<top (required)>'
2017-02-02T12:24:04.32+0000 [App/0]      ERR    from /home/vcap/app/bin/admin:11:in `require'
2017-02-02T12:24:04.32+0000 [App/0]      ERR    from /home/vcap/app/bin/admin:11:in `<main>'
2017-02-02T12:24:04.34+0000 [App/0]      OUT
2017-02-02T12:24:04.37+0000 [DEA/0]      ERR Instance (index 0) failed to start accepting connections

Is there something i am missing out?

rboykin commented 7 years ago

@harshalk91 Reference this prior issue: https://github.com/cloudfoundry-incubator/admin-ui/issues/145.

The crash is likely being caused by the admin ui not using the ENV['VCAP_APP_PORT'], but instead trying to listen on your configured port of 8070.

The &. syntax errors are likely due to an older ruby level. The &. construct is a ruby 2.3 addition. Try adding the latest ruby buildpack on your cf push to get the later version of ruby: -b https://github.com/cloudfoundry/ruby-buildpack.git

harshalk91 commented 7 years ago

@rboykin Thank you so much!! I am able to deploy admin-ui as an application. But still confused on which credentials are needed to login on admin-ui

rboykin commented 7 years ago

@harshalk91 You use a UAA managed user to login to the admin ui. The UAA user must be a member of the group designated in your admin ui's default.yml. In your case, you used admin_ui.admin group membership for your admin-enabled group and admin_ui.user group membership for your user-enabled group. As an example, from the https://github.com/cloudfoundry-incubator/admin-ui/blob/master/README.md you can see the following snippet of uaac commands:

Create a new group and add the 'admin' user to it uaac group add admin_ui.admin uaac member add admin_ui.admin admin

rboykin commented 7 years ago

Closed due to inaction