Deploy Server

Hi,
I have a problem with the deployment of the new configuration.
I currently use

        version: '3.7'
    services:
      server:
        image: 'docker.pkg.github.com/bidmcdigitalpsychiatry/lamp-server/lamp-server:latest'
        environment:
         - HTTPS=off
         - CDB=https://user:password@dblink/
         - DB_KEY=dbkey
         - ROOT_KEY=rootkey
        networks:
          - public
        deploy:
          mode: replicated
          labels:
            traefik.enable: 'true'
            traefik.http.routers.lamp_server.entryPoints: 'websecure'
            traefik.http.routers.lamp_server.rule: 'Host(`apilink`)'
            traefik.http.routers.lamp_server.tls.certresolver: 'default'
            traefik.http.services.lamp_server.loadbalancer.server.port: 3000
          placement:
            constraints:
              - node.role == manager
      database:
        image: apache/couchdb:latest
        volumes:
          - /home/ec2-user/data/couchdb:/opt/couchdb/data
        networks:
          - public
        environment:
          - COUCHDB_USER=usser
          - COUCHDB_PASSWORD=password
        deploy:
          mode: replicated
          labels:
            traefik.enable: 'true'
            traefik.http.routers.lamp_db.entryPoints: 'websecure'
            traefik.http.routers.lamp_db.rule: 'Host(`dblink`)'
            traefik.http.routers.lamp_db.tls.certresolver: 'default'
            traefik.http.services.lamp_db.loadbalancer.server.port: 5984
          placement:
            constraints:
              - node.role == manager
    networks:
      public:
        external: true
    volumes:
      database:
      legacydb:

and work correctly.
We must update with current latest server release and the team suggested us to change server image with
bidmcdigitalpsychiatry/lamp-server:2020
but unfortunately I have the following error

  (node:1) UnhandledPromiseRejectionWarning: Error: missing
      at Request._callback (/usr/src/app/node_modules/nano/lib/nano.js:168:15)
      at Request.self.callback (/usr/src/app/node_modules/request/request.js:185:22)
      at Request.emit (events.js:315:20)
      at Request.EventEmitter.emit (domain.js:486:12)
      at Request.<anonymous> (/usr/src/app/node_modules/request/request.js:1161:10)
      at Request.emit (events.js:315:20)
      at Request.EventEmitter.emit (domain.js:486:12)

I also need to know how to configure the server for push notifications. We must implement our custom Android and iOs Applications that must support push notification, in the new server configuration iwenotice new configuration var environment

 PUSH_API_GATEWAY: 'https://app-gateway.lamp.digital/'
      PUSH_API_KEY: 'YOUR_PUSH_KEY_HERE'

these configuration work also with custom app or for that i need other platorm.

Thanks in advance.

Hi Marco,

In order to get the API key from us for push notifications, we need a copy of your IRB/study protocol (Apple and Google regulations). Feel free to email these documents to me and I will get you the code you need to configure the push notifications.

Aditya will be in touch later on with a response to your other question.

Best,

Rebecca

Hi Marco,

As I understand, you are creating your own version so may not need our API keys as you can generate your own.

Thanks,
John

Hi John, Rebecca.

Yes correct, but how we can integrate server notifications? Where we must configure our api, The only configuration for the server are.
PUSH_API_GATEWAY: ‘https://app-gateway.lamp.digital/
PUSH_API_KEY: ‘YOUR_PUSH_KEY_HERE’

We must implement our PUSH_API_GATEWAY?

If you are submitting the iOS and Android apps to their respective stores for App Review, you will have to use your own developer certificates/keys and spin up the LAMP-app-gateway as part of the docker-compose.yml file you are using. Here’s an example:

  app-gateway:
    image: 'app-gateway:latest'
    environment:
     APNS_P8: "MY_APNS_FILE_NAME"
     APNS_AUTH: "MY_APNS_AUTH_TOKEN"
     GCM_AUTH: "MY_GCM_AUTH_TOKEN"
     API_KEYS: "COMMA_SEPARATED_LIST_OF_API_KEYS"
    networks:
      - public
    deploy:
      mode: replicated
      labels:
        traefik.enable: 'true'
        traefik.http.routers.lamp_app_gateway.entryPoints: 'websecure'
        traefik.http.routers.lamp_app_gateway.rule: 'Host(`app-gateway.MY_DOMAIN`)'
        traefik.http.routers.lamp_app_gateway.tls.certresolver: 'default'
        traefik.http.services.lamp_app_gateway.loadbalancer.server.port: 3000
      placement:
        constraints:
          - node.hostname == node-01.MY_DOMAIN

Thanks avaidyam,
i will try this config for push notifications.

Any news about our error deploing the server image with bidmcdigitalpsychiatry/lamp-server:2020
There are some other configurations? I tried with documentation with no success.

Hi @mpagnanelli - do you mind screenshotting for me what your CouchDB admin interface shows for the list of databases? (Learn more about CouchDB’s management console here.)

Hi @avaidyam,
this is the response of /_all_dbs

["_global_changes","_users","activity","activity_event","activity_spec","credential","participant","researcher","root","sensor","sensor_event","sensor_spec","study","tag"]

Can you delete the root database?

Hi @avaidyam,
i removed the root database, now i had this active databases

["_global_changes","_users",“activity”,“activity_event”,“activity_spec”,“credential”,“participant”,“researcher”,“sensor”,“sensor_event”,“sensor_spec”,“study”,“tag”]

Here the log of server instance

Initializing LAMP API server...


  (node:1) UnhandledPromiseRejectionWarning: Error: connect ECONNREFUSED 127.0.0.1:6379


      at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1146:16)


  (Use `node --trace-warnings ...` to show where the warning was created)


  (node:1) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)


  (node:1) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.


  (node:1) UnhandledPromiseRejectionWarning: Error: connect ECONNREFUSED 127.0.0.1:6379


      at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1146:16)


  (node:1) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)


  (node:1) UnhandledPromiseRejectionWarning: Error: connect ECONNREFUSED 127.0.0.1:6379


      at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1146:16)


  (node:1) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 3)


  (node:1) UnhandledPromiseRejectionWarning: Error: connect ECONNREFUSED 127.0.0.1:6379


      at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1146:16)


  (node:1) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 4)


  (node:1) UnhandledPromiseRejectionWarning: Error: connect ECONNREFUSED 127.0.0.1:6379


      at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1146:16)


  (node:1) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 5)


  (node:1) UnhandledPromiseRejectionWarning: Error: connect ECONNREFUSED 127.0.0.1:6379


      at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1146:16)


  (node:1) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 6)


  (node:1) UnhandledPromiseRejectionWarning: Error: connect ECONNREFUSED 127.0.0.1:6379


      at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1146:16)


  (node:1) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 7)


  (node:1) UnhandledPromiseRejectionWarning: Error: connect ECONNREFUSED 127.0.0.1:6379


      at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1146:16)


  (node:1) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 8)


  (node:1) UnhandledPromiseRejectionWarning: Error: missing


      at Request._callback (/usr/src/app/node_modules/nano/lib/nano.js:168:15)


      at Request.self.callback (/usr/src/app/node_modules/request/request.js:185:22)


      at Request.emit (events.js:315:20)


      at Request.EventEmitter.emit (domain.js:486:12)


      at Request.<anonymous> (/usr/src/app/node_modules/request/request.js:1161:10)


      at Request.emit (events.js:315:20)


      at Request.EventEmitter.emit (domain.js:486:12)


      at IncomingMessage.<anonymous> (/usr/src/app/node_modules/request/request.js:1083:12)


      at Object.onceWrapper (events.js:421:28)


  (node:1) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 9)

This looks exactly like this issue. Once you follow those instructions you should be all set!

hi @avaidyam, thank you, now server run correctly.

Fantastic! Glad I could assist, @mpagnanelli! Perhaps if @kkadapa or others have any issues with setting up Redis you may be able to assist! :slight_smile:

Hello @mpagnanelli Could you please share your docker-compose.YML file or what entry did you had to change for enabling Redis? Were you able to get Push Notifications after setting up Redis?

Hi @avaidyam ,
as far as push notifications are concerned, we have loaded the gateway with the correct configurations but I do not receive any notification, from the database I see that the device tokens are saved correctly but it seems that pushes are not sent.
When does the server launch push notifications?

Hi @mpagnanelli, could you post this query in more detail in this GitHub issue? Thank you!