ontoportal / ontoportal_docker

Scripts for running and developing OntoPortal with docker
1 stars 1 forks source link

Brand Customisation steps and end up with "We're sorry but something has gone wrong. We have been notified of this error." #5

Open chris-day opened 1 year ago

chris-day commented 1 year ago

Describe the bug I was going through the steps outlined here - https://ontoportal.github.io/documentation/administration/steps/branding-customizations for brand customisation.

I have made the changes and run the apply steps here - https://ontoportal.github.io/documentation/administration/steps/advanced_configuration

Then when I try to login to the UI I get the ""We're sorry but something has gone wrong. We have been notified of this error."

Of note, the REST API seems to work, and I can submit a simple request

To Reproduce Steps to reproduce the behavior:

  1. Follow the branding customisation guide.

Expected behavior Branding is applied and the customisations are visible

Screenshots

Screenshot 2023-05-17 131802
syphax-bouazzouni commented 1 year ago

hi @chris-day

If you want to see the logs and understand the error behind this, you can go and open these files /var/log/rails/appliance.log or /var/log/httpd/appliance.ontoportal.org_non-tls_error.log (a full list of ours log files can be found joined to this issue: https://github.com/ontoportal/documentation/issues/14)

If you actively develop and want to do more in-depth changes to your appliance, I suggest you run a local development environment for your UI (see https://ontoportal.github.io/documentation/docs/developers-docs/development-environment/frontend_environment/)

dwinston commented 4 months ago

I get this error as well. I don't know how to fix. I found this in /var/log/rails/appliance.log:

F, [2024-02-23T18:47:54.334323 #4797] FATAL -- :
MultiJson::ParseError (Problem retrieving:
http://<my-domain>:8443/ontologies?include=all&include_views=true

Error: Problem loading json
<html>
<head><title>400 The plain HTTP request was sent to HTTPS port</title></head>
<body>
<center><h1>400 Bad Request</h1></center>
<center>The plain HTTP request was sent to HTTPS port</center>
<hr><center>nginx/1.20.1</center>
</body>
</html>

/srv/ontoportal/.bundle/ruby/2.7.0/gems/multi_json-1.15.0/lib/multi_json/adapters/oj.rb:34:in `load'
    /srv/ontoportal/.bundle/ruby/2.7.0/gems/multi_json-1.15.0/lib/multi_json/adapters/oj.rb:34:in `load'
    /srv/ontoportal/.bundle/ruby/2.7.0/gems/multi_json-1.15.0/lib/multi_json/adapter.rb:21:in `load'
    /srv/ontoportal/.bundle/ruby/2.7.0/gems/multi_json-1.15.0/lib/multi_json.rb:122:in `load'
    /srv/ontoportal/.bundle/ruby/2.7.0/bundler/gems/ontologies_api_ruby_client-7331b8372056/lib/ontologies_api_client/http.rb:287:in `load_json'
    /srv/ontoportal/.bundle/ruby/2.7.0/bundler/gems/ontologies_api_ruby_client-7331b8372056/lib/ontologies_api_client/http.rb:154:in `object_from_json'
    /srv/ontoportal/.bundle/ruby/2.7.0/bundler/gems/ontologies_api_ruby_client-7331b8372056/lib/ontologies_api_client/middleware/faraday-object-cache.rb:94:in `block in call'
    /srv/ontoportal/.bundle/ruby/2.7.0/gems/faraday-2.7.10/lib/faraday/response.rb:42:in `on_complete'
    /srv/ontoportal/.bundle/ruby/2.7.0/bundler/gems/ontologies_api_ruby_client-7331b8372056/lib/ontologies_api_client/middleware/faraday-object-cache.rb:63:in `call'
    /srv/ontoportal/.bundle/ruby/2.7.0/bundler/gems/ontologies_api_ruby_client-7331b8372056/lib/ontologies_api_client/middleware/faraday-last-updated.rb:16:in `call'
    /srv/ontoportal/.bundle/ruby/2.7.0/bundler/gems/ontologies_api_ruby_client-7331b8372056/lib/ontologies_api_client/middleware/faraday-slices.rb:16:in `call'
    /srv/ontoportal/.bundle/ruby/2.7.0/bundler/gems/ontologies_api_ruby_client-7331b8372056/lib/ontologies_api_client/middleware/faraday-user-apikey.rb:16:in `call'
    /srv/ontoportal/.bundle/ruby/2.7.0/gems/faraday-2.7.10/lib/faraday/rack_builder.rb:153:in `build_response'
    /srv/ontoportal/.bundle/ruby/2.7.0/gems/faraday-2.7.10/lib/faraday/connection.rb:444:in `run_request'
    /srv/ontoportal/.bundle/ruby/2.7.0/gems/faraday-2.7.10/lib/faraday/connection.rb:200:in `get'
    /srv/ontoportal/.bundle/ruby/2.7.0/bundler/gems/ontologies_api_ruby_client-7331b8372056/lib/ontologies_api_client/http.rb:66:in `get'
    /srv/ontoportal/.bundle/ruby/2.7.0/bundler/gems/ontologies_api_ruby_client-7331b8372056/lib/ontologies_api_client/collection.rb:43:in `entry_point'
    /srv/ontoportal/.bundle/ruby/2.7.0/bundler/gems/ontologies_api_ruby_client-7331b8372056/lib/ontologies_api_client/collection.rb:56:in `all'
    /srv/ontoportal/bioportal_web_ui/releases/20240223183826/app/controllers/home_controller.rb:7:in `index'
    /srv/ontoportal/.bundle/ruby/2.7.0/gems/actionpack-6.1.7.3/lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
    /srv/ontoportal/.bundle/ruby/2.7.0/gems/actionpack-6.1.7.3/lib/abstract_controller/base.rb:228:in `process_action'
    /srv/ontoportal/.bundle/ruby/2.7.0/gems/actionpack-6.1.7.3/lib/action_controller/metal/rendering.rb:30:in `process_action'
    /srv/ontoportal/.bundle/ruby/2.7.0/gems/actionpack-6.1.7.3/lib/abstract_controller/callbacks.rb:42:in `block in process_action'
    /srv/ontoportal/.bundle/ruby/2.7.0/gems/activesupport-6.1.7.3/lib/active_support/callbacks.rb:117:in `block in run_callbacks'
    /srv/ontoportal/.bundle/ruby/2.7.0/gems/actiontext-6.1.7.3/lib/action_text/rendering.rb:20:in `with_renderer'
    /srv/ontoportal/.bundle/ruby/2.7.0/gems/actiontext-6.1.7.3/lib/action_text/engine.rb:59:in `block (4 levels) in <class:Engine>'
    /srv/ontoportal/.bundle/ruby/2.7.0/gems/activesupport-6.1.7.3/lib/active_support/callbacks.rb:126:in `instance_exec'
    /srv/ontoportal/.bundle/ruby/2.7.0/gems/activesupport-6.1.7.3/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
    /srv/ontoportal/.bundle/ruby/2.7.0/gems/activesupport-6.1.7.3/lib/active_support/callbacks.rb:137:in `run_callbacks'
    /srv/ontoportal/.bundle/ruby/2.7.0/gems/actionpack-6.1.7.3/lib/abstract_controller/callbacks.rb:41:in `process_action'
    /srv/ontoportal/.bundle/ruby/2.7.0/gems/actionpack-6.1.7.3/lib/action_controller/metal/rescue.rb:22:in `process_action'
    /srv/ontoportal/.bundle/ruby/2.7.0/gems/actionpack-6.1.7.3/lib/action_controller/metal/instrumentation.rb:34:in `block in process_action'
    /srv/ontoportal/.bundle/ruby/2.7.0/gems/activesupport-6.1.7.3/lib/active_support/notifications.rb:203:in `block in instrument'
    /srv/ontoportal/.bundle/ruby/2.7.0/gems/activesupport-6.1.7.3/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
    /srv/ontoportal/.bundle/ruby/2.7.0/gems/activesupport-6.1.7.3/lib/active_support/notifications.rb:203:in `instrument'
    /srv/ontoportal/.bundle/ruby/2.7.0/gems/actionpack-6.1.7.3/lib/action_controller/metal/instrumentation.rb:33:in `process_action'
    /srv/ontoportal/.bundle/ruby/2.7.0/gems/actionpack-6.1.7.3/lib/action_controller/metal/params_wrapper.rb:249:in `process_action'
    /srv/ontoportal/.bundle/ruby/2.7.0/gems/activerecord-6.1.7.3/lib/active_record/railties/controller_runtime.rb:27:in `process_action'
    /srv/ontoportal/.bundle/ruby/2.7.0/gems/actionpack-6.1.7.3/lib/abstract_controller/base.rb:165:in `process'
    /srv/ontoportal/.bundle/ruby/2.7.0/gems/actionview-6.1.7.3/lib/action_view/rendering.rb:39:in `process'
    /srv/ontoportal/.bundle/ruby/2.7.0/gems/actionpack-6.1.7.3/lib/action_controller/metal.rb:190:in `dispatch'
    /srv/ontoportal/.bundle/ruby/2.7.0/gems/actionpack-6.1.7.3/lib/action_controller/metal.rb:254:in `dispatch'
    /srv/ontoportal/.bundle/ruby/2.7.0/gems/actionpack-6.1.7.3/lib/action_dispatch/routing/route_set.rb:50:in `dispatch'
    /srv/ontoportal/.bundle/ruby/2.7.0/gems/actionpack-6.1.7.3/lib/action_dispatch/routing/route_set.rb:33:in `serve'
    /srv/ontoportal/.bundle/ruby/2.7.0/gems/actionpack-6.1.7.3/lib/action_dispatch/journey/router.rb:50:in `block in serve'
    /srv/ontoportal/.bundle/ruby/2.7.0/gems/actionpack-6.1.7.3/lib/action_dispatch/journey/router.rb:32:in `each'
    /srv/ontoportal/.bundle/ruby/2.7.0/gems/actionpack-6.1.7.3/lib/action_dispatch/journey/router.rb:32:in `serve'
    /srv/ontoportal/.bundle/ruby/2.7.0/gems/actionpack-6.1.7.3/lib/action_dispatch/routing/route_set.rb:842:in `call'
    /srv/ontoportal/.bundle/ruby/2.7.0/gems/rack-2.2.7/lib/rack/tempfile_reaper.rb:15:in `call'
    /srv/ontoportal/.bundle/ruby/2.7.0/gems/rack-2.2.7/lib/rack/etag.rb:27:in `call'
    /srv/ontoportal/.bundle/ruby/2.7.0/gems/rack-2.2.7/lib/rack/conditional_get.rb:27:in `call'
    /srv/ontoportal/.bundle/ruby/2.7.0/gems/rack-2.2.7/lib/rack/head.rb:12:in `call'
    /srv/ontoportal/.bundle/ruby/2.7.0/gems/actionpack-6.1.7.3/lib/action_dispatch/http/permissions_policy.rb:22:in `call'
    /srv/ontoportal/.bundle/ruby/2.7.0/gems/actionpack-6.1.7.3/lib/action_dispatch/http/content_security_policy.rb:19:in `call'
    /srv/ontoportal/.bundle/ruby/2.7.0/gems/rack-2.2.7/lib/rack/session/abstract/id.rb:266:in `context'
    /srv/ontoportal/.bundle/ruby/2.7.0/gems/rack-2.2.7/lib/rack/session/abstract/id.rb:260:in `call'
    /srv/ontoportal/.bundle/ruby/2.7.0/gems/actionpack-6.1.7.3/lib/action_dispatch/middleware/cookies.rb:697:in `call'
    /srv/ontoportal/.bundle/ruby/2.7.0/gems/actionpack-6.1.7.3/lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'
    /srv/ontoportal/.bundle/ruby/2.7.0/gems/activesupport-6.1.7.3/lib/active_support/callbacks.rb:98:in `run_callbacks'
    /srv/ontoportal/.bundle/ruby/2.7.0/gems/actionpack-6.1.7.3/lib/action_dispatch/middleware/callbacks.rb:26:in `call'
    /srv/ontoportal/.bundle/ruby/2.7.0/gems/actionpack-6.1.7.3/lib/action_dispatch/middleware/actionable_exceptions.rb:18:in `call'
    /srv/ontoportal/.bundle/ruby/2.7.0/gems/actionpack-6.1.7.3/lib/action_dispatch/middleware/debug_exceptions.rb:29:in `call'
    /srv/ontoportal/.bundle/ruby/2.7.0/gems/actionpack-6.1.7.3/lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
    /srv/ontoportal/.bundle/ruby/2.7.0/gems/railties-6.1.7.3/lib/rails/rack/logger.rb:37:in `call_app'
    /srv/ontoportal/.bundle/ruby/2.7.0/gems/railties-6.1.7.3/lib/rails/rack/logger.rb:26:in `block in call'
    /srv/ontoportal/.bundle/ruby/2.7.0/gems/activesupport-6.1.7.3/lib/active_support/tagged_logging.rb:99:in `block in tagged'
    /srv/ontoportal/.bundle/ruby/2.7.0/gems/activesupport-6.1.7.3/lib/active_support/tagged_logging.rb:37:in `tagged'
    /srv/ontoportal/.bundle/ruby/2.7.0/gems/activesupport-6.1.7.3/lib/active_support/tagged_logging.rb:99:in `tagged'
    /srv/ontoportal/.bundle/ruby/2.7.0/gems/railties-6.1.7.3/lib/rails/rack/logger.rb:26:in `call'
    /srv/ontoportal/.bundle/ruby/2.7.0/gems/actionpack-6.1.7.3/lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
    /srv/ontoportal/.bundle/ruby/2.7.0/gems/actionpack-6.1.7.3/lib/action_dispatch/middleware/request_id.rb:26:in `call'
    /srv/ontoportal/.bundle/ruby/2.7.0/gems/rack-2.2.7/lib/rack/method_override.rb:24:in `call'
    /srv/ontoportal/.bundle/ruby/2.7.0/gems/rack-2.2.7/lib/rack/runtime.rb:22:in `call'
    /srv/ontoportal/.bundle/ruby/2.7.0/gems/activesupport-6.1.7.3/lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
    /srv/ontoportal/.bundle/ruby/2.7.0/gems/actionpack-6.1.7.3/lib/action_dispatch/middleware/executor.rb:14:in `call'
    /srv/ontoportal/.bundle/ruby/2.7.0/gems/rack-2.2.7/lib/rack/sendfile.rb:110:in `call'
    /srv/ontoportal/.bundle/ruby/2.7.0/gems/actionpack-6.1.7.3/lib/action_dispatch/middleware/host_authorization.rb:142:in `call'
    /srv/ontoportal/.bundle/ruby/2.7.0/gems/rack-mini-profiler-3.1.0/lib/mini_profiler.rb:260:in `call'
    /srv/ontoportal/.bundle/ruby/2.7.0/gems/railties-6.1.7.3/lib/rails/engine.rb:539:in `call'
    /srv/ontoportal/.bundle/ruby/2.7.0/gems/railties-6.1.7.3/lib/rails/railtie.rb:207:in `public_send'
    /srv/ontoportal/.bundle/ruby/2.7.0/gems/railties-6.1.7.3/lib/rails/railtie.rb:207:in `method_missing'
    /usr/share/ruby/vendor_ruby/phusion_passenger/rack/thread_handler_extension.rb:107:in `process_request'
    /usr/share/ruby/vendor_ruby/phusion_passenger/request_handler/thread_handler.rb:149:in `accept_and_process_next_request'
    /usr/share/ruby/vendor_ruby/phusion_passenger/request_handler/thread_handler.rb:110:in `main_loop'
    /usr/share/ruby/vendor_ruby/phusion_passenger/request_handler.rb:419:in `block (3 levels) in start_threads'
    /usr/share/ruby/vendor_ruby/phusion_passenger/utils.rb:113:in `block in create_thread_and_abort_on_exception'):

app/controllers/home_controller.rb:7:in `index'

I followed https://ontoportal.github.io/documentation/administration/steps/enable_https and here is my /etc/nginx/sites-enabled/ontologies_api.conf:

# MANAGED BY PUPPET
server {
  listen *:8080 default_server;

  server_name           data.appliance.ontoportal.org *.data.appliance.ontoportal.org ip-172-31-21-147.ec2.internal;

  access_log            /var/log/nginx/ontologies_api.access.log;
  error_log             /var/log/nginx/ontologies_api.error.log;

  location ^~ /.well-known/acme-challenge/ {
    root      /mnt/.letsencrypt;
    default_type text/plain;
  }

  location /annotatorplus/ {
    proxy_pass            http://localhost:8082/annotatorplus/;
    proxy_read_timeout    90s;
    proxy_connect_timeout 90s;
    proxy_send_timeout    90s;
    proxy_set_header      Host $host;
    proxy_set_header      X-Real-IP $remote_addr;
    proxy_set_header      X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header      X-Forwarded-Host $host;
    proxy_set_header      X-Forwarded-Proto $scheme;
    proxy_set_header      Proxy "";
  }

  location / {
    proxy_pass            http://ontologies_api;
    proxy_read_timeout    90s;
    proxy_connect_timeout 90s;
    proxy_send_timeout    90s;
    proxy_set_header      X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header      Host $http_host;
    proxy_set_header      X-Real-IP $remote_addr;
  }
}

server {
  listen       *:8443 ssl default_server;
  server_name  _;

  ssl_certificate           /etc/letsencrypt/live/<my-domain>/fullchain.pem;
  ssl_certificate_key       /etc/letsencrypt/live/<my-domain>/privkey.pem;

  access_log            /var/log/nginx/ssl-ontologies_api.access.log;
  error_log             /var/log/nginx/ssl-ontologies_api.error.log;

 location /annotatorplus/ {
    proxy_pass            http://localhost:8082/annotatorplus/;
    proxy_read_timeout    90s;
    proxy_connect_timeout 90s;
    proxy_send_timeout    90s;
    proxy_set_header      Host $host;
    proxy_set_header      X-Real-IP $remote_addr;
    proxy_set_header      X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header      Proxy "";
  }

  location / {
    proxy_pass            http://ontologies_api;
    proxy_read_timeout    90s;
    proxy_connect_timeout 90s;
    proxy_send_timeout    90s;
    proxy_set_header      X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header      Host $http_host;
    proxy_set_header      X-Real-IP $remote_addr;
  }
}
alexskr commented 4 months ago

@dwinston, are you using ontoportal appliance from amazon marketplace or vmware OVF image. Also what version of the appliance are you using?

dwinston commented 4 months ago

@alexskr the amazon marketplace AMI. Version 3.2.0.

dwinston commented 4 months ago

After I modified ontoportal configuration files to enable HTTPS, I ran a deployment of the UI and API code as directed. I wonder if the ./setup_deploy_env.sh call changed versions of things.

dwinston commented 4 months ago

I get through https://ontoportal.github.io/documentation/administration/steps/initial_installation no problem, i.e. I can access the web UI over insecure http and log in with user admin and password <ec2-instance-id>.

dwinston commented 4 months ago

I was able to effect brand customization by using an aws application load balancer to terminate https. However, I haven't been able to figure out what to set in /srv/ontoportal/virtual_appliance/appliance_config/site_config.rb. I have $UI_HOSTNAME set to properly load ui resources, but everything else ($REST_HOSTNAME, $REST_PORT, $REST_URL_PREFIX, and $REST_URL) commented out because with the combinations I've tried for these other variables, including ports 8080 and 8443, I get errors (either the same error as above, or request timeouts). Can you recommend a configuration here with an aws application load balancer with HTTPS listeners on 443, 8080, and/or 8443 that forward to the instance's target group (to port 80, 8080, ...)? I can't figure it out.

dwinston commented 4 months ago

You can see what I have so far at https://heliontoportal.fairos.org/, which loads, but then 'Search for a class' don't work because it tries a GET request to https://<Public IPv4 DNS address for Instance>:8080/search.