GSOC 2019: OpenMRS Atlas 3.1

Brief Introduction

OpenMRS Atlas was previously written using PHP. OpenMRS moved towards LDAP, and that caused Atlas to break.

To solve this, work was started on a Node implementation of Atlas in a previous years’ GSoC project, but it was never fully deployed. The implementation contained most of the UI, and several routes to retrieve and save data, that aren’t yet connected to the frontend.

The primary goal of this project is to make that connection by implementing login, and ensuring basic Atlas functionality like adding, updating, and removing markers works properly.

Additional goals include adding admin privileges, a simple notification system for admins, support upload of marker images, and download of screenshots of maps.

Mentors / Helpers

@burke @harsha89 @cintiadr

Primary Goals

Additional Goals

Important Resources

2 Likes

I was looking for what the missing functionality was, that was present in ‘openmrs-contrib-atlas’ and not in ‘openmrs-contrib-atlas-node’. I could find that the ‘ping’(update, I suppose) functionality, and the ‘download’ routes were missing. Is there anything else I am missing?

I couldn’t get myself a better summary of the missing functionality as I couldn’t set up the openmrs-contrib-atlas, because I do not really know how to setup such apps. However, I could get the openmrs-contrib-atlas-node repo working.

So, how do I setup openmrs-contrib-atlas? Thank you :slight_smile:

Cc: @burke @dkayiwa @cintiadr

Please ignore the openmrs-contrib-atlas-node repo, and use branch listed in wiki

I don’t have a staging environment anymore. I set it up last year, but the project wasn’t selected, but I can recreate it later if it gets selected this time.

1 Like

I updated the wiki page with all the current details.

The easiest way to start current atlas locally I’d think it’s docker compose:

I can retrieve what’s inside .env if that’s necessary, but I think you might need to create your own google api creds.

The project just require you to make it work with the latest supported atlas module. If you get it with another version, it’s ok.

I can set up multiple instances of atlas depending on what you need.

1 Like

About the routes, I assume a few things are missing indeed, but I’m not sure anyone actually knows anymore.

1 Like

Thanks a lot for the info! For now, I think I’ll try to setup atlas using openmrs-contrib-ansible-docker-compose, and see where to go from there.

I found this issue, so I made a PR for it. Unfortunately, I couldn’t test the code I wrote because the ‘/login’ route leads to ‘http://localhost:8080/authenticate/atlas’, which I don’t know how to set up. How do I set up that link?

Well, that’s part of the problem.

Login is NOT working in atlas. A good part of the atlas project is to actually reimplement login.

I can tell you that in production it redirects to our ID SSO (it’s configured by environment variables), but it broke a long long time ago. We need to reimplement it.

1 Like

I see. Thanks a lot for the info! I think I now have a much better view of the project. :slight_smile:

@cintiadr I’m getting the following error when executing nodemon.

[nodemon] 1.18.10
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `node ./bin/www`
Atlas is listening at : http://localhost:3000
{ Error: getaddrinfo EAI_AGAIN db:3306
    at Object._errnoException (util.js:992:11)
    at errnoException (dns.js:55:15)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:92:26)
    --------------------
    at Protocol._enqueue (/home/krypt/myStuff/openmrs/openmrs-contrib-atlas/node_modules/mysql/lib/protocol/Protocol.js:145:48)
    at Protocol.handshake (/home/krypt/myStuff/openmrs/openmrs-contrib-atlas/node_modules/mysql/lib/protocol/Protocol.js:52:23)
    at Connection.connect (/home/krypt/myStuff/openmrs/openmrs-contrib-atlas/node_modules/mysql/lib/Connection.js:130:18)
    at Object.<anonymous> (/home/krypt/myStuff/openmrs/openmrs-contrib-atlas/db.js:14:12)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
  code: 'EAI_AGAIN',
  errno: 'EAI_AGAIN',
  syscall: 'getaddrinfo',
  hostname: 'db',
  host: 'db',
  port: 3306,
  fatal: true }

The GET routes are working fine, but I think the error may be causing my POST requests sent through postman to not respond. I’ve encountered it previously but I didn’t bother much as the GET routes were working fine. The only useful info I could find about it is: https://stackoverflow.com/a/40182520/6731940 .

What does this error mean and how do I fix it?

That means that the database wasn’t up ( db:3306, that would be mysql).

How are you trying to start it? Can you run to me a docker ps and let me know what happened?

And all the logs for the database, if you have them.

1 Like

By your command line, you are probably running nodemon without starting the database before??

Or you haven’t configured correctly the host.

db:3306 would be what you’d see if using docker-compose:

1 Like

That was it, mysql server was up but I had forgotten to create the password environment variable. Thanks!

@cintiadr, is there some way for me to replicate the openmrs LDAP server locally on my machine?

You need docker.

Then you can clone https://github.com/openmrs/openmrs-contrib-ansible-docker-compose/tree/master/files/ldap , and do a docker-compose up -d.

That won’t have any data, but you can see the admin passwords in the compose yaml file.

Our LDAP tree is explained here: https://wiki.openmrs.org/display/ISM/OpenMRS+ID+LDAP+Explained

Anyway, in a couple of weeks I can provide a stg ldap (with all the data) and plus a couple of ldap files for atlas users and admin groups.

I’m trying to create a simple LDAP app thingy so that I could get a better idea of how LDAP works. I’m using this code to try and connect to the server, after using docker-compose up -d.

var ldap = require('ldapjs');

var client = ldap.createClient({
  url: 'ldap://127.0.0.1:636'
});

client.bind('cn=admin', 'admin', function(err) {
    console.log(err);
});

But I get the following error:

{ ConnectionError: 1__ldap://127.0.0.1:636 closed
    at /home/krypt/myStuff/openmrs/ldap_stuff/ldap_projects/learning_ldap/ldap_client/node_modules/ldapjs/lib/client/client.js:1277:17
    at Array.forEach (<anonymous>)
    at Client._onClose (/home/krypt/myStuff/openmrs/ldap_stuff/ldap_projects/learning_ldap/ldap_client/node_modules/ldapjs/lib/client/client.js:1272:19)
    at Object.onceWrapper (events.js:315:30)
    at emitOne (events.js:116:13)
    at Socket.emit (events.js:211:7)
    at TCP._handle.close [as _onclose] (net.js:557:12) lde_message: '1__ldap://127.0.0.1:636 closed', lde_dn: null }

I’m assuming its because I’m entering the username(cn)/password wrong. From the .yml file:

    environment:
      LDAP_ORGANIZATION: OpenMRS
      LDAP_DOMAIN: ${LDAP_DOMAIN:-openmrs.org}
      LDAP_ADMIN_PASSWORD: ${LDAP_ADMIN_PASSWORD:-admin}
      LDAP_TLS_CRT_FILENAME: ${LDAP_TLS_CRT_FILENAME:-ldap.crt}
      LDAP_TLS_KEY_FILENAME: ${LDAP_TLS_KEY_FILENAME:-ldap.key}
      LDAP_TLS_CA_CRT_FILENAME: ${LDAP_TLS_CA_CRT_FILENAME:-ca.crt}
      LDAP_TLS_VERIFY_CLIENT: never
      LDAP_LOG_LEVEL: 0

I could understand that the admin password was ‘admin’, I tried using the usernames ‘admin’, ‘root’, and ‘OpenMRS’, but I still get the error.

It gets tricky:

You’ll want to bind to “cn=admin,dc=openmrs,dc=org”:

docker exec -it ldap_ldap_1 bash
ldapsearch -LLL -Wx -D "cn=admin,dc=openmrs,dc=org" -b "dc=openmrs,dc=org"
Enter LDAP Password: admin

Note that it won’t have groups or users (it’s an empty ldap).

1 Like

This may be a delayed question but who are the mentors for this project? The GSoC list says its @burke and @dkayiwa, but the project page points to @pascal instead of @dkayiwa.

@suthagar23 @irenyak1 any response to the above?

It was mistakenly changed. I have updated the project page. Then the primary mentor is @burke and backup mentor is @dkayiwa.

1 Like