Scalardb QA application not properly working with Azure Cosmos DB

我怕爱的太早我们不能终老 提交于 2021-02-08 10:04:54

问题


I tried to start scalardb backend QA application with Azure Cosmos DB. The Spring boot application shows as started. But I couldn't access the QA backend application with port 8090. Port 8090 does not list in listening ports lsof -i -P -n | grep LISTEN.

QA backend Application

When we connect it with the QA frontend application, it shows an error message An error occurred during the login

QA frontend Application

Step to reproduce

Cosmos DB Account Creation

  1. Create an Azure Cosmos DB account with Core (SQL) API.
  2. Change Default consistency to STRONG .
  3. Create schema using Schema Tool for Scalar DB

schema.json

  "qa.question": {
    "transaction": false,
    "partition-key": [
      "date"
    ],
    "clustering-key": [
      "created_at"
    ],
    "columns": {
      "date": "TEXT",
      "created_at": "BIGINT",
      "title": "TEXT",
      "user": "TEXT",
      "context": "TEXT",
      "updated_at": "BIGINT",
      "number_of_answers": "INT"
    },
    "ru": 400
  },

  "qa.answer": {
    "transaction": false,
    "partition-key": [
      "question_created_at"
    ],
    "clustering-key": [
      "created_at"
    ],
    "columns": {
      "question_created_at": "BIGINT",
      "context": "TEXT",
      "user": "TEXT",
      "created_at": "BIGINT"
    },
    "ru": 400
  },

  "qa.account": {
    "transaction": false,
    "partition-key": [
      "email"
    ],
    "clustering-key": [],
    "columns": {
      "email": "TEXT",
      "password": "TEXT"
    },
    "ru": 400
  },

  "qa.firstQuestionDate": {
    "transaction": false,
    "partition-key": [
      "id"
    ],
    "clustering-key": [],
    "columns": {
      "id": "TEXT",
      "first_question_date": "TEXT"
    },
    "ru": 400
  }
}

QA Backend Application Setup

  1. Application clone from QA application
  2. Update scalardb.properties (backend/QA/src/main/resources/scalardb.properties) file with cosmos db details.

scalardb.properties

# Comma separated contact points
scalar.db.contact_points=<Cosmos DB URI>

# Port number for all the contact points. Default port number for each database is used if empty.
#scalar.db.contact_port=

# Credential information to access the database
scalar.db.username=
scalar.db.password=<PRIMARY KEY>

# Storage implementation. Either cassandra or cosmos can be set. Default storage is cassandra.
scalar.db.storage=cosmos
  1. Update scalardb dependency with lastest version (2.2.0)

build.gradle

....

dependencies {
    //Scalar DB library
    compile group: 'com.scalar-labs', name: 'scalardb', version: '2.2.0'
    //Spring dependencies
    compile("org.springframework.boot:spring-boot-starter-web:${springBootVersion}") {
        exclude(group: 'ch.qos.logback')
    }
    compile("org.springframework.boot:spring-boot-starter:${springBootVersion}") {
        exclude(group: 'ch.qos.logback')
    }
    //Spring security layer for authentication
    compile("org.springframework.boot:spring-boot-starter-security:${springBootVersion}") {
        exclude(group: 'ch.qos.logback')
    }
    //Handle Json Web Token authentication
    compile group: 'io.jsonwebtoken', name: 'jjwt', version: '0.9.1'

    testCompile group: 'org.springframework.boot', name: 'spring-boot-starter-test', version: "${springBootVersion}"
}
  1. Execute export SPRING_PROFILES_ACTIVE="storage"
  2. Start backend QA application with sh gradlew bootRun command.

Setup Frontend Application

  1. Go to /frontend.
  2. Execute make command.
  3. Open QA application in browser http://localhost:8080/#/login.

The QA frontend application shows an error message An error occurred during the login when we attempt to log in.

The QA backend Application does not start with port 8090.

Has anyone already solved this problem? Can you give some suggestions to resolve this issue?

来源:https://stackoverflow.com/questions/64240960/scalardb-qa-application-not-properly-working-with-azure-cosmos-db

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!