datacamp / rdocumentation-app

The web application running rdocumentation.org.
https://www.rdocumentation.org
MIT License
42 stars 13 forks source link

RDocumentation API

Important notes:

  1. Please read this confluence page which explains the architecture of how RDocumentation works.
  2. This repo is now only used for its API. Please disregard all the UI code here. THe UI now lives in datacamp/rdocumentation-2.0.

rdocumentation.org provides the R community with centralized, quality and easy to search documentation.

R documentation sifts through all CRAN, GitHub and BioConductor packages hourly, parses the documentation files and indexes them in an Elasticsearch database. This makes rdocumentation.org the best online resource to browse all R package documentation.

How the API works

You can check docs for the API by running the app locally and going to http://localhost:3000/docs/

  1. Newly parsed packages are added to the rdocs-app-worker SQS queue every hour.
  2. That queue is configured to hit the /task path which calls the processMessage method of the WorkerController
  3. That processMessage method adds topics to the mysql database
  4. After a query is sent to the API to request a topic, that topic is stored in Redis so that it's returned faster next time.

Development

Using docker

You'll need docker and docker-compose to run this stack locally

Once the db is running, you can use a mysql client like dbeaver to access it. Connect to it based on the environment variables you have in docker-compose.yml. You will also need to go in the "Driver properties" tab of the connection window, and set allowPublicKeyRetrieval to true. When you are done, click on Finish. The server host should just be localhost.

Troubleshooting

If you get an error: SequelizeConnectionError: ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client follow these steps:

  1. Access your mysql container: you can do it either through the docker app by clicking on the "cli" button of the container, or in your terminal by running:
    • docker ps and grabing the container id for mysql
    • docker exec -it <mysql_container_id> bash
  2. mysql -u root -p
  3. Enter: password
  4. ALTER USER 'root' IDENTIFIED WITH mysql_native_password BY 'password';
  5. flush privileges;

Deployment

What the CI does

This application runs on the DataCamp infrastructure. Our custom CI flow will:

License

See the LICENSE file for license rights and limitations (MIT).