The Open PHACTS Explorer is an HTML5 & CSS3 application for chemical information discovery and browsing. It is used to search for chemical compound and target information using a web search interface. It uses Ruby on Rails, Ember JS and OPS.JS. The Explorer uses the Open PHACTS Linked Data API.
The Docker image openphacts/explorer2 can be used to run the explorer2 on any Linux host with Docker:
docker pull openphacts/explorer2
docker run -p 3000:3000 -e RAILS_ENV=development -it openphacts/explorer2
This will start Explorer2 on http://localhost:3000/
The environment variables that can be set, together with their defaults:
-e RAILS_ENV=production
-e API_URL=https://beta.openphacts.org/2.1
-e API_APP_ID=161aeb7d
-e API_APP_KEY=cffc292726627ffc50ece1dccd15aeaf
-e EXPLORER_MAINTENANCE=FALSE
-e ES_SEARCH_URL=http://localhost:8839/search
-e AUTOCOMPLETE_URL=http://localhost:8839/autocomplete
The EXPLORER_MAINTENANCE flag forces the explorer to display a maintenance page if set to TRUE.
If you want to change the Dockerfile during test and development and build an explorer docker image from your local clone of the explorer2 repository then try:
docker build -t explorer .
To investigate the logs for the docker container you are running first list all the running containers with:
docker ps
Note the CONTAINER ID (or name) and run the following (replace CONTAINER_ID with actual ID or name):
docker exec -it CONTAINER_ID bash
This will allow you to navigate around the files inside the docker container and you can then look at the logs directory. Type exit to leave this container - the actual container will still keep running.
Ruby 1.9.3+, Ruby on Rails 3.2.x, Ember JS, Bootstrap CSS/JS
ruby -vto check your Ruby version and install if required.- You may want to use rvm to handle multiple versions of ruby
bundle install- Copy
config/database.yml_exampletoconfig/database.ymland uncomment/configure your database of choice - Copy
config/environments/development.rb_exampletoconfig/environments/development.rb- (and production/test)
- Register to get your application keys.
- Copy
config/app_settings.yml_exampletoconfig/app_settings.yml- change the
url,app_idandapp_keyapp keys and API url to the appropriate values.
- change the
rake db:create:allrake db:migrate- add
RAILS_ENV="production"orRAILS_ENV="test"to migrate those environments, by default it wil bedevelopment
- add
rake assets:precompileif running inproductionenvironment- If running webrick in production then change
config.serve_static_assets = falsetoconfig.serve_static_assets = trueinconfig/environments/production.rb
- If running webrick in production then change
rails s- If your site is down for maintenance then change the app_settings.yml variable 'maintenance' to TRUE
Now navigate your browser to http://localhost:3000/ - To use the openphacts search API change the es_search_url setting to point to the search API location eg
http://localhost:8839/search
In the environment file ie development.rb and/or production.rb, add/uncomment the following:
#config.relative_url_root = "/my_app"
#config.assets.prefix = "/my_app/assets"
Change the paths to whatever is appropriate to your sub-uri. You must end the config.assets.prefix with /assets or the images will not be loaded correctly.
You can have multiple level sub-uris eg /my_app/version1.
It is recommended to clear out the cache ie rm tmp/cache when adding a sub-uri and also anything in public/assets (or public/assets/your-sub-uri) before you start the server to ensure the glyphicons are loaded correctly.
There is a handlebars helper called getImage which should be used instead of <img> tags when showing an image in the html.
This uses Elastic Search via the Open PHACTS Search service.See env variables to pass in the URL above.
The Ember JS side of things uses the Qunit test framework with Karma for automation. The javascript test files are within app/assets/javascripts/tests. We recommend looking at the Ember testing guides but here is some setup info. The Karma test runner setup files are contained in the directory test/karma. The js to load and browsers to test are defined in karma.conf.js. To install Karma you will need Node JS (stop, come back, it's not that hard). Then you need to run npm install which installs the dependencies listed in the package.json file. These dependencies will be installed local to the karma directory so you will probably need to set up a path to find them export PATH="./node_modules/.bin:$PATH". You will also need Karma's command line interface npm install -g karma-cli. Then to run the tests do karma start.
The Explorer uses an embedded version of the Ketcher compound drawing tool by GGA Software Services.
The Explorer '2' source code is released under the MIT License. See licence.txt for more details.