NBISweden / swefreq

Swedish Frequency resource for genomics website
https://swefreq.nbis.se/
GNU General Public License v3.0
8 stars 1 forks source link

Multiple dataset browsers and routing. #441

Closed viklund closed 6 years ago

viklund commented 6 years ago

Our current setup for dataset browser, nginx and portal looks like this:

  1. In the mysql database there's an entry for the browser_uri for each dataset.
  2. The browser checks what port it is running on and based on that chooses what mongodb to use.
  3. nginx routes to the correct browser based on sub-domain.

The problem with this is that we need to add information about what database/url the browser has in all these three places. I suggest the following setup:

  1. We remove the entry in the database about browser_uri. We can do that since the browser should live at https://swefreq.nbis.se/dataset/<Dataset name>/browser. We also make sure that the database name in mongo is the same as the short_name in mysql.
  2. The same as above.
  3. nginx asks the python backend (not browser) what browser to route to. This is done the same way as for the downloadable files where nginx send the request to the backend which validates the user and then does an internal redirect. The backend can tell nginx this since the backend can read the config file.

We will probably need to setup a backend upstream for each browser instance in the nginx config. The config for the browser is created by ansible so this shouldn't be too difficult. If we read the config file that is created when provisioning we can also use that to add the routes, which would get rid of the backend roundtrip to figure out the correct browser.

viklund commented 6 years ago

This has been resolved. Now we store the mapping between dataset and mongodatabase in the config file.